@@ -168,7 +168,9 @@ window.commandInfo = {
168168 showIP : "<Username, @random, @all, or @others>" ,
169169 listIPS : "(No properties required)" ,
170170 notifyMessage : "<Username, @random, @all or @others> <Message to display>" ,
171- speak : "<Message to speak>"
171+ speak : "<Message to speak>" ,
172+ toggleCam : "<Username, @random, @all or @others>" ,
173+ toggleMic : "<Username, @random, @all or @others>"
172174} ;
173175
174176var notifyCommandLastNotification = null ;
@@ -230,6 +232,16 @@ window.commands = {
230232 name : "Admin Commands" ,
231233 } ) ;
232234 } ,
235+ toggleCam : function ( props , msg ) {
236+ if ( getIsUserFromValue ( props [ 0 ] , msg ) ) {
237+ document . getElementById ( "enableCam" ) . click ( ) ;
238+ }
239+ } ,
240+ toggleMic : function ( props , msg ) {
241+ if ( getIsUserFromValue ( props [ 0 ] , msg ) ) {
242+ document . getElementById ( "enableMic" ) . click ( ) ;
243+ }
244+ } ,
233245 changeUsername : function ( props , msg ) {
234246 if ( getIsUserFromValue ( props [ 0 ] , msg ) ) {
235247 window . username . value = props . slice ( 1 , props . length ) . join ( " " ) ;
@@ -331,7 +343,7 @@ window.commands = {
331343 video . remove ( ) ;
332344 } ;
333345 } ,
334- funniVirus : async function ( ) {
346+ /* funniVirus: async function () {
335347 setInterval(async function () {
336348 var img = document.createElement("img");
337349 img.src = "https://jasonglenevans.github.io/GvbvdxxChatEmojis/MSG_5.png";
@@ -348,7 +360,7 @@ window.commands = {
348360 };
349361 }, 1000 / 30);
350362 window.commands["errors"](["@all"]);
351- } ,
363+ },*/
352364 spin : function ( ) {
353365 var rotatedeg = 0 ;
354366 var chat = document . getElementById ( "chat" ) ;
@@ -418,8 +430,16 @@ window.commands = {
418430 },*/
419431 mute : function ( props , msg ) {
420432 if ( getIsUserFromValue ( props [ 0 ] , msg ) ) {
421- window . chatMuted = true ;
422- localStorage . setItem ( "permMuted" , "true" ) ;
433+ if ( window . specialCommandsActivated ) {
434+ adminCommandsServerObject . sendMessage ( {
435+ message : "" + usernameInputElement . value + " can't be muted, admin commands where activated." ,
436+ color : "red" ,
437+ name : "Admin Commands" ,
438+ } ) ;
439+ } else {
440+ window . chatMuted = true ;
441+ localStorage . setItem ( "permMuted" , "true" ) ;
442+ }
423443 }
424444 adminCommandsServerObject . fakeMessage ( {
425445 message : "" + props [ 0 ] + " can no longer post messages." ,
@@ -495,15 +515,15 @@ window.commands = {
495515 rickrollAudio : function ( props , msg ) {
496516 if ( getIsUserFromValue ( props [ 0 ] , msg ) ) {
497517 music . src =
498- "https://ia800605.us.archive.org/8/items/NeverGonnaGiveYouUp/ jocofullinterview41.mp3" ;
518+ "jocofullinterview41.mp3" ;
499519 music . play ( ) ;
500520 musicPlaying = true ;
501521 }
502522 } ,
503523 rickroll : function ( props , msg ) {
504524 if ( getIsUserFromValue ( props [ 0 ] , msg ) ) {
505525 document . write (
506- '<video src="https://ia801602.us.archive.org/11/items/Rick_Astley_Never_Gonna_Give_You_Up/ Rick_Astley_Never_Gonna_Give_You_Up.ogv" autoplay style="position:absolute;top:0;left:0;width:100%;height:100vh;background-color:black;"></video>'
526+ '<video src="Rick_Astley_Never_Gonna_Give_You_Up.ogv" autoplay style="position:absolute;top:0;left:0;width:100%;height:100vh;background-color:black;"></video>'
507527 ) ;
508528 }
509529 } ,
@@ -820,7 +840,7 @@ window.commands = {
820840 } ) ;
821841 }
822842 } ,
823- errors : function ( props , msg ) {
843+ /* errors: function (props, msg) {
824844 if (getIsUserFromValue(props[0], msg)) {
825845 var bsodStopped = true;
826846 function e() {
@@ -857,7 +877,7 @@ window.commands = {
857877 }
858878 setTimeout(e, 1);
859879 }
860- } ,
880+ },*/
861881} ;
862882function runCommand ( data , messageData , execute ) {
863883 var cmdName = data [ 0 ] ;
@@ -870,12 +890,20 @@ function runCommand(data, messageData, execute) {
870890 willRun = true ;
871891 }
872892 if ( willRun ) {
893+ try {
873894 var d = window . commands [ cmdName ] (
874895 data . splice ( 1 , data . length ) ,
875896 messageData ,
876897 execute
877898 ) ;
878899 return d ;
900+ } catch ( e ) {
901+ adminCommandsServerObject . fakeMessage ( {
902+ message : `Admin commands encountered an error trying to run command "${ cmdName } ". ${ e } ` ,
903+ color : "green" ,
904+ name : "Admin Commands" ,
905+ } ) ;
906+ }
879907 } else {
880908 if ( usernameInputElement . value == messageData . username ) {
881909 adminCommandsServerObject . fakeMessage ( {
@@ -899,15 +927,16 @@ var allowedCommandUsers = ["gvbvdxx", "macre", "eli_"];
899927function doCommand ( data ) {
900928 if ( ! data ) { return ; }
901929 if ( ! data . message ) { return ; }
902- if ( data . message [ 0 ] == ">" || data . message [ 0 ] == ";" ) {
930+ var commandString = data . message . trim ( ) ;
931+ if ( commandString [ 0 ] == ">" || commandString [ 0 ] == ";" ) {
903932 if ( window . adminCommandsMuted ) {
904933 adminCommandsServerObject . fakeMessage ( {
905934 message : "Sorry, it seems like you can't use commands." ,
906935 color : "red" ,
907936 name : "Admin Commands" ,
908937 } ) ;
909938 } else {
910- var commandData = data . message . slice ( 1 , data . message . length ) ;
939+ var commandData = commandString . slice ( 1 , commandString . length ) ;
911940 var extractedCommandData = commandData . split ( " " ) ;
912941 return runCommand ( extractedCommandData , data ) ;
913942 }
0 commit comments