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.
这篇关于如何计算每个用户的一个频道中的消息数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何计算每个用户的一个频道中的消息数?


基础教程推荐
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01
- 自定义 XMLHttpRequest.prototype.open 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- 直接将值设置为滑块 2022-01-01
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01