statut de rôle discord.js

const client = require("@root");

client.on("presenceUpdate", (oldPresence, newPresence) => {
    const role = newPresence.guild.roles.cache.get("role-id-goes-here");
    const member = newPresence.member;
    const activities = newPresence.member.presence.activities[0];
    if(!member || !activities) return;
    if (activities && (activities.state.includes("kmgo.xyz"))) {
        return member.roles.add(role)
    } else {
        if (member.roles.cache.get(role.id)) {
            member.roles.remove(role)
        }
    }
})
dano