javascript - The number of times users have used commands
问题描述
I need a script that will count how much the community has used all the bot commands in discord.js. One that will count from 1 to infinity.
I have such a script, and I don't know what to add to it so that the counter appears.
if (commandfile) {
commandfile.run(client, message, args);
console.log("Today, users have written some commands there.");
}
Please help me.
I use a translator because I don't speak English well. Excuse me.
解决方案
You could use a database, specifically quick.db
const db = require("quick.db");
if (commandfile) {
commandfile.run(client, message, args);
db.add(`commandran_${message.guild.id}`, 1);
let dbfetch = db.fetch(`commandran_${message.guild.id}`);
console.log(`Today, users have ran ${dbfetch} commands`);
}
推荐阅读
- flutter - Flutter MaterialPageRoute 在发布模式下不起作用
- css - React styled-components 共享样式
- java - 如何通过 Java 查找当前活动的网络接口的名称?
- highcharts - 如何在 Highcharts 上设置多个轴上的单位
- javascript - NodeJS:表格元素的 Href
- python - Python:从 arg 解析器到字典
- django - 嵌套序列化程序的 Yasg 模式生成显示不正确的请求/响应
- vue.js - Vue SSR 子级别路由
- python - 使用熊猫有条件地移动列中的数据
- c++ - 如何在 DevC++ 中访问 Zlib.h?