Compare commits
4 commits
d38535a35e
...
eddf871203
Author | SHA1 | Date | |
---|---|---|---|
eddf871203 | |||
ff8bf341c4 | |||
7054a3e181 | |||
84b11bf28b |
1 changed files with 14 additions and 14 deletions
|
@ -11,14 +11,16 @@ class ExportChannels(commands.Cog):
|
|||
self.bot = bot
|
||||
self.config = Config.get_conf(self, identifier=48258471944753312)
|
||||
self.config.register_global(
|
||||
bot_token = "0"
|
||||
bot_token = None
|
||||
)
|
||||
|
||||
|
||||
def export(self, ctx, channel, token):
|
||||
async def export(self, channels: list):
|
||||
token = await self.config.bot_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'
|
||||
out = f'{self.data_path}{os.sep}Exported Channels'
|
||||
channel = channels[0]
|
||||
try:
|
||||
os.mkdir(out)
|
||||
except FileExistsError:
|
||||
|
@ -34,8 +36,6 @@ class ExportChannels(commands.Cog):
|
|||
'--media',
|
||||
'--fuck_russia', 'true',
|
||||
]
|
||||
if bot:
|
||||
args += '--bot'
|
||||
os.chdir(self.bundled_data_path)
|
||||
subprocess.call(args)
|
||||
args = [
|
||||
|
@ -45,13 +45,11 @@ class ExportChannels(commands.Cog):
|
|||
'--format', 'Json',
|
||||
'--output', f'/{out}/%G (%g)/%C (%c)/DCE-f.json',
|
||||
'--token', f'{token}',
|
||||
'--channel', {channel},
|
||||
'--channel', {channels},
|
||||
'--reuse_media',
|
||||
'--media',
|
||||
'--fuck_russia', 'true',
|
||||
]
|
||||
if bot:
|
||||
args += '--bot'
|
||||
os.chdir(self.bundled_data_path)
|
||||
subprocess.call(args)
|
||||
|
||||
|
@ -77,12 +75,14 @@ class ExportChannels(commands.Cog):
|
|||
|
||||
@commands.command()
|
||||
@commands.admin()
|
||||
async def exportchannel(self, ctx, channel: discord.Channel):
|
||||
async def exportchannel(self, ctx, channel: discord.TextChannel):
|
||||
"""Exports a channel using Discord Chat Exporter."""
|
||||
token = await self.config.bot_token
|
||||
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!")
|
||||
if token is None:
|
||||
await ctx.send(content=f"Please set your token with the ``{ctx.prefix}exportset token`` command!")
|
||||
return
|
||||
else:
|
||||
await self.export(channel.id, token)
|
||||
id_list = [thread.id for thread in channel.threads]
|
||||
id_list.insert(0, channel.id)
|
||||
await self.export(id_list)
|
||||
|
|
Loading…
Add table
Reference in a new issue