【问题标题】:Discord.py how to tell if a player has sent a message, of any typeDiscord.py 如何判断玩家是否发送了任何类型的消息
【发布时间】:2018-06-13 23:54:17
【问题描述】:

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

【问题讨论】:

  • discord.py 应该使用 magic.c
  • 您能否对您的要求更清楚一点?每当成员发送消息时,您是否正在做某事,或者您是否正在查看该人是否发送了消息?

标签: python-3.x discord.py


【解决方案1】:

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

@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

【讨论】:

    猜你喜欢
    • 2011-12-31
    • 2020-10-30
    • 1970-01-01
    • 2015-12-09
    • 2021-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多