fix(exportchannels): pylint fixes
This commit is contained in:
parent
0c31c59017
commit
dbe10c53d1
1 changed files with 9 additions and 11 deletions
|
@ -13,6 +13,7 @@ class ExportChannels(commands.Cog):
|
||||||
self.config.register_global(
|
self.config.register_global(
|
||||||
bot_token = None
|
bot_token = None
|
||||||
)
|
)
|
||||||
|
self.data_path = data_manager.cog_data_path(self)
|
||||||
|
|
||||||
class ConfigException(Exception):
|
class ConfigException(Exception):
|
||||||
pass
|
pass
|
||||||
|
@ -20,7 +21,7 @@ class ExportChannels(commands.Cog):
|
||||||
async def export(self, channels: list):
|
async def export(self, channels: list):
|
||||||
token = await self.config.bot_token()
|
token = await self.config.bot_token()
|
||||||
if token is None:
|
if token is None:
|
||||||
raise(self.ConfigException, "Bot token not set!")
|
raise(self.ConfigException("Bot token not set!"))
|
||||||
data_path = data_manager.cog_data_path(self)
|
data_path = data_manager.cog_data_path(self)
|
||||||
bundled_data_path = data_manager.bundled_data_path(self)
|
bundled_data_path = data_manager.bundled_data_path(self)
|
||||||
out = f'{data_path}{os.sep}Exported Channels'
|
out = f'{data_path}{os.sep}Exported Channels'
|
||||||
|
@ -71,12 +72,12 @@ class ExportChannels(commands.Cog):
|
||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def exportset(self, ctx):
|
async def exportset(self, ctx: commands.Context):
|
||||||
"""Configuration options for the ExportChannels cog."""
|
"""Configuration options for the ExportChannels cog."""
|
||||||
|
|
||||||
@exportset.command()
|
@exportset.command()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def token(self, ctx, token: str):
|
async def token(self, ctx: commands.Context, token: str):
|
||||||
"""Sets the bot token used for Discord Chat Exporter."""
|
"""Sets the bot token used for Discord Chat Exporter."""
|
||||||
await self.config.bot_token.set({token})
|
await self.config.bot_token.set({token})
|
||||||
await ctx.send(content="Token set!")
|
await ctx.send(content="Token set!")
|
||||||
|
@ -84,21 +85,18 @@ class ExportChannels(commands.Cog):
|
||||||
|
|
||||||
@exportset.command()
|
@exportset.command()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def checkoutputpath(self, ctx):
|
async def checkoutputpath(self, ctx: commands.Context):
|
||||||
"""Checks what file path DCE is outputting to."""
|
"""Checks what file path DCE is outputting to."""
|
||||||
self.data_path = data_manager.cog_data_path(self)
|
|
||||||
await ctx.send(content=f"{self.data_path}")
|
await ctx.send(content=f"{self.data_path}")
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.admin()
|
@commands.admin()
|
||||||
async def exportchannel(self, ctx, channel: discord.TextChannel):
|
async def exportchannel(self, ctx: commands.Context, channel: discord.TextChannel):
|
||||||
"""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)
|
|
||||||
if token is None:
|
if token is None:
|
||||||
await ctx.send(content=f"Please set your token with the ``{ctx.prefix}exportset token`` command!")
|
await ctx.send(content=f"Please set your token with the ``{ctx.prefix}exportset token`` command!")
|
||||||
return
|
return
|
||||||
else:
|
id_list = [thread.id for thread in channel.threads]
|
||||||
id_list = [thread.id for thread in channel.threads]
|
id_list.insert(0, channel.id)
|
||||||
id_list.insert(0, channel.id)
|
await self.export(id_list)
|
||||||
await self.export(id_list)
|
|
||||||
|
|
Loading…
Reference in a new issue