The Function:
async def on_command_error(event):
error = event.error # Access the error
if isinstance(error, BadArgument):
await event.ctx.send("There was an error with your input. Please make sure all required options are provided and correctly formatted.", ephemeral=True)```
No visible errors or problems, but whenever a BadArgument is raised:
```<Listener event='command_error' callback=<function Listeners.on_command_error at 0x0000027B6F572200>> is listening to command_error event which contains event data. Add an event argument to this listener to receive the event data object.
Ignoring exception in CommandError():
Traceback (most recent call last):
File "C:\Users\x\AppData\Local\Programs\Python\Python312\Lib\site-packages\interactions\client\client.py", line 630, in _async_wrap
await _coro()
File "C:\Users\x\AppData\Local\Programs\Python\Python312\Lib\site-packages\interactions\models\internal\callback.py", line 31, in __call__
return await self.callback(self._binding, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\x\Documents\UMP Wiki\listeners.py", line 15, in on_command_error
error = event.error # Access the error
^^^^^^^^^^^
AttributeError: 'Listeners' object has no attribute 'error'```
Here are my imports:
import asyncio
import string
import traceback
from interactions import Extension, listen, Embed, Permissions, ChannelType
from interactions.api.events import ChannelCreate, Component, CommandError, MemberAdd, MemberRemove, MessageCreate, MessageUpdate
from interactions.client.errors import BadArgument