mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 01:06:19 +00:00
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:
@@ -1,6 +1,9 @@
|
|||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
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 makeprompt as mp
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
@@ -9,8 +12,7 @@ class MyModal(discord.ui.Modal):
|
|||||||
def __init__(self, message):
|
def __init__(self, message):
|
||||||
super().__init__(title="Downvote")
|
super().__init__(title="Downvote")
|
||||||
self.add_item(
|
self.add_item(
|
||||||
discord.ui.InputText(
|
discord.ui.InputText(label="Reason", style=discord.InputTextStyle.long)
|
||||||
label="Reason", style=discord.InputTextStyle.long)
|
|
||||||
)
|
)
|
||||||
self.message = message
|
self.message = message
|
||||||
|
|
||||||
@@ -32,15 +34,12 @@ class MyModal(discord.ui.Modal):
|
|||||||
color=discord.Color.og_blurple(),
|
color=discord.Color.og_blurple(),
|
||||||
)
|
)
|
||||||
|
|
||||||
embed.add_field(
|
embed.add_field(name="Reason", value=self.children[0].value, inline=True)
|
||||||
name="Reason", value=self.children[0].value, inline=True)
|
embed.add_field(name="Author", value=interaction.user.mention, inline=True)
|
||||||
embed.add_field(
|
|
||||||
name="Author", value=interaction.user.mention, inline=True)
|
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name="Channel", value=self.message.channel.name, inline=True
|
name="Channel", value=self.message.channel.name, inline=True
|
||||||
)
|
)
|
||||||
embed.add_field(
|
embed.add_field(name="Guild", value=self.message.guild.name, inline=True)
|
||||||
name="Guild", value=self.message.guild.name, inline=True)
|
|
||||||
|
|
||||||
history = await self.message.channel.history(
|
history = await self.message.channel.history(
|
||||||
limit=5, before=self.message
|
limit=5, before=self.message
|
||||||
@@ -75,9 +74,11 @@ class MyModal(discord.ui.Modal):
|
|||||||
uname = fake_users[users.index(self.message.author)]
|
uname = fake_users[users.index(self.message.author)]
|
||||||
embed.add_field(
|
embed.add_field(
|
||||||
name=f"{uname} said",
|
name=f"{uname} said",
|
||||||
value="*" + self.message.content[:1021] + "*" if len(
|
value="*" + self.message.content[:1021] + "*"
|
||||||
self.message.content) > 1021 else "*" + self.message.content + "*", # [:1021] if len(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
|
else "*"
|
||||||
|
+ self.message.content
|
||||||
|
+ "*", # [:1021] if len(self.message.content) > 1021,
|
||||||
inline=False,
|
inline=False,
|
||||||
)
|
)
|
||||||
await webhook.send(embed=embed)
|
await webhook.send(embed=embed)
|
||||||
|
|||||||
@@ -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}"
|
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
|
# check if the guild is in the database
|
||||||
curs_data.execute(
|
curs_data.execute("SELECT * FROM data WHERE guild_id = ?", (ctx.guild.id,))
|
||||||
"SELECT * FROM data WHERE guild_id = ?", (ctx.guild.id,))
|
|
||||||
if curs_data.fetchone() is None:
|
if curs_data.fetchone() is None:
|
||||||
await ctx.respond(
|
await ctx.respond(
|
||||||
"This server is not setup, please run /setup", ephemeral=True
|
"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
|
# TODO: rework so as to give the choice of a private send or a public send
|
||||||
if channel_send is None:
|
if channel_send is None:
|
||||||
await ctx.respond(
|
await ctx.respond(
|
||||||
file=discord.File(
|
file=discord.File(new_file_name),
|
||||||
new_file_name
|
|
||||||
),
|
|
||||||
ephemeral=True,
|
ephemeral=True,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
await channel_send.send(
|
await channel_send.send(file=discord.File(new_file_name))
|
||||||
file=discord.File(
|
|
||||||
new_file_name
|
|
||||||
)
|
|
||||||
)
|
|
||||||
await ctx.respond("Transcript sent!", ephemeral=True, delete_after=5)
|
await ctx.respond("Transcript sent!", ephemeral=True, delete_after=5)
|
||||||
await ctx.author.send(
|
await ctx.author.send(file=discord.File(new_file_name))
|
||||||
file=discord.File(
|
|
||||||
new_file_name
|
|
||||||
)
|
|
||||||
)
|
|
||||||
# delete the file
|
# delete the file
|
||||||
os.remove(
|
os.remove(new_file_name)
|
||||||
new_file_name
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user