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