应该将其存储在channel_id
变量中,以便某人加入时可以使用这些变量发送欢迎消息!虽然它不想存储任何变量!我什么也没收到!这是代码:
client.on('message', (message) => {
if (!message.content.startsWith(prefix)) return;
const welcomechannel = message.content.slice(prefix.length);
if (welcomechannel === 'welcomechannel') {
if (message.mentions.channels) {
channel_id = message.mentions.channels.first().id;
let file = editJsonFile(`${__dirname}/database/welcomechannel.json`);
file.set('Channel_ID', `${channel_id}`);
file.save();
} else {
const channelerror = new Discord.MessageEmbed()
.setTitle('Huh? Oh!')
.setDescription(
"Hey there! You forgot to mention a channel! You don't know how?!? Do `#channelname`!"
);
channel.send(channelerror);
}
}
});