style(chat.py, manage_chat.py): format code with black

This commit only reformats the code with the black code formatter.
This commit is contained in:
Paillat
2023-04-08 20:06:53 +02:00
parent 048905d682
commit f8907667e0
2 changed files with 18 additions and 30 deletions

View File

@@ -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)

View File

@@ -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)