使用discord.py,我将如何检查用户在特定频道中发送了多少消息 [英] Using discord.py, how would i check how much messages a user has sent in a specific channel

查看:53
本文介绍了使用discord.py,我将如何检查用户在特定频道中发送了多少消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用discord.py,我将如何检查用户在特定频道中发送了多少条消息,然后例如每周一次,该漫游器都会发送一条消息,说明用户已发送了多少条消息例如,如果我一周内在"#test"中发送了30条消息,当一周结束时它将发送"@用户已发送:#test中的30条消息".

Using discord.py, how would i check how much messages a user has sent in a specific channel, and then for example every week, the bot will send a message for how much messages a user has sent for example, if i sent 30 messages in "#test" in a week, when the week ends it will send "@User has sent: 30 messages in #test".

我不确定该怎么做.

我所设置的只是我的机器人:

All I have setup is my bot with:

@client.event
async def on_message(message):

没有错误

推荐答案

查看discord.py 文档.

Look at the discord.py documentation.

您可以使用:

counter = 0
async for message in channel.history():
    if message.author == client.user:
        counter += 1

或类似的东西.更多详细信息在文档中.

or something similar. More details are in the documentation.

这篇关于使用discord.py,我将如何检查用户在特定频道中发送了多少消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆