mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 01:06:19 +00:00
🐛 fix(ChatProcess.py): handle exceptions and send error message with logs to the user when an error occurs during message processing
🐛 fix(channelSetup.py): format code to improve readability and adhere to PEP 8 style guide 🐛 fix(makeprompt.py): fix spacing issue in if statement 🐛 fix(openaicaller.py): format code to improve readability and adhere to PEP 8 style guide
This commit is contained in:
@@ -189,8 +189,17 @@ class Chat:
|
|||||||
return
|
return
|
||||||
if await self.postExitCriteria():
|
if await self.postExitCriteria():
|
||||||
return
|
return
|
||||||
|
try:
|
||||||
await self.message.channel.trigger_typing()
|
await self.message.channel.trigger_typing()
|
||||||
await self.formatContext()
|
await self.formatContext()
|
||||||
await self.createThePrompt()
|
await self.createThePrompt()
|
||||||
await self.getResponse()
|
await self.getResponse()
|
||||||
await self.processResponse()
|
await self.processResponse()
|
||||||
|
except Exception as e:
|
||||||
|
await self.message.channel.send(
|
||||||
|
f"""An error occured while processing your message. Please check your settings and try again. If the issue persists, please join uor discord server here: https://discord.gg/pB6hXtUeDv and send the following logs:
|
||||||
|
```
|
||||||
|
{e}
|
||||||
|
```"""
|
||||||
|
)
|
||||||
|
raise e
|
||||||
|
|||||||
@@ -233,7 +233,9 @@ class ChannelSetup(commands.Cog):
|
|||||||
await ctx.respond(f"Set API key for {api} to `secret`.", ephemeral=True)
|
await ctx.respond(f"Set API key for {api} to `secret`.", ephemeral=True)
|
||||||
|
|
||||||
@setup.command(name="premium", description="Set the guild to premium.")
|
@setup.command(name="premium", description="Set the guild to premium.")
|
||||||
async def premium(self, ctx: discord.ApplicationContext, guild_id: str = None, days: int = 180):
|
async def premium(
|
||||||
|
self, ctx: discord.ApplicationContext, guild_id: str = None, days: int = 180
|
||||||
|
):
|
||||||
guild = Guild(guild_id or str(ctx.guild.id))
|
guild = Guild(guild_id or str(ctx.guild.id))
|
||||||
guild.load()
|
guild.load()
|
||||||
if await self.bot.is_owner(ctx.author):
|
if await self.bot.is_owner(ctx.author):
|
||||||
|
|||||||
Reference in New Issue
Block a user