#Discord DMs

1 messages · Page 1 of 1 (latest)

steel wharf
#

Just a Question, Since the user messaged the bot in DMs, Can the bot get the roles of the author?
I'm confused because lets say the bot is in multiple servers. How would I check for the Roles in a specific server?

unkempt torrent
#

have the user select the specific user

steel wharf
#

The specific server?

unkempt torrent
#

which one the bot should get the roles off of

steel wharf
#
async run(client, message, args) {
    console.log(message.member)
    message.author.send('Invite command works');
  }
#

message.member.roles is undefined

#

So I know i have to Select the Specific Server and Then Get the roles of the author from that server.
Can you link me to the docs for this? Thank you

unkempt torrent
steel wharf
#
    let guild = client.guilds.cache.get('SERVER-ID');
    guild.members.fetch(message.author.id).then(async member => {
        if (member.roles.cache.has('ROLE-ID')) {
          message.channel.send('You already have the Holder Role!');
        } else {
          message.channel.send('You do not have the Holder Role!');
        }
    }).catch(err => {
      console.log(err);
    });

The user role does not update. I have to restart the server for it to take effect.
If the user has the Holder role and i remove it, the bot will still send You already have the Holder Role! even after removing it. I have to restart the server for it to take effect.
How do I fix it?

steel wharf
unkempt torrent
#

if you already have a specific server you want to look in, sure