misc: simplified export method

This commit is contained in:
Seaswimmer 2023-08-10 22:22:46 -04:00
parent 7054a3e181
commit ff8bf341c4
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -15,10 +15,12 @@ class ExportChannels(commands.Cog):
)
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}{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)