我正在尝试制作一个机器人,当他们说某些关键字时会将成员重定向到某个频道,但我不希望机器人告诉他们如果他们已经在#commands中就进入#commands。如何让机器人忽略#commands中的所有消息?
如果message.channel.id
等于#commands的id,只需在on_message事件中添加一个检查以返回。
@client.event
async def on_message(message):
#Ignore messages sent in channel with id 1234567890 (#commands channel)
if message.channel.id == 1234567890:
return
#Ignore messages sent by the bot
if message.author == client.user:
return