Bots Home
|
Create an App
KillSwitch
Author:
cbrocks101
Description
Source Code
Launch Bot
Current Users
Created by:
Cbrocks101
/********************************************************** Name: KillSwitch Author:alanstuart Version 1.0 Inspired by anthony19cal **********************************************************/ /********************************************************** Summary: -------- Simple Bot Allowing Mods to Hide the Live Cam Stream in the event the Performer is unable to or forgets to Description ----------- Inspired by anthony19cal. This bot gives Mods a "Kill Switch" to hide the performer's stream. The ability to hit the killswitch is enabled by default, but can be disabled by the performer using the "/k off" command. Once enabled, any mod can use the "/kill" command to hide the performer's live stream, and replace it with a custom message. The performer and the mod that issued the /kill command will stil be able to see the live stream. While the stream is hidden, the performer and all mods will see a periodic notice reminding them that the stream is hidden. The stream can be unhidden by the performer or any mod with the "/unkill command". **********************************************************/ /******************************************* * COMMANDS * -------- * Commands that can be typed in chat. * * Turn ability to use killswitch on and off (Performer only) * ---------------------------------------------------------- * /k on Turn killswitch capability on (allows /kill and /unkill commands to be issued) * /k off Turn killswitch capability off (/kill and /unkill commands can no longer be issued) * When the "/k off" command is issued, if the killswitch is active it will be disabled * /k Prints killswitch status Enabled or Disabled, and On or Off * * Hide or Unhide Cam Feed (Mod or Performer Only * ----------------------------------------------- * /kill [msg] Hides the broadcasters live cam feed and displays a screen with [msg] instead * If [msg] is not specified, the default message is "Performer is Away" * The broadcaster and the mod who issued the command will still be able to see the live feed * /unkill Restores the broacsters live feed so all users can see it * *******************************************/ var killenabled = 1; var killactive = 0; var cmdparms = {}; var cmd; var cmdmsg; var cmdparmct; var kmsg; var knotice; cb.sendNotice('Welcome to KillSwitch. Type "/kshelp" for list of available commands',"","#ffffff","#900000","bolder","red"); cb.sendNotice('Welcome to KillSwitch. Type "/kshelp" for list of available commands',cb.room_slug,"#ffffff","#900000","bolder"); cb.sendNotice("Ability for Mods to use Killswitch is enabled, type '/k off' to disable",cb.room_slug,"#ffffff","#900000","normal"); cb.onMessage(function (msg) { cmdmsg = msg; if (msg.m.substr(0,1)=='/') {return processCmd(msg);} else {return processMsg(msg);} }); function processCmd (msg) { cmdparms = notBlank(msg.m.substr(1).split(" ")); cmd = cmdparms[0]; cmdparmct = cmdparms.length-1; // cb.sendNotice("You ran command "+cmd+" with "+(cmdparms.length-1)+" parms",msg.user); if (cmd=="k") { if ((cmdmsg.user!==cb.room_slug)&&(!cmdmsg.is_mod)) {return badCommand("You must be a mod or the performer to run KillSwitch commands");} if (cmdparmct>1) {return badCommand("Wrong number of parameters for command");} if (cmdparmct==0) { if (killenabled) {estr="Enabled";} else {estr="Disabled";} if (killactive) {astr="On";} else {astr="Off";} cb.sendNotice("Killswitch is "+estr+" and is "+astr,cmdmsg.user,"#ffffff","#900000","normal"); } else if (cmdparms[1]=="on") { if (cmdmsg.user!==cb.room_slug) {return badCommand("Only the performer to run this command");} killenabled = 1; cb.sendNotice("Killswitch has been enabled, type '/kill [msg]' to hide feed","","#ffffff","#900000","normal","red"); cb.sendNotice("Killswitch has been enabled, type '/kill [msg]' to hide feed",cb.room_slug,"#ffffff","#900000","normal"); } else if (cmdparms[1]=="off") { if (cmdmsg.user!==cb.room_slug) {return badCommand("Only the performer to run this command");} killenabled = 0; cb.sendNotice("Killswitch has been disabled and feed is now visible","","#ffffff","#900000","normal","red"); cb.sendNotice("Killswitch has been disabled and feed is now visible",cb.room_slug,"#ffffff","#900000","normal"); } else {return badCommand("Must specify either '/k', '/k on', or '/k off'");} cmdmsg['X-Spam'] = true; return cmdmsg; } else if (cmd=="kill") { if ((cmdmsg.user!==cb.room_slug)&&(!cmdmsg.is_mod)) {return badCommand("You must be a mod or the performer to run KillSwitch commands");} if (!killenabled) { cb.sendNotice("Killswitch is not enabled, it must be enabled by performer for the kill command to be issued",cmdmsg.user,"#ffffff","#900000","normal"); cmdmsg['X-Spam'] = true; return cmdmsg; } if (cmdparmct==0) {kmsg="Performer is Away";} else {kmsg=msg.m.substr(6);} knotice = '*** KillSwitch was activated by '+cmdmsg.user+', Live Stream is Hidden ('+kmsg+'). Type "/unkill" to unhide Stream ***'; if (killactive) {cb.limitCam_stop();} else { killactive=1; kNotice() }; cb.limitCam_start("\n"+kmsg,[cb.room_slug,cmdmsg.user]); cmdmsg['X-Spam'] = true; return cmdmsg; } else if (cmd=="unkill") { if ((cmdmsg.user!==cb.room_slug)&&(!cmdmsg.is_mod)) {return badCommand("You must be a mod or the performer to run KillSwitch commands");} if (!killactive) { cb.sendNotice("Killswitch is not active",cmdmsg.user,"#ffffff","#900000","normal"); cmdmsg['X-Spam'] = true; return cmdmsg; } if (cmdparmct!=0) {return badCommand("Wrong number of parameters for command");} cb.limitCam_stop(); cb.sendNotice("Killswitch has been deactivated by "+cmdmsg.user+", feed is now visible","","#ffffff","#900000","normal","red"); cb.sendNotice("Killswitch has been deactivated by "+cmdmsg.user+", feed is now visible",cb.room_slug,"#ffffff","#900000","normal"); killactive=0; cmdmsg['X-Spam'] = true; return cmdmsg; } else if (cmd=="kshelp") { if ((cmdmsg.user!==cb.room_slug)&&(!cmdmsg.is_mod)) {return badCommand("You must be a mod or the performer to run KillSwitch commands");} cb.sendNotice(kshelp,cmdmsg.user,"#ffffff","#900000","normal"); cmdmsg['X-Spam'] = true; return cmdmsg; } return cmdmsg; }; function processMsg (msg) { if (msg.user==cb.room_slug) {msg.m = ":icon_weed "+msg.m;} return msg; }; // functions function notBlank(array) { return array.filter(function(item){ return item != ""; }); } function badCommand(badmsg) { cb.sendNotice('Error in command "'+cmdmsg.m+'"'+"\n"+badmsg+"\ntype \/nbhelp for help", cmdmsg.user,"#ffffff","#900000","bolder"); cmdmsg['X-Spam'] = true; return cmdmsg; } function kNotice () { if (killactive) { cb.sendNotice(knotice,"","#ffffff","#900000","bold","red"); cb.sendNotice(knotice,cb.room_slug,"#ffffff","#900000","bold"); cb.setTimeout(kNotice,60000) } } function init(){ } kshelp = "********************************************\n"+ "* COMMANDS\n"+ "* ------------------------- \n"+ "* The following KillSwitch commands can be typed in chat. \n"+ "* \n"+ "* Turn ability to use killswitch on and off (Performer only) \n"+ "* ---------------------------------------------------------------------------------- \n"+ "* /k on......Turn killswitch capability on (allows /kill and /unkill commands to be issued) \n"+ "* /k off.....Turn killswitch capability off (/kill and /unkill commands can no longer be issued) \n"+ "*............When the '/k off' command is issued, if the killswitch is active it will be disabled \n"+ "* /k.........Prints killswitch status Enabled or Disabled, and On or Off \n"+ "* \n"+ "* Hide or Unhide Cam Feed (Mod or Performer Only)\n"+ "* ----------------------------------------------------------------- \n"+ "* /kill [msg]...Hides the broadcasters live cam feed and displays a screen with [msg] instead \n"+ "*...............If [msg] is not specified, the default message is 'Performer is Away' \n"+ "*...............The broadcaster and the mod who issued the command will still be able to see the live feed \n"+ "* /unkill.......Restores the broacsters live feed so all users can see it \n"+ "*\n"+ "*********************************************";
© Copyright Chaturbate 2011- 2024. All Rights Reserved.