diff --git a/main.py b/main.py index 20f7740..cf15e38 100644 --- a/main.py +++ b/main.py @@ -20,12 +20,21 @@ bot.add_cog(cogs.Moderation(bot)) async def on_ready(): await bot.change_presence( activity=discord.Activity( - type=discord.ActivityType.watching, name="your messages to answer you" + type=discord.ActivityType.watching, name=f"{len(bot.guilds)} servers" ) ) debug("Bot is ready") +@bot.event +async def on_guild_join(guild): + await bot.change_presence( + activity=discord.Activity( + type=discord.ActivityType.watching, name=f"{len(bot.guilds)} servers" + ) + ) + + @bot.event async def on_application_command_error(ctx, error): debug(error) diff --git a/src/functionscalls.py b/src/functionscalls.py index 0bcde64..7064fd7 100644 --- a/src/functionscalls.py +++ b/src/functionscalls.py @@ -205,10 +205,8 @@ async def send_a_gif( ): query = query.replace(" ", "+") image_url = f"{tenor_api_url}{query}&limit={limit}" - print(image_url) response = await do_async_request(image_url) json = response - print(json) gif_url = random.choice(json["results"])["itemurl"] # type: ignore message = message + "\n" + gif_url await message_in_channel_in_wich_to_send.channel.send(message) diff --git a/src/makeprompt.py b/src/makeprompt.py index 55f81e4..68a2cd5 100644 --- a/src/makeprompt.py +++ b/src/makeprompt.py @@ -169,6 +169,14 @@ async def chatgpt_process( "The function call is empty. Please retry.", delete_after=10 ) else: + content = response.get("content", "") + while len(content) != 0: + if len(content) > 2000: + await message.channel.send(content[:2000]) + content = content[2000:] + else: + await message.channel.send(content) + content = "" await message.channel.send(response["content"]) # type: ignore diff --git a/src/utils/openaicaller.py b/src/utils/openaicaller.py index 9f7855d..57bcb93 100644 --- a/src/utils/openaicaller.py +++ b/src/utils/openaicaller.py @@ -123,7 +123,7 @@ class openai_caller: f"\n\n{bcolors.BOLD}{bcolors.WARNING}APIError. This is not your fault. Retrying...{bcolors.ENDC}" ) await recall_func( - "`An APIError occurred. This is not your fault. Retrying...`" + "`An APIError occurred. This is not your fault, it is OpenAI's fault. We apologize for the inconvenience. Retrying...`" ) await asyncio.sleep(10) await recall_func()