mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 09:16:19 +00:00
🎨 chore(*): run black to format the code
This commit is contained in:
@@ -11,6 +11,7 @@ class Moderation(discord.Cog):
|
||||
def __init__(self, bot: discord.Bot) -> None:
|
||||
super().__init__()
|
||||
self.bot = bot
|
||||
|
||||
"""
|
||||
@discord.slash_command(
|
||||
name="ban", description="Ban a user from using the bot"
|
||||
|
||||
@@ -102,7 +102,9 @@ curs_premium.execute(
|
||||
)
|
||||
|
||||
with open(
|
||||
os.path.abspath(os.path.join(os.path.dirname(__file__), "./prompts/gpt-3.5-turbo.txt")),
|
||||
os.path.abspath(
|
||||
os.path.join(os.path.dirname(__file__), "./prompts/gpt-3.5-turbo.txt")
|
||||
),
|
||||
"r",
|
||||
encoding="utf-8",
|
||||
) as file:
|
||||
|
||||
@@ -149,9 +149,11 @@ font_matches = {
|
||||
|
||||
unsplash_random_image_url = "https://source.unsplash.com/random"
|
||||
|
||||
|
||||
class FuntionCallError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
async def get_final_url(url):
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.head(url, allow_redirects=True) as response:
|
||||
@@ -171,7 +173,7 @@ async def do_async_request(url, json=True):
|
||||
|
||||
async def add_reaction_to_last_message(
|
||||
message_to_react_to: discord.Message, arguments: dict
|
||||
):
|
||||
):
|
||||
emoji = arguments.get("emoji", "")
|
||||
if emoji == "":
|
||||
raise FuntionCallError("No emoji provided")
|
||||
@@ -204,9 +206,7 @@ async def send_a_stock_image(
|
||||
await message_in_channel_in_wich_to_send.channel.send(message)
|
||||
|
||||
|
||||
async def create_a_thread(
|
||||
called_by: discord.Message, arguments: dict
|
||||
):
|
||||
async def create_a_thread(called_by: discord.Message, arguments: dict):
|
||||
name = arguments.get("name", "")
|
||||
if name == "":
|
||||
raise FuntionCallError("No name provided")
|
||||
@@ -247,7 +247,7 @@ async def send_ascii_art_text(
|
||||
message = arguments.get("message", "")
|
||||
if font not in font_matches:
|
||||
raise FuntionCallError("Invalid font")
|
||||
|
||||
|
||||
font = font_matches[font]
|
||||
text = text.replace(" ", "+")
|
||||
asciiiar_url = (
|
||||
@@ -298,6 +298,7 @@ async def send_ascii_art_image(
|
||||
message = f"```\n{combo}```\n{message}"
|
||||
await message_in_channel_in_wich_to_send.channel.send(message)
|
||||
|
||||
|
||||
functions_matching = {
|
||||
"add_reaction_to_last_message": add_reaction_to_last_message,
|
||||
"reply_to_last_message": reply_to_last_message,
|
||||
@@ -306,5 +307,4 @@ functions_matching = {
|
||||
"send_ascii_art_text": send_ascii_art_text,
|
||||
"send_ascii_art_image": send_ascii_art_image,
|
||||
"create_a_thread": create_a_thread,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,9 +45,7 @@ async def fetch_messages_history(channel: discord.TextChannel, limit, original_m
|
||||
if len(messages) == limit:
|
||||
break
|
||||
else:
|
||||
async for msg in channel.history(
|
||||
limit=100, before=original_message
|
||||
):
|
||||
async for msg in channel.history(limit=100, before=original_message):
|
||||
if not is_ignorable(msg.content):
|
||||
messages.append(msg)
|
||||
if len(messages) == limit:
|
||||
|
||||
Reference in New Issue
Block a user