-1

I've been searching and tried pasting and modifying about everything on this website but here goes:

client.on("message", (message) => {
    if (message.content == "?status on") {
        if (message.author.roles.has(578319894039232558)) client.user.setActivity(`0.4.4 | ?help | being cool`);
    }
});

I want to make only the owner of the server be able to turn the status from boot (none) to turning on no matter what I try it cant make role-specific.

Jakye
  • 6,440
  • 3
  • 19
  • 38

1 Answers1

1

message.author returns a User object, which has no roles property.

You are looking for message.member which returns a GuildMember object.

Another mistake I spotted is that you need to use strings for IDs. Why?


Discord JS Version 12+

client.on("message", (message) => {
    if (message.content == "?status on") {
        if (!message.member.roles.cache.has("578319894039232558")) return false;
        client.user.setActivity(`0.4.4 | ?help | being cool`);
    }
});

Discord JS Version 11

client.on("message", (message) => {
    if (message.content == "?status on") {
        if (!message.member.roles.has("578319894039232558")) return false;
        client.user.setActivity(`0.4.4 | ?help | being cool`);
    }
});
Jakye
  • 6,440
  • 3
  • 19
  • 38