const bot = require('./../bot');
bot.on('ready',async function(){
  const guild =  bot.guilds.get("184536578654339072");
  const ingame = guild.roles.get("322233107489226764");
  let playing = guild.members.filterArray(function (m) {
        if (m.presence.game && m.presence.game.name)
            if (m.presence.game.name.toLowerCase().includes("battlefield 2"))
                return m.user.id;
    });
  let toRemove = ingame.members.filter(function (m){
      if(!playing.includes(m.id))
        return m;
    });
    toRemove.map(async function(m){
      await m.removeRole(ingame);
   });
   playing.map(async function(m){
      await m.addRole(ingame);
   });
});
bot.on('presenceUpdate',async function(om,m){
    if (om.presence.game && om.presence.game.name)
            if (om.presence.game.name.toLowerCase().includes("battlefield 2"))
                await m.removeRole("322233107489226764");
    if (m.presence.game && m.presence.game.name)
            if (m.presence.game.name.toLowerCase().includes("battlefield 2"))
                await m.addRole("322233107489226764");
})

@@ -30,21 +30,96 @@
 ');%0A
-bot.on('ready
+let re = false;%0Aconst request = require('request-promise-native');%0Abot.on('refreshOnline
 ',as
@@ -737,19 +737,397 @@
 %0A   %7D);%0A
-%7D);
+  let online = await request('http://localhost/v0/discord/online');%0A  online = JSON.parse(online);%0A  online.map(async function(u)%7B%0A    let user = bot.users.get(u);%0A    let member = guild.member(user);%0A    if(member)%0A       await member.addRole(ingame);%0A  %7D)%0A%7D);%0Abot.on('ready',()=%3E%7B%0A  if(!re)%0A    re = setInterval(function()%7B%0A        bot.emit('refreshOnline')%0A      %7D,15000)%0A%7D)%0A/**
 %0Abot.on(
@@ -1534,12 +1534,15 @@
 26764%22);%0A%7D)%0A
+*/%0A

refresh online every 15 seconds