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.
这篇关于如何计算每个用户的一个频道中的消息数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何计算每个用户的一个频道中的消息数?
基础教程推荐
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
