Shoutbox

Shoutbox - Wyze

  1. // ==UserScript==
  2. // @name Shoutbox
  3. // @namespace https://realitygaming.fr
  4. // @version 1.1
  5. // @description Shoutbox - Wyze
  6. // @author Eh Eh
  7. // @match https://realitygaming.fr/chatbox/*
  8. // @grant none
  9. // ==/UserScript==
  10. var rBot = {
  11. settings: {
  12. timeguard: {
  13. valid: true,
  14. time: 438
  15. },
  16. lottery: {
  17. valid: false,
  18. winner: {
  19. username: undefined,
  20. id: undefined
  21. }
  22. }
  23. },
  24. users: {
  25. newUser: function(id, username){
  26. this.id = id;
  27. this.username = username;
  28. this.wList = API.getWaitListPosition(id) == -1 ? API.getWaitListPosition(id) : API.getWaitListPosition(id) + 1;
  29. this.join = Date.now();
  30. rBot.users.listUser[id] = this;
  31. },
  32. newDc: function(id){
  33. this.id = id;
  34. this.time = Date.now();
  35. this.wList = rBot.users.getUser(id).wList;
  36. this.valid = true;
  37. rBot.users.listDc[id] = this;
  38. setTimeout(function(){rBot.users.removeDc(id);}, 100000);
  39. },
  40. removeUser: function(id){
  41. delete rBot.users.listUser[id];
  42. },
  43. removeDc: function(id){
  44. delete rBot.users.listDc[id];
  45. },
  46. getUser: function(id){
  47. for(var i in rBot.users.listUser){
  48. if(id){
  49. if(rBot.users.listUser[i].id == id){
  50. return rBot.users.listUser[i];
  51. }
  52. }
  53. else {
  54. return rBot.users.listUser;
  55. }
  56. }
  57. },
  58. getDc: function(id){
  59. for(var i in rBot.users.listDc){
  60. if(id){
  61. if(rBot.users.listDc[i].id == id){
  62. return rBot.users.listDc[i];
  63. }
  64. }
  65. else {
  66. return rBot.users.listDc;
  67. }
  68. }
  69. },
  70. listUser: {},
  71. listDc: {}
  72. },
  73. manager_cmd: {
  74. move: function(un, unt, position){
  75. var u = API.getUsers();
  76. for(var i in u){
  77. if(u[i].username == unt && position < 50){
  78. API.sendChat('[!move] [' + un + '] a modifié la position de ' + unt + ' dans la waitlist !');
  79. API.moderateMoveDJ(u[i].id, position);
  80. }
  81. }
  82. },
  83. kill: function(un){
  84. API.sendChat('[!kill] [' + un + '] a désactivé le bot ! :warning:');
  85. API.off(API.USER_JOIN);
  86. API.off(API.USER_LEAVE);
  87. API.off(API.CHAT);
  88. API.off(API.ADVANCE);
  89. rBot = {};
  90. },
  91. reload: function(un){
  92. API.sendChat('[!reload] [' + un + '] a rechargé le bot ! :warning:');
  93. API.off(API.USER_JOIN);
  94. API.off(API.USER_LEAVE);
  95. API.off(API.CHAT);
  96. API.off(API.ADVANCE);
  97. rBot = {};
  98. setTimeout(function(){$.getScript('https://rawgit.com/WayzRG/rBot/master/rBot.js');}, 500);
  99. },
  100. clearchat: function(un){
  101. var msg = $('div#chat-messages').children('div');
  102. for(var i in msg){
  103. if(msg.eq(i).data('cid')){
  104. cid = msg.eq(i).data('cid');
  105. rBot.deleteChat(cid);
  106. }
  107. }
  108. API.sendChat('[!clearchat] [' + un + '] a supprimé tout les messages du chat ! :warning:');
  109. },
  110. grab: function(un){
  111. API.sendChat('[!grab] [' + un + '] a ajouté une musique dans ma playlist !');
  112. $("#grab").click();
  113. $($(".pop-menu.grab").children(".menu").children().children()[0]).mousedown();
  114. },
  115. join: function(un){
  116. API.sendChat('[!join] [' + un + '] m\'a ajouté dans la waitlist !');
  117. API.djJoin();
  118. },
  119. leave: function(un){
  120. API.sendChat('[!leave] [' + un + '] m\'a retiré dans la waitlist !');
  121. API.djLeave();
  122. },
  123. bot: function(un, message){
  124.  
  125. API.sendChat('[!bot] [' + un + '] :warning: ' + message + ' :warning:');
  126. },
  127. timeguard: function(un){
  128. rBot.settings.timeguard.valid = !rBot.settings.timeguard.valid;
  129. var str = rBot.settings.timeguard.valid ? "activé" : "désactivé";
  130. API.sendChat('[!timeguard] [' + un + '] a ' + str + ' timeguard !');
  131. },
  132. lottery: function(un){
  133. var alea = Math.floor((API.getWaitList().length)*Math.random());
  134. var num = (API.getWaitList().length > 3 && alea <= 2) ? alea+2 : alea;
  135. var u = API.getWaitList();
  136. for(var i in u){
  137. if(API.getWaitListPosition(u[i].id) === num){
  138. API.sendChat('[!lotwin] [' + un + '] @' + u[i].username + ' a gagné la loterie ! Tapez !loterie pour remporter le boost !');
  139. rBot.settings.lottery.winner.username = u[i].username;
  140. rBot.settings.lottery.winner.id = u[i].id;
  141. rBot.settings.lottery.valid = true;
  142. setTimeout(function(){rBot.settings.lottery.valid = false;}, 300000);
  143. }
  144. }
  145. }
  146. },
  147. bouncer_cmd: {
  148. skip: function(un, position){
  149. API.sendChat('[!skip] [' + un + '] a passé la musique !');
  150. var current_dj = API.getDJ().id;
  151. if(position < 50){
  152. API.moderateForceSkip();
  153. setTimeout(function(){API.moderateAddDJ(current_dj);}, 1000);
  154. setTimeout(function(){API.moderateMoveDJ(current_dj, parseInt(position));}, 1500);
  155. }
  156. else{
  157. API.moderateForceSkip();
  158. }
  159. },
  160. unlock: function(un){
  161. API.sendChat('[!unlock] [' + un + '] a débloqué la waitlist !');
  162. API.moderateLockWaitList(false, false);
  163. },
  164. remove: function(un, unt){
  165. var wl = API.getWaitList();
  166. for(var i in wl){
  167. if(wl[i].username == unt){
  168. API.sendChat('[!remove] [' + un + '] a retiré ' + unt + ' de la waitlist !');
  169. API.moderateRemoveDJ(wl[i].id);
  170. }
  171. }
  172. },
  173. add: function(un, unt){
  174. var u = API.getUsers();
  175. for(var i in u){
  176. if(u[i].username == unt){
  177. API.sendChat('[!add] [' + un + '] a ajouté ' + unt + ' dans la waitlist !');
  178. API.moderateAddDJ(u[i].id);
  179. }
  180. }
  181. },
  182. kick: function(un, unt){
  183. var u = API.getUsers();
  184. for(var i in u){
  185. if(u[i].username == unt){
  186. var username = u[i].username;
  187. var id = u[i].id;
  188. API.sendChat('[!kick] [' + un + '] a kick ' + username + ' de la room !');
  189. setTimeout(function(){API.moderateBanUser(id, 0, -1);}, 1000);
  190. setTimeout(function(){$('#users-button').click();$('.button.bans').click();setTimeout(function(){ $('.button.room').click(); $('#chat-button').click();}, 100);}, 2000);
  191. setTimeout(function(){API.moderateUnbanUser(id);}, 3500);
  192. }
  193. }
  194. },
  195. mute: function(un, unt){
  196. var u = API.getUsers();
  197. for(var i in u){
  198. if(u[i].username == unt){
  199. var username = u[i].username;
  200. var id = u[i].id;
  201. API.sendChat('[!mute] [' + un + '] a mute ' + username + ' pendant 15 minutes !');
  202. API.moderateMuteUser(id, 1, API.MUTE.SHORT);
  203. }
  204. }
  205. },
  206. unmute: function(un, unt){
  207. var u = API.getUsers();
  208. for(var i in u){
  209. if(u[i].username == unt){
  210. var username = u[i].username;
  211. var id = u[i].id;
  212. API.sendChat('[!unmute] [' + un + '] a unmute ' + username + ' !');
  213. $('#users-button').click();setTimeout(function(){$('.button.mutes').click();setTimeout(function(){$('.button.room').click();$('#chat-button').click();},500);}, 100);
  214. setTimeout(function(){API.moderateUnmuteUser(id);},800);
  215. }
  216. }
  217. },
  218. guideline: function(un){
  219. API.sendChat('[!guideline] [' + un + '] Voici la guideline (règles à respecter) pour le staff : http://goo.gl/8OQxix');
  220. },
  221. jointime: function(un, unt){
  222. var u = API.getUsers();
  223. for(var i in u){
  224. if(u[i].username == unt){
  225. var ms = Date.now() - rBot.users.getUser(u[i].id).join,
  226. // http://stackoverflow.com/a/19700358
  227. seconds = parseInt((ms/1000)%60),
  228. minutes = parseInt((ms/(1000*60))%60),
  229. hours = parseInt((ms/(1000*60*60))%24);
  230.  
  231. hours = (hours < 10) ? "0" + hours : hours;
  232. minutes = (minutes < 10) ? "0" + minutes : minutes;
  233. seconds = (seconds < 10) ? "0" + seconds : seconds;
  234.  
  235. var time = hours + "h:" + minutes + "m:" + seconds + "s";
  236. API.sendChat('[!jointime] [' + un + '] L\'utilisateur ' + unt + ' est connecté depuis ' + time);
  237. }
  238. }
  239. },
  240. ban: function(un, id, unt){
  241. var u = API.getUsers();
  242. for(var i in u){
  243. if(u[i].username == unt){
  244. if(API.getUser(u[i].id).role < API.getUser(id).role){
  245. var username = u[i].username;
  246. var idt = u[i].id;
  247. API.sendChat('[!ban] [' + un + '] a ban ' + username + ' pendant 1 heure !');
  248. API.moderateBanUser(idt, 1, API.BAN.HOUR);
  249. }
  250. else {
  251. API.sendChat('[!ban] [' + un + '] Vous n\'avez pas les droits requis pour ban ' + u[i].username + ' !')
  252. }
  253. }
  254. }
  255. }
  256. },
  257. rdj_cmd: {
  258. rdj: function(un){
  259. API.sendChat('[!rdj] [' + un + '] Pour devenir Resident DJ, il faut passer des musiques appréciées par la communauté, vous serez prévenu par un membre du staff');
  260. },
  261. staff: function(un){
  262. API.sendChat('[!staff] [' + un + '] Pour devenir staff, il faut respecter les règles, être sérieux mais aussi détendu, et surtout être actif ! Vous serez prévenu par un membre du staff :)');
  263. },
  264. tuto: function(un){
  265. API.sendChat('[!tuto] [' + un + '] Voici une explication de plug.dj en une image : http://i.imgur.com/et4qYhs.jpg');
  266. },
  267. lothelp: function(un){
  268. API.sendChat('[!lothelp] [' + un + '] La loterie est un jeu qui permet de booster une personne en première position dans la liste d\'attente, aléatoirement. Si vous gagnez, tapez !loterie');
  269. },
  270. dev: function(un){
  271. API.sendChat('[!dev] [' + un + '] Le développeur de ce bot est : WAYZ');
  272. }
  273. },
  274. user_cmd: {
  275. theme: function(un){
  276. API.sendChat('[!theme] [' + un + '] Tout les styles de musiques sont autorisés sauf : Country, Nightcore, Metal, Jumpstyle, Tekstyle, Hardcore, la musique Classique (chopin et autres) et les sons à caractères racistes !');
  277. },
  278. rules: function(un){
  279. API.sendChat('[!rules] [' + un + '] Voici les règles à respecter : http://goo.gl/uUeNVF');
  280. },
  281. op: function(un){
  282. API.sendChat('[!op] [' + un + '] Voici la liste des musiques interdites : http://goo.gl/eiRdQK');
  283. },
  284. emoji: function(un){
  285. API.sendChat('[!emoji] [' + un + '] Voici la liste des smileys : http://goo.gl/AKDkeo');
  286. },
  287. help: function(un){
  288. API.sendChat('[!help] [' + un + '] Voici la liste des commandes : http://goo.gl/t43eFj');
  289. },
  290. adblock: function(un){
  291. API.sendChat('[!adblock] [' + un + '] Voici l\'add-on adblock qui vous permet de bloquer les publicités ! https://adblockplus.org/fr/');
  292. },
  293. support: function(un){
  294. API.sendChat('[!support] [' + un + '] Voici l\'adresse du support plug.dj : http://support.plug.dj/');
  295. },
  296. pic: function(un){
  297. var media = API.getMedia();
  298. if(media.format === 1){
  299. var link = "http://i.ytimg.com/vi/" + media.cid + "/maxresdefault.jpg";
  300. API.sendChat('[!pic] [' + un + '] Voici le lien de l\'image : ' + link);
  301. }
  302. },
  303. link: function(un){
  304. var media = API.getMedia();
  305. if(media.format === 1){
  306. var base = "http://youtube.com/watch?v=";
  307. var link = base + media.cid;
  308. API.sendChat('[!link] [' + un + '] Voici le lien de la musique : ' + link);
  309. }
  310. else if(media.format === 2){
  311. SC.get('/tracks/'+media.cid,function(sound){
  312. API.sendChat('[!link] [' + un + '] Voici le lien de la musique : ' + sound.permalink_url);
  313. });
  314. }
  315. },
  316. dc: function(id, un){
  317. if(rBot.users.getDc(id)){
  318. if((Date.now() - rBot.users.getDc(id).time) < 600000 && (rBot.users.getDc(id).wList !== 50 || rBot.users.getDc(id).wList !== -1) && rBot.users.getDc(id).valid == true){
  319. API.sendChat('[!dc] [' + un + '] Voici ton ancienne place lors de la déconnexion : ' + rBot.users.getDc(id).wList);
  320. API.moderateAddDJ(id);
  321. setTimeout(function(){API.moderateMoveDJ(id, rBot.users.getDc(id).wList);}, 2000);
  322. rBot.users.listDc[id].valid = false;
  323. }
  324. else {
  325. API.sendChat('[!dc] [' + un + '] Vous êtes déconnecté depuis trop longtemps ou bien vous n\'étiez pas dans la waitlist');
  326. }
  327. }
  328. else{
  329. API.sendChat('[!dc] [' + un + '] Je ne vous ai pas vu vous déconnecter !');
  330. }
  331. },
  332. cookie: function(un, unt){
  333. API.sendChat('[!cookie] [' + unt + '] @' + un + ' vous a envoyé un cookie !');
  334. },
  335. kiss: function(un, unt){
  336. API.sendChat('[!kiss] [' + unt + '] @' + un + ' vous a envoyé un bisous !');
  337. },
  338. eta: function(un){
  339. var u = API.getUsers();
  340. for(var i in u){
  341. if(u[i].username == un){
  342. if(API.getWaitListPosition(u[i].id) !== -1){
  343. var username = u[i].username;
  344. var id = u[i].id;
  345. API.sendChat('[!eta] [' + un + '] Il vous reste environ ' + Math.floor(API.getMedia().duration * 0.017) * (API.getWaitListPosition(id) + 1) + ' minutes à attendre pour être le dj !');
  346. }
  347. else {
  348. API.sendChat('[!eta] [' + un + '] Vous n\'êtes pas dans la waitlist !');
  349. }
  350. }
  351. }
  352. },
  353. loterie: function(un){
  354. if(rBot.settings.lottery.valid){
  355. if(rBot.settings.lottery.winner.username == un){
  356. var id = rBot.settings.lottery.winner.id;
  357. API.sendChat('[!loterie] [' + un + '] Bravo, Vous avez gagné la loterie, vous allez être boosté 2ème de la waitlist !');
  358. rBot.settings.lottery.valid = false;
  359. API.moderateAddDJ(id);
  360. setTimeout(function(){API.moderateMoveDJ(id, 2);}, 500);
  361. }
  362. else {
  363. API.sendChat('[!loterie] [' + un + '] Vous n\'avez pas gagné la loterie !');
  364. }
  365. }
  366. else {
  367. API.sendChat('[!loterie] [' + un + '] La loterie a expiré ou n\'a pas été lancé !');
  368. }
  369. }
  370. },
  371. deleteChat: function(id){
  372. $.ajax({url:'https://plug.dj/_/chat/'+id,type:'DELETE'});
  373. },
  374. api_listener: function(){
  375. API.on(API.USER_JOIN, function(usr){
  376. new rBot.users.newUser(usr.id, usr.username);
  377. });
  378. API.on(API.USER_LEAVE, function(usr){
  379. new rBot.users.newDc(usr.id);
  380. rBot.users.removeUser(usr.id);
  381. });
  382. API.on(API.CHAT, function(data){
  383. if(data.message.indexOf('!') == 0){
  384. var cmds = data.message.split(' ');
  385. var cmd = cmds[0];
  386. var attr = data.message.substr(data.message.indexOf(cmds[1]));
  387. switch(cmd){
  388. // user_cmd
  389. case '!ping':
  390. rBot.deleteChat(data.cid);
  391. API.sendChat('[!ping] [' + data.un + '] Pong !');
  392. break;
  393. case '!theme':
  394. rBot.deleteChat(data.cid);
  395. rBot.user_cmd.theme(data.un);
  396. break;
  397. case '!rules':
  398. rBot.deleteChat(data.cid);
  399. rBot.user_cmd.rules(data.un);
  400. break;
  401. case '!op':
  402. rBot.deleteChat(data.cid);
  403. rBot.user_cmd.op(data.un);
  404. break;
  405. case '!emoji':
  406. rBot.deleteChat(data.cid);
  407. rBot.user_cmd.emoji(data.un);
  408. break;
  409. case '!help':
  410. rBot.deleteChat(data.cid);
  411. rBot.user_cmd.help(data.un);
  412. break;
  413. case '!adblock':
  414. rBot.deleteChat(data.cid);
  415. rBot.user_cmd.adblock(data.un);
  416. break;
  417. case '!support':
  418. rBot.deleteChat(data.cid);
  419. rBot.user_cmd.support(data.un);
  420. break;
  421. case '!pic':
  422. rBot.deleteChat(data.cid);
  423. rBot.user_cmd.pic(data.un);
  424. break;
  425. case '!link':
  426. rBot.deleteChat(data.cid);
  427. rBot.user_cmd.link(data.un);
  428. break;
  429. case '!dc':
  430. rBot.deleteChat(data.cid);
  431. rBot.user_cmd.dc(data.uid, data.un);
  432. break;
  433. case '!cookie':
  434. rBot.deleteChat(data.cid);
  435. rBot.user_cmd.cookie(data.un, attr);
  436. break;
  437. case '!kiss':
  438. rBot.deleteChat(data.cid);
  439. rBot.user_cmd.kiss(data.un, attr);
  440. break;
  441. case '!eta':
  442. rBot.deleteChat(data.cid);
  443. rBot.user_cmd.eta(data.un);
  444. break;
  445. case '!loterie':
  446. rBot.deleteChat(data.cid);
  447. rBot.user_cmd.loterie(data.un);
  448. break;
  449.  
  450.  
  451. // rdj_cmd
  452. case '!rdj':
  453. if(API.hasPermission(data.uid, API.ROLE.DJ)){
  454. rBot.deleteChat(data.cid);
  455. rBot.rdj_cmd.rdj(data.un);
  456. } else { rBot.deleteChat(data.cid); }
  457. break;
  458. case '!staff':
  459. if(API.hasPermission(data.uid, API.ROLE.DJ)){
  460. rBot.deleteChat(data.cid);
  461. rBot.rdj_cmd.staff(data.un);
  462. } else { rBot.deleteChat(data.cid); }
  463. break;
  464. case '!tuto':
  465. if(API.hasPermission(data.uid, API.ROLE.DJ)){
  466. rBot.deleteChat(data.cid);
  467. rBot.rdj_cmd.tuto(data.un);
  468. } else { rBot.deleteChat(data.cid); }
  469. break;
  470. case '!lothelp':
  471. if(API.hasPermission(data.uid, API.ROLE.DJ)){
  472. rBot.deleteChat(data.cid);
  473. rBot.rdj_cmd.lothelp(data.un);
  474. } else { rBot.deleteChat(data.cid); }
  475. break;
  476. case '!dev':
  477. if(API.hasPermission(data.uid, API.ROLE.DJ)){
  478. rBot.deleteChat(data.cid);
  479. rBot.rdj_cmd.dev(data.un);
  480. } else { rBot.deleteChat(data.cid); }
  481. break;
  482.  
  483.  
  484. // bouncer_cmd
  485. case '!unlock':
  486. if(API.hasPermission(data.uid, API.ROLE.BOUNCER)){
  487. rBot.deleteChat(data.cid);
  488. rBot.bouncer_cmd.unlock(data.un);
  489. } else { rBot.deleteChat(data.cid); }
  490. break;
  491. case '!skip':
  492. if(API.hasPermission(data.uid, API.ROLE.BOUNCER)){
  493. rBot.deleteChat(data.cid);
  494. rBot.bouncer_cmd.skip(data.un, attr);
  495. } else { rBot.deleteChat(data.cid); }
  496. break;
  497. case '!remove':
  498. if(API.hasPermission(data.uid, API.ROLE.BOUNCER)){
  499. rBot.deleteChat(data.cid);
  500. rBot.bouncer_cmd.remove(data.un, attr);
  501. } else { rBot.deleteChat(data.cid); }
  502. break;
  503. case '!add':
  504. if(API.hasPermission(data.uid, API.ROLE.BOUNCER)){
  505. rBot.deleteChat(data.cid);
  506. rBot.bouncer_cmd.add(data.un, attr);
  507. } else { rBot.deleteChat(data.cid); }
  508. break;
  509. case '!kick':
  510. if(API.hasPermission(data.uid, API.ROLE.BOUNCER)){
  511. rBot.deleteChat(data.cid);
  512. rBot.bouncer_cmd.kick(data.un, attr);
  513. } else { rBot.deleteChat(data.cid); }
  514. break;
  515. case '!mute':
  516. if(API.hasPermission(data.uid, API.ROLE.BOUNCER)){
  517. rBot.deleteChat(data.cid);
  518. rBot.bouncer_cmd.mute(data.un, attr);
  519. } else { rBot.deleteChat(data.cid); }
  520. break;
  521. case '!unmute':
  522. if(API.hasPermission(data.uid, API.ROLE.BOUNCER)){
  523. rBot.deleteChat(data.cid);
  524. rBot.bouncer_cmd.unmute(data.un, attr);
  525. } else { rBot.deleteChat(data.cid); }
  526. break;
  527. case '!guideline':
  528. if(API.hasPermission(data.uid, API.ROLE.BOUNCER)){
  529. rBot.deleteChat(data.cid);
  530. rBot.bouncer_cmd.guideline(data.un);
  531. } else { rBot.deleteChat(data.cid); }
  532. break;
  533. case '!jointime':
  534. if(API.hasPermission(data.uid, API.ROLE.BOUNCER)){
  535. rBot.deleteChat(data.cid);
  536. rBot.bouncer_cmd.jointime(data.un, attr);
  537. } else { rBot.deleteChat(data.cid); }
  538. break;
  539. case '!ban':
  540. if(API.hasPermission(data.uid, API.ROLE.BOUNCER)){
  541. rBot.deleteChat(data.cid);
  542. rBot.bouncer_cmd.ban(data.un, data.uid, attr);
  543. } else { rBot.deleteChat(data.cid); }
  544. break;
  545.  
  546. // manager_cmd
  547. case '!move':
  548. if(API.hasPermission(data.uid, API.ROLE.MANAGER)){
  549. rBot.deleteChat(data.cid);
  550. rBot.manager_cmd.move(data.un, attr.substr(0, attr.length - 1).trim(), attr.substr(attr.length - 1).trim());
  551. } else { rBot.deleteChat(data.cid); }
  552. break;
  553. case '!kill':
  554. if(API.hasPermission(data.uid, API.ROLE.MANAGER)){
  555. rBot.deleteChat(data.cid);
  556. rBot.manager_cmd.kill(data.un);
  557. } else { rBot.deleteChat(data.cid); }
  558. break;
  559. case '!reload':
  560. if(API.hasPermission(data.uid, API.ROLE.MANAGER)){
  561. rBot.deleteChat(data.cid);
  562. rBot.manager_cmd.reload(data.un);
  563. } else { rBot.deleteChat(data.cid); }
  564. break;
  565. case '!clearchat':
  566. if(API.hasPermission(data.uid, API.ROLE.MANAGER)){
  567. rBot.deleteChat(data.cid);
  568. rBot.manager_cmd.clearchat(data.un);
  569. } else { rBot.deleteChat(data.cid); }
  570. break;
  571. case '!grab':
  572. if(API.hasPermission(data.uid, API.ROLE.MANAGER)){
  573. rBot.deleteChat(data.cid);
  574. rBot.manager_cmd.grab(data.un);
  575. } else { rBot.deleteChat(data.cid); }
  576. break;
  577. case '!join':
  578. if(API.hasPermission(data.uid, API.ROLE.MANAGER)){
  579. rBot.deleteChat(data.cid);
  580. rBot.manager_cmd.join(data.un);
  581. } else { rBot.deleteChat(data.cid); }
  582. break;
  583. case '!leave':
  584. if(API.hasPermission(data.uid, API.ROLE.MANAGER)){
  585. rBot.deleteChat(data.cid);
  586. rBot.manager_cmd.leave(data.un);
  587. } else { rBot.deleteChat(data.cid); }
  588. break;
  589. case '!bot':
  590. if(API.hasPermission(data.uid, API.ROLE.MANAGER)){
  591. rBot.deleteChat(data.cid);
  592. rBot.manager_cmd.bot(data.un, attr);
  593. } else { rBot.deleteChat(data.cid); }
  594. break;
  595. case '!timeguard':
  596. if(API.hasPermission(data.uid, API.ROLE.MANAGER)){
  597. rBot.deleteChat(data.cid);
  598. rBot.manager_cmd.timeguard(data.un);
  599. } else { rBot.deleteChat(data.cid); }
  600. break;
  601. case '!lotwin':
  602. if(API.hasPermission(data.uid, API.ROLE.MANAGER)){
  603. rBot.deleteChat(data.cid);
  604. rBot.manager_cmd.lottery(data.un);
  605. } else { rBot.deleteChat(data.cid); }
  606. break;
  607.  
  608. default:
  609. rBot.deleteChat(data.cid);
  610. break;
  611. }
  612. }
  613. });
  614. API.on(API.ADVANCE, function(){
  615. var u = rBot.users.listUser;
  616. for(var i in u){
  617. u[i].wList = API.getWaitListPosition(u[i].id) == -1 ? API.getWaitListPosition(u[i].id) : API.getWaitListPosition(u[i].id) + 1;
  618. }
  619. if(rBot.settings.timeguard.valid){
  620. if(API.getMedia().duration > rBot.settings.timeguard.time){
  621. API.sendChat(':warning: Musique trop longue, la limite est 7.30 minutes ! Auto-skip dans 7.30 minutes ! :warning:');
  622. setTimeout(function(){API.moderateForceSkip();}, 438000);
  623. }
  624. }
  625. });
  626. },
  627. init: function(){
  628. if(API.getUser().role >= 3){
  629. for(var i in API.getUsers()){
  630. new rBot.users.newUser(API.getUsers()[i].id, API.getUsers()[i].username);
  631. }
  632. rBot.api_listener();
  633. API.sendChat('[rBot] est maintenant en marche ! :)')
  634. }
  635. else{
  636. API.sendChat('[rBot] a besoin d\'être au minimum manager pour fonctionner !');
  637. }
  638. }
  639. };
  640.  
  641. rBot.init();