如何使不和谐的机器人在特定频道中提及某人(discord.js)

时间:2020-06-09 19:27:28

标签: discord.js

我正在制作一个“迷你游戏聊天机器人”,我希望该机器人有不同的结局。 当某人解锁某个结局时,我想得到通知,以便我可以跟踪该人已解锁多少个结局(不,我不会添加角色来跟踪,因为如果我的计算正确的话,该机器人将有200个不同的结局)。 我想做到这一点, 例如,有人在#general中说B3,而漫游器在#endings

中回答

@(使用命令的人)解锁了结尾“我可能 不应该这么说...”

    case 'B3':
            message.channel.send('Umm.. What?'); 
            const B3ending = new Discord.MessageEmbed() 
            .setTitle('Congratulations!) 
            .setColor(0x8CF1EC)
            .setDescription('You unlocked the ending "I probably shouldn't have said that..."');
            message.channel.send(B3ending);
        break;

1 个答案:

答案 0 :(得分:0)

首先,您需要以某种方式获取频道,也许是通过id:

const endChannel = message.guild.channels.cache.get(id);

之后,您可以仅在msg.author旁边使用send方法

endChannel.send(`${message.author} here's the ending`, { embed: B3ending });