我在这里使用此代码来检测用户何时加入并发送消息,但是我希望它仅在加入公会“ Bongo's Diner”时发送消息:
client.on('guildMemberAdd', member =>{
const welcomeChannel = client.channels.cache.get('713215120305815612');
welcomeChannel.send(`Welcome to the server, <@${member.id}>. I hope you enjoy your stay here at Bongo's Diner.
Be sure to check out <#713227378306056244> to grab a color and learn how to get ping roles. If you have a question, check out <#713194923909972159>.`);
});
答案 0 :(得分:0)
由于您已经在使用guildMemberAdd
并有权访问member
实例,所以只需调用member.guild
:
const guild = member.guild;
console.log(guild);