I'm trying to figure out how to write a simple bot for Discord.
However, the problem I'm facing is that for one particular server (or guild as it is called), I don't get any messages.
I am logged in this guild in the webinterface with the same user. And I see messages coming in.
However, in the client I do not see anything being logged.
The code is very simple:
import discord
class DiscordClient(discord.Client):
async def on_ready(self, *args, **kwargs):
print(f"Connected as {self.user.display_name} to:")
for guild in self.guilds:
print(f"- {guild.name}")
async def on_message(self, message):
print(f"Message from '{message.guild.name}'")
DiscordClient().run(TOKEN, bot=False)
In the on_ready
, I can see it knows the guild and even the channels. So that's fine. There is a connection...
The server is the "Among Us" server which has 500k users. So maybe it's a limitation because too much users? As the on_message
does trigger correctly for servers with much more limited amount of users (like 20k or so).
What setting should I adjust to connect to this server in order to receive the messages?
Thanks!
question from:
https://stackoverflow.com/questions/65834216/in-discord-py-the-on-message-does-not-trigger-for-one-guild 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…