diff --git a/code/cogs/chat.py b/code/cogs/chat.py index 502e026..c3b31ea 100644 --- a/code/cogs/chat.py +++ b/code/cogs/chat.py @@ -1,6 +1,9 @@ import discord from discord.ext import commands -from config import debug, curs_data, max_uses, curs_premium, con_data, con_premium, webhook_url +from config import ( + debug, + webhook_url, +) import makeprompt as mp import aiohttp @@ -9,8 +12,7 @@ class MyModal(discord.ui.Modal): def __init__(self, message): super().__init__(title="Downvote") self.add_item( - discord.ui.InputText( - label="Reason", style=discord.InputTextStyle.long) + discord.ui.InputText(label="Reason", style=discord.InputTextStyle.long) ) self.message = message @@ -32,15 +34,12 @@ class MyModal(discord.ui.Modal): color=discord.Color.og_blurple(), ) - embed.add_field( - name="Reason", value=self.children[0].value, inline=True) - embed.add_field( - name="Author", value=interaction.user.mention, inline=True) + embed.add_field(name="Reason", value=self.children[0].value, inline=True) + embed.add_field(name="Author", value=interaction.user.mention, inline=True) embed.add_field( name="Channel", value=self.message.channel.name, inline=True ) - embed.add_field( - name="Guild", value=self.message.guild.name, inline=True) + embed.add_field(name="Guild", value=self.message.guild.name, inline=True) history = await self.message.channel.history( limit=5, before=self.message @@ -75,9 +74,11 @@ class MyModal(discord.ui.Modal): uname = fake_users[users.index(self.message.author)] embed.add_field( name=f"{uname} said", - value="*" + self.message.content[:1021] + "*" if len( - self.message.content) > 1021 else "*" + self.message.content + "*", # [:1021] if len(self.message.content) > 1021, - # means that if the message is longer than 1021 characters, it will be cut at 1021 characters + value="*" + self.message.content[:1021] + "*" + if len(self.message.content) > 1021 + else "*" + + self.message.content + + "*", # [:1021] if len(self.message.content) > 1021, inline=False, ) await webhook.send(embed=embed) diff --git a/code/cogs/manage_chat.py b/code/cogs/manage_chat.py index 824950a..19b365b 100644 --- a/code/cogs/manage_chat.py +++ b/code/cogs/manage_chat.py @@ -17,8 +17,7 @@ class ManageChat(discord.Cog): f"The user {ctx.author} ran the cancel command in the channel {ctx.channel} of the guild {ctx.guild}, named {ctx.guild.name}" ) # check if the guild is in the database - curs_data.execute( - "SELECT * FROM data WHERE guild_id = ?", (ctx.guild.id,)) + curs_data.execute("SELECT * FROM data WHERE guild_id = ?", (ctx.guild.id,)) if curs_data.fetchone() is None: await ctx.respond( "This server is not setup, please run /setup", ephemeral=True @@ -98,24 +97,12 @@ class ManageChat(discord.Cog): # TODO: rework so as to give the choice of a private send or a public send if channel_send is None: await ctx.respond( - file=discord.File( - new_file_name - ), + file=discord.File(new_file_name), ephemeral=True, ) else: - await channel_send.send( - file=discord.File( - new_file_name - ) - ) + await channel_send.send(file=discord.File(new_file_name)) await ctx.respond("Transcript sent!", ephemeral=True, delete_after=5) - await ctx.author.send( - file=discord.File( - new_file_name - ) - ) + await ctx.author.send(file=discord.File(new_file_name)) # delete the file - os.remove( - new_file_name - ) + os.remove(new_file_name)