Bots Home
|
Create an App
Mod Leaderboard
Author:
yavascriptdev
Description
Source Code
Launch Bot
Current Users
Created by:
Yavascriptdev
!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){var t=e.m.replace("User ","").replace(/ was silenced.*/,""),n=e.m.replace(/.*silenced by /,"").replace(/ and his\/her messages have been removed/,""),r=this.moderators.get(n)||this.addModerator(n);this.cb.log(t),this.cb.log(n),this.cb.log(JSON.stringify(r));var i=r.level;return this.silenced.has(t)?r.assist():(r.kill(),this.silenced.add(t)),r.level>i&&(this.messenger.announce(r.name+" has achieved rank "+r.rank+"!"),this.messenger.announce("The reward is: "+this.prize)),e}function o(e){var t=/and his\/her messages have been removed/g.test(e.m),n=e.user===this.cb.room_slug,r=e.is_mod||n;if(this.messenger.say(JSON.stringify(e)),e.is_mod&&!this.moderators.has(e.user)&&this.addModerator(e.user),t&&n)return a.call(this,e),e;if("/mod leaderboard"===e.m&&r)return this.showLeaderboard(),Object.assign(e,{"X-Spam":!0});if(e.is_mod){var i=this.moderators.get(e.user);return Object.assign(e,{m:"["+i.rank+"] "+e.m})}return e}function u(e){var t=e.user,n=e.is_mod;n&&this.addModerator(t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(2),f=r(c),h=n(3),d=r(h),v=function(){function e(t){var n=this;s(this,e),this.cb=t,this.messenger=new f.default(t),this.moderators=new Map,this.silenced=new Set,this.prize=null,this.calls=[];var r=function(e){"function"==typeof n.cb[e]&&!function(){var t=n.cb[e];n.cb[e]=function(){for(var r=arguments.length,i=Array(r),s=0;s<r;s++)i[s]=arguments[s];n.calls.push(e+" call "+JSON.stringify(i)),t.apply(void 0,i)}}()};for(var i in this.cb)r(i);this.repeatBanner()}return l(e,[{key:"repeatBanner",value:function(){var e=this;return this.cb.setTimeout(function(){e.messenger.say(e.calls),e.calls.splice(e.calls.length-5,e.calls.length),e.repeatBanner()},5e3),this}},{key:"applySettings",value:function(){var e=this.cb.settings,t=e.level_up_requirement,n=e.prize;return this.prize=n,d.default.setLevelRequirement(t),this}},{key:"showLeaderboard",value:function(e){var t=[].concat(i(this.moderators.values())).map(function(e){return e.name+" ["+e.rank+"]: "+e.kills+" Kills / "+e.assists+" Assists"}),n=this.moderators.size?t.join("\n"):"(no moderators tracked yet)";return this.messenger.announce("Mod Leaderboard:\n "+n),this}},{key:"addModerator",value:function(e){if(this.moderators.has(e))return this.moderators.get(e);var t=new d.default(e);return this.moderators.set(e,t),t}},{key:"start",value:function(){return this.cb.settings_choices=[{name:"prize",label:"Prize",type:"str",minLength:1,maxLength:255,required:!0},{name:"level_up_requirement",label:"Number of silences required to level up",type:"int",minValue:1,maxValue:1e5,defaultValue:15,required:!0}],this.cb.onEnter(u.bind(this)),this.cb.onMessage(o.bind(this)),this.applySettings(),this}}]),e}();t.default=v},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i="#e6e6fa",s="#98fb98",a=function(){function e(t){n(this,e),this.cb=t}return r(e,[{key:"header",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return this.cb.sendNotice(e,t,i,"black","bold"),this}},{key:"say",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return this.cb.sendNotice(e,t,i),this}},{key:"announce",value:function(e){return this.cb.sendNotice(e,"",s,"black","bold"),this}}]),e}();t.default=a},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=(new Map).set(1,"<rank.1>").set(2,"<rank.2>"),s=(new Map).set("level-up-requirement",15),a=function(){function e(t){n(this,e),this.name=t,this.kills=0,this.assists=0}return r(e,null,[{key:"setLevelRequirement",value:function(e){s.set("level-up-requirement",e)}}]),r(e,[{key:"kill",value:function(){return this.kills++,this}},{key:"assist",value:function(){return this.assists++,this}},{key:"level",get:function(){var e=this.kills+Math.floor(this.assists/2);return Math.ceil((e+1)/s.get("level-up-requirement"))}},{key:"rank",get:function(){return i.get(this.level)||"<rank.x>"}}]),e}();t.default=a},function(e,t,n){"use strict";(function(e){function t(e){return e&&e.__esModule?e:{default:e}}var r=n(0),i=t(r),s=new i.default(e.cb);s.start()}).call(t,n(1))}]);
© Copyright Chaturbate 2011- 2024. All Rights Reserved.