Compare commits

..

No commits in common. "f72ed78b603b36b3bbcdc12c68038a4b8a465318" and "8c7af61ef775ece597a8766058fffc5ced6bd54b" have entirely different histories.

View file

@ -1,7 +1,7 @@
import discord
import asyncio
import subprocess
import os
from redbot.core import Config, checks, commands, data_manager
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.
@ -21,8 +21,6 @@ class ExportChannels(commands.Cog):
self.bundled_data_path = data_manager.bundled_data_path(self)
out = f'{self.data_path}{os.sep}Exported Channels'
channel = channels[0]
file_location_html = f'{os.sep}{out}{os.sep}%g{os.sep}%c{os.sep}Export.html'
file_location_json = f'{os.sep}{out}{os.sep}%g{os.sep}%c{os.sep}DCE-f.json'
try:
os.mkdir(out)
except FileExistsError:
@ -32,36 +30,28 @@ class ExportChannels(commands.Cog):
'DiscordChatExporter.Cli.dll',
'export',
'--format', 'HtmlDark',
'--output', file_location_html,
'--token', token,
'--channel', channel,
'--output', f'{os.sep}{out}{os.sep}%G (%g){os.sep}%C (%c){os.sep}Export.html',
'--token', f'{token}',
'--channel', {channel},
'--media',
'--fuck_russia', 'true',
]
os.chdir(self.bundled_data_path)
process_1 = await asyncio.create_subprocess_exec(*args)
while True:
return_code_1 = process_1.poll()
if return_code_1 is not None:
break
subprocess.call(args)
args = [
'dotnet',
'DiscordChatExporter.Cli.dll',
'export',
'--format', 'Json',
'--output', file_location_json,
'--token', token,
'--channel', channels,
'--output', f'{os.sep}{out}{os.sep}%G (%g){os.sep}%C (%c){os.sep}DCE-f.json',
'--token', f'{token}',
'--channel', {channels},
'--reuse_media',
'--media',
'--fuck_russia', 'true',
]
os.chdir(self.bundled_data_path)
process_2 = await asyncio.create_subprocess_exec(*args)
while True:
return_code_2 = process_2.poll()
if return_code_2 is not None:
break
subprocess.call(args)
@commands.group()
@checks.is_owner()