Ballsdex-Team / BallsDex-DiscordBot

Collect and exchange countryballs on Discord
Other
85 stars 142 forks source link

Bot Crashing on Message event #293

Closed MrTwixxy closed 3 months ago

MrTwixxy commented 3 months ago

Hey!

I tried running the bot (in Docker) but I can't quite get it to work. I have some experience with discord.js but not really with discord.py. The bot starts without any problems, however, as soon as a message event is received the bot crashes. I enabled all 3 intents in the developer portal.

Im not quite wure what's causing it. Is it possibke that i have the wrong version of something?

Docker Logs:

2024-06-25 12:45:07 2024-06-25 10:45:07 INFO     ballsdex.core.bot Synced 1 admin commands for guild 1182615554897477682.
2024-06-25 12:45:17 2024-06-25 10:45:17 CRITICAL ballsdex Caught unhandled exception in <Task finished name='discord.py: on_message' coro=<Client._run_event() done, defined at /usr/local/lib/python3.11/site-packages/discord/client.py:433> exception=TypeError('sequence item 0: expected str instance, Message found')>:
2024-06-25 12:45:17 Task exception was never retrieved
2024-06-25 12:45:17 Traceback (most recent call last):
2024-06-25 12:45:17   File "/usr/local/lib/python3.11/site-packages/discord/ext/commands/bot.py", line 1299, in get_context
2024-06-25 12:45:17     if origin.content.startswith(tuple(prefix)):
2024-06-25 12:45:17        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-25 12:45:17 TypeError: tuple for startswith must only contain str, not NoneType
2024-06-25 12:45:17 
2024-06-25 12:45:17 During handling of the above exception, another exception occurred:
2024-06-25 12:45:17 
2024-06-25 12:45:17 Traceback (most recent call last):
2024-06-25 12:45:17   File "/usr/local/lib/python3.11/site-packages/discord/client.py", line 441, in _run_event
2024-06-25 12:45:17     await coro(*args, **kwargs)
2024-06-25 12:45:17   File "/usr/local/lib/python3.11/site-packages/discord/ext/commands/bot.py", line 1395, in on_message
2024-06-25 12:45:17     await self.process_commands(message)
2024-06-25 12:45:17   File "/usr/local/lib/python3.11/site-packages/discord/ext/commands/bot.py", line 1390, in process_commands
2024-06-25 12:45:17     ctx = await self.get_context(message)
2024-06-25 12:45:17           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-25 12:45:17   File "/usr/local/lib/python3.11/site-packages/discord/ext/commands/bot.py", line 1313, in get_context
2024-06-25 12:45:17     raise TypeError(
2024-06-25 12:45:17 TypeError: Iterable command_prefix or list returned from get_prefix must contain only strings, not NoneType
2024-06-25 12:45:17 
2024-06-25 12:45:17 During handling of the above exception, another exception occurred:
2024-06-25 12:45:17 
2024-06-25 12:45:17 Traceback (most recent call last):
2024-06-25 12:45:17   File "/usr/local/lib/python3.11/site-packages/discord/client.py", line 446, in _run_event
2024-06-25 12:45:17     await self.on_error(event_name, *args, **kwargs)
2024-06-25 12:45:17   File "/code/ballsdex/core/bot.py", line 467, in on_error
2024-06-25 12:45:17     formatted_args = ", ".join(args)
2024-06-25 12:45:17                      ^^^^^^^^^^^^^^^
2024-06-25 12:45:17 TypeError: sequence item 0: expected str instance, Message found
MaxxMXSZ commented 3 months ago

I am pretty sure your text-prefix in config.yml is set to one of the special character like ! for example, if so it should be enclosed in quotes like this: text-prefix: "!" and not like this: text-prefix: ! Its to make sure that it counts as a part of str content and not as yaml syntax indicator! Let me know if it fixes your problem!

MrTwixxy commented 3 months ago

That was indeed the issue! Thanks for the quick reply!