只是当人们使用教程 !ping 命令时,我想计算多少次并在聊天中显示出来。就像“ping 已经使用了很多次”一样,我发现了一些关于 quick.db 的内容,但仍然不太了解。目前,消息显示为 [This has been used This NaN times!!!]
module.exports = {
name: 'ping',
description: 'Ping!',
execute (message, args, ) {
const db = require('quick.db')
var times = []
db.set('times', {hello: 'hi'})
db.add('times.used', 1)
let timesused = times.used + 1;
message.reply('pong');
message.channel.send(`This has been used This ${timesused} times!!!`);
},
};
答案 0 :(得分:0)
适合您尝试做的事情的正确解决方案很简单。就这样做。
const db = require('quick.db');
module.exports = {
name: 'ping',
description: 'Ping!',
execute (message, args) {
db.add('times.ping', 1); // Adding an amount of one to the countor for the ping command
const timesUsed = db.get('times.ping'); // Getting the amount of uses
message.reply('pong!');
message.channel.send('This command has been used '+timesUsed+' times!');
},
};
为了更好的解释,请阅读 Quick.db 的 Documentation。