SHARE
TWEET

Untitled

a guest Dec 5th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js')
  2. const fs = require('fs')
  3. const client = new Discord.Client();
  4. const config = require("./config.json");
  5.  
  6.  
  7. const firebase = require("firebase");
  8. var firebaseConfig = {
  9.   apiKey: "AIzaSyB265W2CECtF6C29pzmsTFBYM6kPdaDVPQ",
  10.   authDomain: "fir-3ffad.firebaseapp.com",
  11.   databaseURL: "https://fir-3ffad.firebaseio.com",
  12.   projectId: "fir-3ffad",
  13.   storageBucket: "fir-3ffad.appspot.com",
  14.   messagingSenderId: "541232669280",
  15.   appId: "1:541232669280:web:3885db481455feab8c9905"
  16. };
  17. firebase.initializeApp(firebaseConfig);
  18. const database = firebase.database()
  19.  
  20.  
  21.  
  22.   client.on("message", message => {
  23.     if (message.author.bot) return;
  24.  
  25. let prefixes = JSON.parse(fs.readFileSync("./prefixes.json", "utf8"))
  26. if(!prefixes[message.guild.id]){
  27.   prefixes[message.guild.id] = {
  28.  
  29.     prefixes: config.prefix
  30.   }
  31. }
  32. let prefix = prefixes[message.guild.id].prefixes
  33. if (!message.content.toLowerCase().startsWith(prefix)) return;
  34.     let command = message.content.split(" ")[0];
  35.     command = command.slice(prefix.length);
  36.     let args = message.content.split(" ").slice(1);
  37.  
  38.   try {
  39.       let commandFile = require(`./pcomandos/${command}.js`);
  40.  
  41.       commandFile.run(client, message, args, Discord, config, prefix, database);
  42.       message.delete()
  43.     } catch (err) {
  44.       client.channels.get("651983867636613130").send("EITA GIOVANNA.. " + err)
  45.       message.delete()
  46.       var errok = new Discord.RichEmbed()
  47.       .setAuthor(`Algo de errado aconteceu.`, message.guild.iconURL)
  48.       .setDescription(`O comando **${command}** não foi encontrado, use \`${config.prefix}help\`.`)
  49.       .setColor(config.cor)
  50.       .setThumbnail(message.guild.iconURL)
  51.       .setFooter("Google@ todos os direitos reservados.")
  52.       message.channel.send(errok).then(msg => msg.delete(6000));
  53.     }
  54.   })
  55.  
  56. fs.readdir("./peventos/", (err, files) => {
  57.   if (err) return console.error(err);
  58.   files.forEach(file => {
  59.     let eventFunction = require(`./peventos/${file}`);
  60.     let eventName = file.split(".")[0];
  61. client.on(eventName, (...args) => eventFunction.run(client, ...args));
  62.   });
  63. })
  64.  
  65.  
  66.  
  67.  
  68. client.on('message', async (message) => {
  69.   const db = database.ref(`Configurações/invite/${message.guild.id}`)
  70.   const dbval = await db.once('value')
  71.  
  72.   if(dbval.val() == null) return;
  73.   if(dbval.val().invite == false) return;
  74.   if(dbval.val().invite == true){
  75.  
  76.   let convite = /(discord.gg|discordapp.com)\/(invite)?/ig.test(message.content)
  77.   if(convite === true) {
  78.   if(message.member.hasPermission('BAN_MEMBERS')) return;
  79.   message.delete()
  80.   message.reply('Não pode divulgar convites de outros servidores aqui!!! :rage:')
  81.   }
  82.   }
  83.   });
  84.  
  85.  
  86.  
  87. client.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
 
Top