首页 > 解决方案 > Discord.py 如何判断玩家是否发送了任何类型的消息

问题描述

我想做一个 exp 系统,为此,我需要查看用户是否发送任何消息,那么,我将如何在 discord.py 中检查呢?

标签: python-3.xdiscord.py

解决方案


根据文档,您可以执行以下操作:

@client.event
async def on_message(msg):
    print("{} user has sent a message in {}".format(msg.author.name,msg.channel.name))
    #whatever you want to do with the XP system

推荐阅读