Created
December 10, 2019 20:46
-
-
Save pedroricardo/877d8aa84e6c0dde1a5f0f368734ab2e to your computer and use it in GitHub Desktop.
Criando Bot Discord #7 - Anti Invite No Status Personalizado - https://youtu.be/Jg5y40l-M-c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Discord = require("discord.js"); //baixar a lib | |
const client = new Discord.Client(); | |
const config = require("./config.json"); | |
client.on("ready", () => { | |
console.log('Olá mundo') | |
}) | |
client.on('raw', async dados => { | |
if(dados.t == 'PRESENCE_UPDATE' && client.guilds.get("558703169903788057").members.get(dados.d.user.id)){ | |
let membro = client.guilds.get("558703169903788057").members.get(dados.d.user.id) | |
if(dados.d.game == null) return membro.removeRole("653651520361070612") | |
if(dados.d.game.state == undefined) return membro.removeRole("653651520361070612") | |
let valor = dados.d.game.state.toLowerCase() | |
let n = valor.search(/((?:discord\.gg|discordapp\.com|www\.|http|invite))/g) | |
if(n>=0) membro.addRole("653651520361070612") | |
if(n<0 && membro.roles.has("653651520361070612")) membro.removeRole("653651520361070612") | |
} | |
}) | |
client.login(config.token); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Talvez você tenha que ativar o PRESENCE INTENT e/ou o SERVER MEMBERS INTENT para o bot conseguir pegar essas informações, mas não tenho certeza.