使我的机器人商店通道ID位于json文件中以显示欢迎消息

时间:2020-09-22 13:19:59

标签: discord.js

应该将其存储在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);
    }
  }
});

0 个答案:

没有答案