diff --git a/src/cogs/moderation.py b/src/cogs/moderation.py index 3cb87a5..62a1d40 100644 --- a/src/cogs/moderation.py +++ b/src/cogs/moderation.py @@ -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" diff --git a/src/config.py b/src/config.py index 911d7aa..c3fd62b 100644 --- a/src/config.py +++ b/src/config.py @@ -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: diff --git a/src/functionscalls.py b/src/functionscalls.py index 89625c5..a86fc11 100644 --- a/src/functionscalls.py +++ b/src/functionscalls.py @@ -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, - -} \ No newline at end of file +} diff --git a/src/makeprompt.py b/src/makeprompt.py index 7f8ed19..a0da3ca 100644 --- a/src/makeprompt.py +++ b/src/makeprompt.py @@ -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: