I'm having some troubling getting a user to add a role to.
const DonatorAdd = (client, message, args, m_db, m_default, config, moment, server) => {
var guild = message.guild.id;
var member = guild.members.get(args[1]);
if (!member.roles.has('590384740989796392')){ member.addRole('590384740989796392').catch(console.error); }
if (!member.roles.has('605482684625453056')){ member.addRole('605482684625453056').catch(console.error); }
if (!member.roles.has('605482688316440599')){ member.addRole('605482688316440599').catch(console.error); }
}
All I get is this error:
"TypeError: Cannot read property 'get' of undefined" on "var member = guild.members.get(args[1]);"
And args[1] is really an ID.
Your guild
is message.guild.id
. But this is only the id and not the guild it self. You should use message.guild
instead of its id.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments