Closed saikido closed 8 months ago
Was it up and running and then you got this error when you messaged it or before?
Yes. I got them when I messaged my bot.
What did you message it? Was it on any message you sent or were you giving an image file? This is a pretty basic bot it does not have any try catches if you overload the buffer or give Gemini too much data.
Hi, I got a response when I messaged "test" to the bot. However, I got the following error messages when I messaged to the bot in Japanese language.
Traceback (most recent call last): File "/home/myserver/.local/share/virtualenvs/Discord-yizLEkiQ/lib/python3.11/site-packages/discord/client.py", line 441, in _run_event await coro(*args, **kwargs) File "/home/myserver/Python/./GeminiDiscordBot/GeminiDiscordBot.py", line 101, in on_message response_text = await generate_response_with_text(get_formatted_message_history(message.author.id)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/myserver/Python/./GeminiDiscordBot/GeminiDiscordBot.py", line 115, in generate_response_with_text return response.text ^^^^^^^^^^^^^ File "/home/myserver/.local/share/virtualenvs/Discord-yizLEkiQ/lib/python3.11/site-packages/google/generativeai/types/generation_types.py", line 313, in text if len(parts) > 1 or "text" not in parts[0]:
File "/home/myserver/.local/share/virtualenvs/Discord-yizLEkiQ/lib/python3.11/site-packages/proto/marshal/collections/repeated.py", line 125, in __getitem__
return self._marshal.to_python(self._pb_type, self.pb[key])
~~~~~~~^^^^^
IndexError: list index out of range
I realized that I get those error messages only when I messaged as a non-server-admin account. I get responses when I message as a server admin account.
Sorry I have absolutely no idea. I speak to it in English only. I sent it some Japanese and it responded back (Google translate so I have no idea if it's right) you might need to upgrade your python packages. Also could be a problem with intents and it not having access to author
Hi,
I got the following error messages when I ran your Python file on my Discord server.
2023-12-16 10:10:18 ERROR discord.client Ignoring exception in on_message Traceback (most recent call last): File "/home/myserver/.local/share/virtualenvs/GeminiDiscordBot-ajOOcKdj/lib/python3.12/site-packages/discord/client.py", line 441, in _run_event await coro(*args, **kwargs) File "/home/myserver/Python/GeminiDiscordBot/GeminiDiscordBot.py", line 61, in on_message async with message.channel.typing(): File "/home/myserver/.local/share/virtualenvs/GeminiDiscordBot-ajOOcKdj/lib/python3.12/site-packages/discord/context_managers.py", line 82, in aenter await channel._state.http.send_typing(channel.id) File "/home/myserver/.local/share/virtualenvs/GeminiDiscordBot-ajOOcKdj/lib/python3.12/site-packages/discord/http.py", line 739, in request raise Forbidden(response, data)
Would you tell me how to fix it?
Thank you