client.on('raw', async dados => {
if(dados.t == 'PRESENCE_UPDATE' && this.client.guilds.cache.get("948835296089342012").members.cache.get(dados.d.user.id)){
let membro = this.client.guilds.cache.get("948835296089342012").members.cache.get(dados.d.user.id)
if(dados.d.activites.state == null) return membro.roles.remove("653651520361070612")
if(dados.d.activities.state == undefined) return membro.roles.remove("653651520361070612")
let valor = dados.d.activities.state.toLowerCase()
let n = valor.search(`discord.gg/server`)
if(n>=0) membro.roles.add("653651520361070612")
if(n<0 && membro.roles.cache.has("653651520361070612")) membro.roles.remove("653651520361070612")
}
log=
user: { id: '932194344859996180' },
status: 'online',
guild_id: '947899731303096320',
client_status: { web: 'online' },
activities: [
{
type: 4,
state: 'aa536a43',
name: 'Custom Status',
id: 'custom',
created_at: 1647655901662
}
]
}
I'm creating an event to identify the member's Status, for example: if the member has the url in the discord.gg/3 status the member will receive a position and when he removes the status the bot will remove the selected position