我如何制作一个命令,将 channelID 存储在数据库中,也通过数据库,有点像我机器上的一个大文本文件,它有一个服务器 id,然后是一个通道 id。我该怎么办?
我正在使用:discord.js sqlite3 sequelize
我认为它会如何:用户:?setlog #channelmentionhere Bot:将新的全部内容放入文本文件或其他内容中
我做了大量的研究,我无法理解其中的大部分内容,如果我确实理解了它,我就会遇到麻烦。
我的机器人代码:
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const commandName = args.shift().toLowerCase();
const user = message.mentions.users.first();
const command = client.commands.get(commandName)
|| client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
if (!command) return;
if (command.guildOnly && message.channel.type !== 'text') {
return message.reply('I can\'t execute that command inside DMs!');
}
if (command.args && !args.length) {
let reply = `You didn't provide any arguments, ${message.author}!`;
if (command.usage) {
reply += `\nThe proper usage would be: \`${prefix}${command.name} ${command.usage}\``;
}
return message.channel.send(reply);
}
if (!cooldowns.has(command.name)) {
cooldowns.set(command.name, new Discord.Collection());
}
const now = Date.now();
const timestamps = cooldowns.get(command.name);
const cooldownAmount = (command.cooldown || 3) * 1000;
一只斗牛犬
相关分类