SHARE
TWEET

Untitled

xSauron Nov 11th, 2018 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bot.on("ready", () => {
  2.     console.log(`Bot is ready! ${bot.user.username}`);
  3.  
  4.     const interval = setInterval(function() {
  5.  
  6.         let con = mysql.createConnection(db_config);
  7.         let rolea = bot.guilds.first().roles.find(r => r.name === "ACTIVE DISCORD")
  8.        
  9.         con.query(`SELECT * FROM messages ORDER BY count DESC LIMIT 10`, (err, rows) =>{
  10.             if(err) throw err;
  11.             top = (JSON.parse(JSON.stringify(rows)))
  12.  
  13.             for(const data of top) {
  14.                 bot.users.get(data.did).addRole(rolea)
  15.             }
  16.            
  17.             for(const data of oldtop) {
  18.                 bot.users.get(data.did).removeRole(rolea)
  19.             }
  20.  
  21.             })  
  22.     },5000)
  23. }
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