client.on("presenceUpdate", async (oldPresence, newPresence) => {
const role = newPresence.guild.roles.cache.get("866092770023440404");
const member = newPresence.member;
const activities = member.user.presence.activities[0];
if (!member) return;
if (!role) return console.log("No role");
if (!activities) return;
if (activities.state && (activities.state.includes(".gg/ninja") || activities.state.includes(".gg/ninja"))) {
await newPresence.member.roles.add(role);
} else {
if (member.roles.cache.get(role.id)) {
await newPresence.member.roles.remove(role);
}
}
});
这是我的代码,但如果他们有 .gg/ninja(example),它不会给出角色,所以如果有人可以帮忙吗?