[英]Discord.js Bot settings when changed on one server changes on all of them running it on repl.it
Hi so there really isn't much to the problem above I just need to know how to separate the settings on one server from the settings on another server.嗨,上面的问题真的没什么大不了的,我只需要知道如何将一台服务器上的设置与另一台服务器上的设置分开。 Here is the code I am currently using!
这是我目前正在使用的代码!
client.on('message', (msg) => {
if (msg.content == `${prefix}setup`) {
msg.channel.send('To set the prefix use !prefix set (the prefix)');
msg.channel.send('To set the code prefix use !prefix code (the prefix preferably your yt name)');
msg.channel.send('Make sure to set the channel for early code release/access use !early set (id of the channel)');
} else if (msg.content.startsWith(`${prefix}prefix set`)) {
prefix = msg.content.replace(`${prefix}prefix set`, '').trim()
console.log(prefix)
msg.channel.send('Prefix Changed!')
} else if (msg.content.startsWith(`${prefix}prefix code`)) {
name = msg.content.replace(`${prefix}prefix code`, '').trim()
console.log(name)
client.channels.cache.get(early).send(`Prefix set to ${name}`)
code = `New code is ${name}${Math.floor(Math.random() * 101)}`
client.channels.cache.get(early).send(`${code}`);
} else if (msg.content.startsWith(`${prefix}early set`)) {
early = msg.content.replace(`${prefix}early set`, '').trim()
console.log(early)
msg.channel.send('Early Channel Changed!')
} else if (msg.content == `${prefix}new code`) {
code = `code is ${name}${Math.floor(Math.random() * 101)}`
msg.channel.send(`New ${code}`)
}
});
You would need a database for individual server settings.您需要一个用于单独服务器设置的数据库。 Thankfully, this is very easy to do.
值得庆幸的是,这很容易做到。 You can use
discord-prefix
.您可以使用
discord-prefix
。
Discord Prefix is a simple Node.js module that lets you efficiently manage custom prefixes for your discord bot Discord Prefix 是一个简单的 Node.js 模块,可让您有效地管理 discord 机器人的自定义前缀
npm i discord-prefix
RedLukeBug/discord-prefix RedLukeBug/不和谐前缀
Hoped this helped!希望这有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.