如何计算每个用户的一个频道中的消息数? [英] How can I count the number of messages in one channel of each user?

查看:20
本文介绍了如何计算每个用户的一个频道中的消息数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 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.

这篇关于如何计算每个用户的一个频道中的消息数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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