Compare commits

..

No commits in common. "eddf871203eadd40cd57240fa27cdbc510545174" and "d38535a35edeb2d37f5715985dea32f001891119" have entirely different histories.

View file

@ -11,16 +11,14 @@ class ExportChannels(commands.Cog):
self.bot = bot
self.config = Config.get_conf(self, identifier=48258471944753312)
self.config.register_global(
bot_token = None
bot_token = "0"
)
async def export(self, channels: list):
token = await self.config.bot_token()
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}{os.sep}Exported Channels'
channel = channels[0]
out = f'{self.data_path}/Exported Channels'
try:
os.mkdir(out)
except FileExistsError:
@ -36,6 +34,8 @@ class ExportChannels(commands.Cog):
'--media',
'--fuck_russia', 'true',
]
if bot:
args += '--bot'
os.chdir(self.bundled_data_path)
subprocess.call(args)
args = [
@ -45,11 +45,13 @@ class ExportChannels(commands.Cog):
'--format', 'Json',
'--output', f'/{out}/%G (%g)/%C (%c)/DCE-f.json',
'--token', f'{token}',
'--channel', {channels},
'--channel', {channel},
'--reuse_media',
'--media',
'--fuck_russia', 'true',
]
if bot:
args += '--bot'
os.chdir(self.bundled_data_path)
subprocess.call(args)
@ -65,7 +67,7 @@ class ExportChannels(commands.Cog):
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):
@ -75,14 +77,12 @@ class ExportChannels(commands.Cog):
@commands.command()
@commands.admin()
async def exportchannel(self, ctx, channel: discord.TextChannel):
async def exportchannel(self, ctx, channel: discord.Channel):
"""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 is None:
await ctx.send(content=f"Please set your token with the ``{ctx.prefix}exportset token`` command!")
if token == 0:
await ctx.send(content="Please set your token with the ``exportset token`` command!")
return
else:
id_list = [thread.id for thread in channel.threads]
id_list.insert(0, channel.id)
await self.export(id_list)
await self.export(channel.id, token)