本文介紹了如何計算每個用戶的一個頻道中的消息數?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我想用 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.
這篇關于如何計算每個用戶的一個頻道中的消息數?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!