SHARE
TWEET

aaa.js

a guest Mar 19th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const config = require("./config.json");
  2. const Discord = require("discord.js");
  3. const bot = new Discord.Client({disableEveryone: true});
  4. const fs = require('fs')
  5. bot.commands = new Discord.Collection();
  6.  
  7. fs.readdir("./commands/", (err, files) => {
  8.   if(err) console.log(err);
  9.  
  10.   let jsfile = files.filter(f => f.split(".").pop() === "js")
  11.   if(jsfile.length <= 0){
  12.     console.log("[ERROR] Não foi possível encontrar a pasta de comandos!")
  13.     return;
  14.   }
  15.  
  16.   jsfile.forEach((f, i) => {
  17.     let props = require(`./commands/${f}`)
  18.     bot.commands.set(props.help.name, props)
  19.  
  20.   })
  21. })
  22.  
  23. bot.on('guildMemberAdd', member => {    
  24.  
  25.   let embed = new Discord.RichEmbed()
  26.   .setAuthor(member.guild.name, member.guild.iconURL)    
  27.   .setTitle('Novo membro no servidor')
  28.   .setDescription(`Olá <@${member.id}>, se sinta em casa no \`${member.guild.name}\` \n`)
  29.   .setThumbnail(member.user.displayAvatarURL)
  30.   .setColor("#0088f7")
  31.   member.guild.channels.get('537310132011401217').send(embed)
  32.       let role = member.guild.roles.find(role => role.name == 'Membro');//nome do cargo membro
  33.           member.addRole(role.id); //aqui adiciona o cargo
  34.  
  35.           member.send(`Seja bem vindo ao servidor \`${member.guild.name}\` \n`)
  36.           member.send(`para saber os comandos vá para #comandos e digite \`-->help\` \n`)
  37.           member.send("Qualquer coisa chama meu criador: \`Kygo#1907\` \n")
  38. });
  39.  
  40. bot.on('guildMemberRemove', member => {    
  41.   let embed = new Discord.RichEmbed()
  42.   .setAuthor(member.guild.name, member.guild.iconURL)    
  43.   .setTitle('Alguém saiu do servidor :(')
  44.   .setDescription(`O ${member} saiu do \`${member.guild.name}\` \n infelizmente :(`)
  45.   .setThumbnail(member.user.displayAvatarURL)
  46.   .setColor("#0088f7")
  47.   member.guild.channels.get('537742508797460480').send(embed)
  48. });
  49. bot.on("message", async message => {
  50. message.channel.fetchMessage("542497555754516483")
  51. const exemplo = (reaction) => reaction.emoji.name === 'white_check_mark';
  52. const exemploTeste = message.createReactionCollector(exemplo, { time: 15000 });
  53.  
  54. exemploTeste.on("collect", async r => {
  55. user.addrole("542506756824367105");
  56. });
  57. });
  58.  
  59. bot.on('ready', () => {
  60.   console.log('Estou pronto para lhe servir!');
  61.   console.log(`${bot.user.username} Está online em ${bot.guilds.size} servidores! ${bot.users.size} pessoas`);
  62.   console.log(`${bot.user.username} Linguagem: JavaScript`)
  63.  
  64.     let status = [    
  65.       {name: `${bot.guilds.size} servidores!`, type: 'WATCHING'},
  66.       {name: `Meu prefix: : | Use !ajuda para Obter ajuda!!!`, type: 'LISTENING'},
  67.       {name: `outro status aqui!`, type: 'STREAMING', url: ''},
  68.       {name: `Feliz 2019`, type: 'WATCHING'},
  69.     ];  
  70.     //STREAMING = TRANSMITINDO
  71.     //LISTENING = OUVINDO
  72.     //PLAYING = JOGANDO
  73.     //WATCHING = ASSISTINDO
  74.  
  75.     function setStatus() {
  76.         let randomStatus = status[Math.floor(Math.random() * status.length)];
  77.         bot.user.setPresence({game: randomStatus});
  78.     }
  79.  
  80.     setStatus();
  81.     setInterval(() => setStatus(), 6000);
  82.    
  83.   });  
  84.  
  85. bot.on("message", async message => {
  86.   if(message.author.bot) return;
  87.   if(message.channel.type === "dm") return;
  88.  
  89.   let prefix = config.prefix;
  90.   let messageArray = message.content.split(" ");
  91.   let cmd = messageArray[0];
  92.   let args = messageArray.slice(1);
  93.  
  94.   let commandfile = bot.commands.get(cmd.slice(prefix.length));
  95.   if(commandfile) commandfile.run(bot,message,args);
  96. });
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104. bot.login(config.token);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top