Bot will assign you a role if you have a keyword (keyword can be server invite link or any text) in your status by installing this snippet! Bot also removes role if custom status is changed.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let USER = await lib.discord.guilds['@0.1.0'].members.retrieve({
user_id: `${context.params.event.user.id}`,
guild_id: `${process.env.guild_id}`,
});
if (
!USER.roles.includes(`${process.env.role_id}`) &&
context.params.event.guild_id === `${process.env.guild_id}` &&
context.params.event.activities[0].state.includes(`${process.env.key_word}`)
) {
await lib.discord.guilds['@0.1.0'].members.roles.update({
role_id: `${process.env.role_id}`,
user_id: `${context.params.event.user.id}`,
guild_id: `${process.env.guild_id}`,
});
await lib.discord.channels['@0.2.1'].messages.create({
channel_id: `${process.env.channel_id}`,
content: `<@!${context.params.event.user.id}> got **Supporter** role for having server invite link in his status!`,
}); //you can change the content
} else if (
USER.roles.includes(`${process.env.role_id}`) &&
context.params.event.guild_id === `${process.env.guild_id}` &&
!context.params.event.activities[0].state.includes(`${process.env.key_word}`)
) {
await lib.discord.guilds['@0.1.0'].members.roles.destroy({
role_id: `${process.env.role_id}`,
user_id: `${context.params.event.user.id}`,
guild_id: `${process.env.guild_id}`,
});
await lib.discord.channels['@0.2.1'].messages.create({
channel_id: `${process.env.channel_id}`,
content: `<@!${context.params.event.user.id}> lost **Supporter** role for not having server invite link in his status.`,
}); //you can change the content
}