added exportchannels
This commit is contained in:
parent
5621e6c737
commit
df739cca06
22 changed files with 349 additions and 0 deletions
|
@ -12,6 +12,10 @@
|
|||
</p>
|
||||
Repository for Redbot cogs developed by the Galaxy Discord Management team.
|
||||
|
||||
## ExportChannels **(WIP)**[^incomplete]
|
||||
This cog allows you to easily export channels using Discord Chat Exporter. **THIS COG IS NOT INTENDED FOR EXTERNAL USE. YOU WILL LIKELY HAVE TO RUN THIS COG LOCALLY AND MODIFY CODE SHOULD YOU WISH TO USE IT.**
|
||||
**Credit to Tyrrrz for the bundled version of Discord Chat Exporter within this cog. The original repository can be found [here](https://github.com/Tyrrrz/DiscordChatExporter).**
|
||||
|
||||
## Galaxy
|
||||
Utility cog designed specifically for use on the Galaxy Discord server.
|
||||
|
||||
|
|
4
exportchannels/__init__.py
Normal file
4
exportchannels/__init__.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
from .exportchannels import ExportChannels
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(ExportChannels(bot))
|
BIN
exportchannels/data/AdvancedStringBuilder.dll
Normal file
BIN
exportchannels/data/AdvancedStringBuilder.dll
Normal file
Binary file not shown.
BIN
exportchannels/data/AsyncKeyedLock.dll
Normal file
BIN
exportchannels/data/AsyncKeyedLock.dll
Normal file
Binary file not shown.
BIN
exportchannels/data/CliFx.dll
Normal file
BIN
exportchannels/data/CliFx.dll
Normal file
Binary file not shown.
230
exportchannels/data/DiscordChatExporter.Cli.deps.json
Normal file
230
exportchannels/data/DiscordChatExporter.Cli.deps.json
Normal file
|
@ -0,0 +1,230 @@
|
|||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v7.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v7.0": {
|
||||
"DiscordChatExporter.Cli/2.39.1": {
|
||||
"dependencies": {
|
||||
"CliFx": "2.3.1",
|
||||
"DiscordChatExporter.Core": "2.39.1",
|
||||
"DotnetRuntimeBootstrapper": "2.4.0",
|
||||
"FuckRussia": "1.0.1",
|
||||
"Gress": "2.0.1",
|
||||
"Spectre.Console": "0.46.0"
|
||||
},
|
||||
"runtime": {
|
||||
"DiscordChatExporter.Cli.dll": {}
|
||||
}
|
||||
},
|
||||
"AdvancedStringBuilder/0.1.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/AdvancedStringBuilder.dll": {
|
||||
"assemblyVersion": "0.1.0.0",
|
||||
"fileVersion": "0.1.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AsyncKeyedLock/6.2.0": {
|
||||
"runtime": {
|
||||
"lib/net5.0/AsyncKeyedLock.dll": {
|
||||
"assemblyVersion": "6.2.0.0",
|
||||
"fileVersion": "6.2.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"CliFx/2.3.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/CliFx.dll": {
|
||||
"assemblyVersion": "2.3.1.0",
|
||||
"fileVersion": "2.3.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DotnetRuntimeBootstrapper/2.4.0": {},
|
||||
"FuckRussia/1.0.1": {},
|
||||
"Gress/2.0.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Gress.dll": {
|
||||
"assemblyVersion": "2.0.1.0",
|
||||
"fileVersion": "2.0.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"JsonExtensions/1.2.0": {
|
||||
"runtime": {
|
||||
"lib/net5.0/JsonExtensions.dll": {
|
||||
"assemblyVersion": "1.2.0.0",
|
||||
"fileVersion": "1.2.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Polly/7.2.3": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Polly.dll": {
|
||||
"assemblyVersion": "7.0.0.0",
|
||||
"fileVersion": "7.2.3.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RazorBlade/0.4.2": {
|
||||
"runtime": {
|
||||
"lib/net6.0/RazorBlade.dll": {
|
||||
"assemblyVersion": "0.4.2.0",
|
||||
"fileVersion": "0.4.2.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Spectre.Console/0.46.0": {
|
||||
"dependencies": {
|
||||
"System.Memory": "4.5.5"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net7.0/Spectre.Console.dll": {
|
||||
"assemblyVersion": "0.0.0.0",
|
||||
"fileVersion": "0.46.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Superpower/3.0.0": {
|
||||
"runtime": {
|
||||
"lib/net5.0/Superpower.dll": {
|
||||
"assemblyVersion": "1.0.0.0",
|
||||
"fileVersion": "3.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Memory/4.5.5": {},
|
||||
"WebMarkupMin.Core/2.13.8": {
|
||||
"dependencies": {
|
||||
"AdvancedStringBuilder": "0.1.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/WebMarkupMin.Core.dll": {
|
||||
"assemblyVersion": "2.13.8.0",
|
||||
"fileVersion": "2.13.8.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DiscordChatExporter.Core/2.39.1": {
|
||||
"dependencies": {
|
||||
"AsyncKeyedLock": "6.2.0",
|
||||
"Gress": "2.0.1",
|
||||
"JsonExtensions": "1.2.0",
|
||||
"Polly": "7.2.3",
|
||||
"RazorBlade": "0.4.2",
|
||||
"Superpower": "3.0.0",
|
||||
"WebMarkupMin.Core": "2.13.8"
|
||||
},
|
||||
"runtime": {
|
||||
"DiscordChatExporter.Core.dll": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"DiscordChatExporter.Cli/2.39.1": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"AdvancedStringBuilder/0.1.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-IbN3r5whlJvi8MhCDPVpIb+NVScyUcKSdcJZrnoXFDyzPDISl3AbWouNBYIHRdZdfGuzqCQEhM1vkxbIKqQVaQ==",
|
||||
"path": "advancedstringbuilder/0.1.0",
|
||||
"hashPath": "advancedstringbuilder.0.1.0.nupkg.sha512"
|
||||
},
|
||||
"AsyncKeyedLock/6.2.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-FJqEME0eyM1EHVymnG32vmqKEFZ9X7/LX0NOuHyAeQqpncJFt+ODvzfx0SAlmF6m5NtL6xyPfvt9uTckbSWLhQ==",
|
||||
"path": "asynckeyedlock/6.2.0",
|
||||
"hashPath": "asynckeyedlock.6.2.0.nupkg.sha512"
|
||||
},
|
||||
"CliFx/2.3.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-erOn8SLCHt3p+pj8nIKmzqDyXV6hwQr1wHmyVuFujnLJRKP1ovuswPBNKUNXv9Le7/HhNawln/Upc5v6Nhn3zA==",
|
||||
"path": "clifx/2.3.1",
|
||||
"hashPath": "clifx.2.3.1.nupkg.sha512"
|
||||
},
|
||||
"DotnetRuntimeBootstrapper/2.4.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-CuNwd8O1trpAaPlhcP4ourZH4onf6FqBDWQzzmKqqgF3TZCKkFuL5xDZNvbWWdDQI2dx3z/XBRxwBQghVKSD7Q==",
|
||||
"path": "dotnetruntimebootstrapper/2.4.0",
|
||||
"hashPath": "dotnetruntimebootstrapper.2.4.0.nupkg.sha512"
|
||||
},
|
||||
"FuckRussia/1.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-mdo3UfOIrRfi05m6qN+rJt3yKkM5Bq9hC3b/NYe5c0orhF6TGsIoJBo+OqX6P2LLouSeFNE01UjR9bbvXbT9+A==",
|
||||
"path": "fuckrussia/1.0.1",
|
||||
"hashPath": "fuckrussia.1.0.1.nupkg.sha512"
|
||||
},
|
||||
"Gress/2.0.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-Ky68Wbb3WUkFw5g92tcTRNf5IVMV5AyLB8+uw4pCpXmfS2gkIzWV9BnTGNu+aTaklYqvSZlQL6BnH+9I7HG5tg==",
|
||||
"path": "gress/2.0.1",
|
||||
"hashPath": "gress.2.0.1.nupkg.sha512"
|
||||
},
|
||||
"JsonExtensions/1.2.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ujtrK6m5BQVQLEteLfl54upN7Z59c1ZqEKmU3OlYriqnV74dIgIlNM2vkcgn2AuZEItQDNORD/2H1biI/asOdg==",
|
||||
"path": "jsonextensions/1.2.0",
|
||||
"hashPath": "jsonextensions.1.2.0.nupkg.sha512"
|
||||
},
|
||||
"Polly/7.2.3": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-DeCY0OFbNdNxsjntr1gTXHJ5pKUwYzp04Er2LLeN3g6pWhffsGuKVfMBLe1lw7x76HrPkLxKEFxBlpRxS2nDEQ==",
|
||||
"path": "polly/7.2.3",
|
||||
"hashPath": "polly.7.2.3.nupkg.sha512"
|
||||
},
|
||||
"RazorBlade/0.4.2": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-uLNIoO35t+gOEWT7EdofyN0tFsbrntoHX5a19CgjwheDhrDSgGY3ubF9zsp4hQnkGhBLAQaQ4K2yyxDHbuC3GQ==",
|
||||
"path": "razorblade/0.4.2",
|
||||
"hashPath": "razorblade.0.4.2.nupkg.sha512"
|
||||
},
|
||||
"Spectre.Console/0.46.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-qd2OMEGxfQW1KLuQj56KKHkIK6eB/IUF/AET5CRl/efROHGsvBehx9shfkL0HgJEHLCwRiR7foWi4/LkdPk18g==",
|
||||
"path": "spectre.console/0.46.0",
|
||||
"hashPath": "spectre.console.0.46.0.nupkg.sha512"
|
||||
},
|
||||
"Superpower/3.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-bjKbAYWePooCAvPxQq+3KnmcLfRggMyRoXmtBMlmCG71bdwBHrO6rmRJ2DRIodg5aztNcxeZXBUVWT+H+MZUhw==",
|
||||
"path": "superpower/3.0.0",
|
||||
"hashPath": "superpower.3.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Memory/4.5.5": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==",
|
||||
"path": "system.memory/4.5.5",
|
||||
"hashPath": "system.memory.4.5.5.nupkg.sha512"
|
||||
},
|
||||
"WebMarkupMin.Core/2.13.8": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-dXAyg/mMmkOBGSzhjOv5dJIvT+u8mBhEPG+QGp+UW4et/lGucSas055tb1793UT+gV5BOAp+v0FqufLyC7Urjw==",
|
||||
"path": "webmarkupmin.core/2.13.8",
|
||||
"hashPath": "webmarkupmin.core.2.13.8.nupkg.sha512"
|
||||
},
|
||||
"DiscordChatExporter.Core/2.39.1": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
BIN
exportchannels/data/DiscordChatExporter.Cli.dll
Normal file
BIN
exportchannels/data/DiscordChatExporter.Cli.dll
Normal file
Binary file not shown.
BIN
exportchannels/data/DiscordChatExporter.Cli.exe
Normal file
BIN
exportchannels/data/DiscordChatExporter.Cli.exe
Normal file
Binary file not shown.
9
exportchannels/data/DiscordChatExporter.Cli.exe.config
Normal file
9
exportchannels/data/DiscordChatExporter.Cli.exe.config
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This configuration file is required by the apphost which runs on legacy .NET Framework for compatibility reasons -->
|
||||
<configuration>
|
||||
<!-- Prefer .NET 3.5 (preinstalled on Windows 7), rollover to .NET 4.x (preinstalled on Windows 8+) -->
|
||||
<startup useLegacyV2RuntimeActivationPolicy="true">
|
||||
<supportedRuntime version="v2.0.50727" />
|
||||
<supportedRuntime version="v4.0" />
|
||||
</startup>
|
||||
</configuration>
|
BIN
exportchannels/data/DiscordChatExporter.Cli.pdb
Normal file
BIN
exportchannels/data/DiscordChatExporter.Cli.pdb
Normal file
Binary file not shown.
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net7.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "7.0.0"
|
||||
},
|
||||
"configProperties": {
|
||||
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false
|
||||
}
|
||||
}
|
||||
}
|
BIN
exportchannels/data/DiscordChatExporter.Core.dll
Normal file
BIN
exportchannels/data/DiscordChatExporter.Core.dll
Normal file
Binary file not shown.
BIN
exportchannels/data/DiscordChatExporter.Core.pdb
Normal file
BIN
exportchannels/data/DiscordChatExporter.Core.pdb
Normal file
Binary file not shown.
BIN
exportchannels/data/Gress.dll
Normal file
BIN
exportchannels/data/Gress.dll
Normal file
Binary file not shown.
BIN
exportchannels/data/JsonExtensions.dll
Normal file
BIN
exportchannels/data/JsonExtensions.dll
Normal file
Binary file not shown.
BIN
exportchannels/data/Polly.dll
Normal file
BIN
exportchannels/data/Polly.dll
Normal file
Binary file not shown.
2
exportchannels/data/README.txt
Normal file
2
exportchannels/data/README.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
This bundled version of Discord Chat Exporter can be found here: https://github.com/Tyrrrz/DiscordChatExporter/releases/tag/2.39.1
|
||||
I DID NOT MAKE THIS PROGRAM. This program is developed by Tyrrrz, NOT me.
|
BIN
exportchannels/data/RazorBlade.dll
Normal file
BIN
exportchannels/data/RazorBlade.dll
Normal file
Binary file not shown.
BIN
exportchannels/data/Spectre.Console.dll
Normal file
BIN
exportchannels/data/Spectre.Console.dll
Normal file
Binary file not shown.
BIN
exportchannels/data/Superpower.dll
Normal file
BIN
exportchannels/data/Superpower.dll
Normal file
Binary file not shown.
BIN
exportchannels/data/WebMarkupMin.Core.dll
Normal file
BIN
exportchannels/data/WebMarkupMin.Core.dll
Normal file
Binary file not shown.
88
exportchannels/exportchannels.py
Normal file
88
exportchannels/exportchannels.py
Normal file
|
@ -0,0 +1,88 @@
|
|||
import discord
|
||||
import subprocess
|
||||
import os
|
||||
from redbot.core import Config, checks, commands, bot, data_manager
|
||||
|
||||
class ExportChannels(commands.Cog):
|
||||
"""Custom cog to export channels to Json and HTML formats using Discord Chat Exporter.
|
||||
Developed by SeaswimmerTheFsh and yname."""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.config = Config.get_conf(self, identifier=48258471944753312)
|
||||
self.config.register_global(
|
||||
bot_token = "0"
|
||||
)
|
||||
|
||||
|
||||
def export(self, ctx, channel, token):
|
||||
self.data_path = data_manager.cog_data_path(self)
|
||||
self.bundled_data_path = data_manager.bundled_data_path(self)
|
||||
out = f'{self.data_path}/Exported Channels'
|
||||
try:
|
||||
os.mkdir(out)
|
||||
except FileExistsError:
|
||||
pass
|
||||
args = [
|
||||
'dotnet',
|
||||
'DiscordChatExporter.Cli.dll',
|
||||
'export',
|
||||
'--format', 'HtmlDark',
|
||||
'--output', f'/{out}/%G (%g)/%C (%c)/Export.html',
|
||||
'--token', f'{token}',
|
||||
'--channel', {channel},
|
||||
'--media',
|
||||
'--fuck_russia', 'true',
|
||||
]
|
||||
if bot:
|
||||
args += '--bot'
|
||||
os.chdir(self.bundled_data_path)
|
||||
subprocess.call(args)
|
||||
args = [
|
||||
'dotnet',
|
||||
'DiscordChatExporter.Cli.dll',
|
||||
'export',
|
||||
'--format', 'Json',
|
||||
'--output', f'/{out}/%G (%g)/%C (%c)/DCE-f.json',
|
||||
'--token', f'{token}',
|
||||
'--channel', {channel},
|
||||
'--reuse_media',
|
||||
'--media',
|
||||
'--fuck_russia', 'true',
|
||||
]
|
||||
if bot:
|
||||
args += '--bot'
|
||||
os.chdir(self.bundled_data_path)
|
||||
subprocess.call(args)
|
||||
|
||||
@commands.group()
|
||||
@checks.is_owner()
|
||||
async def exportset(self, ctx):
|
||||
"""Configuration options for the ExportChannels cog."""
|
||||
|
||||
@exportset.command()
|
||||
@checks.is_owner()
|
||||
async def token(self, ctx, token: str):
|
||||
"""Sets the bot token used for Discord Chat Exporter."""
|
||||
await self.config.bot_token.set({token})
|
||||
await ctx.send(content="Token set!")
|
||||
await ctx.delete()
|
||||
|
||||
@exportset.command()
|
||||
@checks.is_owner()
|
||||
async def checkoutputpath(self, ctx):
|
||||
"""Checks what file path DCE is outputting to."""
|
||||
self.data_path = data_manager.cog_data_path(self)
|
||||
await ctx.send(content=f"{self.data_path}")
|
||||
|
||||
@commands.command()
|
||||
@commands.admin()
|
||||
async def exportchannel(self, ctx, channel: discord.Channel):
|
||||
"""Exports a channel using Discord Chat Exporter."""
|
||||
token = await self.config.bot_token
|
||||
dce_install = data_manager.bundled_data_path(self)
|
||||
if token == 0:
|
||||
await ctx.send(content="Please set your token with the ``exportset token`` command!")
|
||||
return
|
||||
else:
|
||||
await self.export(channel.id, token)
|
Loading…
Reference in a new issue