ausboss / PygDiscordBot

Discord bot that uses KoboldAI. Supports tavern cards and json files.
63 stars 29 forks source link

/regenerate throws AttributeError: 'Bot' object has no attribute 'name' #10

Closed Kadah closed 1 year ago

Kadah commented 1 year ago

Tested /regenerate, bot cleaned up its messages, then threw this error.

2023-04-08 03:14:25 ERROR    discord.app_commands.tree Ignoring exception in command 'regenerate'
Traceback (most recent call last):
  File "PygDiscordBot/venv/lib/python3.9/site-packages/discord/app_commands/commands.py", line 841, in _do_call
    return await self._callback(self.binding, interaction, **params)  # type: ignore
  File "PygDiscordBot/cogs/pygbot.py", line 196, in regenerate
    if lines[i].startswith(f"{self.bot.name}:"):
AttributeError: 'Bot' object has no attribute 'name'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "PygDiscordBot/venv/lib/python3.9/site-packages/discord/app_commands/tree.py", line 1248, in _call
    await command._invoke_with_namespace(interaction, namespace)
  File "PygDiscordBot/venv/lib/python3.9/site-packages/discord/app_commands/commands.py", line 867, in _invoke_with_namespace
    return await self._do_call(interaction, transformed_values)
  File "PygDiscordBot/venv/lib/python3.9/site-packages/discord/app_commands/commands.py", line 860, in _do_call
    raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'regenerate' raised an exception: AttributeError: 'Bot' object has no attribute 'name'
ausboss commented 1 year ago

I just pushed a fix for that. That was my bad. I had the bot name variables set incorrectly.