YahiaMH
YahiaMH

Reputation: 17

How can I check if a user is a bot using their id?

I know how to check if a message is sent by a bot using if(message.author.bot) but I want to know if their is a way to find out if they are a bot using their id.

Upvotes: 0

Views: 1343

Answers (2)

Elitezen
Elitezen

Reputation: 6730

You can fetch the user then simply check their bot property.

const userID = 'id-here';

// client = your Discord Client Object
client.users.fetch(userID).then(user => {
   console.log(user.bot);
   // Will return a boolean
});

Upvotes: 1

gXLg
gXLg

Reputation: 304

image

As far as I know, and from reading the docs, there is no difference between how user and bot IDs are created.

Upvotes: 1

Related Questions