How can I count the number of messages in one channel of each user?(如何计算每个用户的一个频道中的消息数?)
问题描述
我想用 discord.js 编写一个不和谐的机器人......但是在文档中,我没有找到一个函数来计算每个用户的频道中的消息数量......有没有一个函数可以像用户一样使用带有过滤器的搜索栏?
I want to code a discord bot with the discord.js ... But in the documentation, I don't found a function to count the number of messages in a channel of each user... Is there a function to use the searchbar with filters like an user?
推荐答案
搜索不(尚)可用于 Bots.
The search is not ( yet ) avaible for Bots.
你可以Channel#fetchMessages
但这将是 Api 密集型的.
You could Channel#fetchMessages
but this would be very Api intensive.
最好的方法是获取一个数据库并在用户发送消息时增加它,但这只会在机器人运行时计算消息.
Best way would be to get a database and increment it when the user sends a message, but that will only count messages when the bot is running.
这篇关于如何计算每个用户的一个频道中的消息数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何计算每个用户的一个频道中的消息数?


- Fetch API 如何获取响应体? 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01