client.on("guildMemberAdd", member => {
settingss.findOne({
guildID: guild.ID // <---- Trying to figure out what i want over here
}, async (err, settings) => {
var role = member.guild.roles.cache.get(role => role.name === settingss.joinrolename);
if (!role) return;
member.roles.add(role);
const channel = member.guild.channels.cache.get(channel => channel.name === settingss.welcomechannelname);
if (!channel) return;
channel.send(`Welcome to the server, ${member}`);
});
});
我似乎无法弄清楚如何获得公会ID。
我尝试了guild.memberCount这也不起作用。
答案 0 :(得分:0)
我认为member.guild.id
应该可以解决问题:)
答案 1 :(得分:0)
您可以使用member
参数使用member.guild.id
来获取行会ID:
client.on("guildMemberAdd", member => {
settingss.findOne({
guildID: member.guild.id
}, async (err, settings) => {
var role = member.guild.roles.cache.get(role => role.name === settingss.joinrolename);
if (!role) return;
member.roles.add(role);
const channel = member.guild.channels.cache.get(channel => channel.name === settingss.welcomechannelname);
if (!channel) return;
channel.send(`Welcome to the server, ${member}`);
});
});