Skip to content
This repository
  • 1 commit
  • 5 files changed
  • 0 comments
  • 1 contributor
2  bookmarklet.js
... ...
@@ -1 +1 @@
1  
-(function(){var a=document.createElement("script");a.src="https://raw.github.com/Titani/SO-ChatBot/master/master.js",document.head.appendChild(a)})()
  1
+(function(){var a=document.createElement("script");a.src="https://raw.github.com/Zirak/SO-ChatBot/master/master.js",document.head.appendChild(a)})()
19  master.js
@@ -48,9 +48,7 @@ var IO = window.IO = {
48 48
 		function fireEvent( evt ) {
49 49
 			var call = evt.fun.apply( evt.thisArg, evt.args.concat(args) );
50 50
 
51  
-			if ( call === false ) {
52  
-				that.preventDefault = true;
53  
-			}
  51
+			that.preventDefault = call === false;
54 52
 		}
55 53
 	},
56 54
 
@@ -5088,8 +5086,8 @@ bot.addCommand({
5088 5086
 ;
5089 5087
 
5090 5088
 ;
5091  
-/*global bot:true, IO:true */
5092 5089
 (function () {
  5090
+
5093 5091
 //collection of nudges; msgObj, time left and the message itself
5094 5092
 var nudges = [],
5095 5093
 	interval = bot.adapter.in.interval || 5000;
@@ -5140,7 +5138,7 @@ function addNudge ( delay, msg, msgObj ) {
5140 5138
 
5141 5139
 	var nudge = {
5142 5140
 		msgObj  : msgObj,
5143  
-		message : msg || '*nudge*',
  5141
+		message : '*nudge*' + ( msg || '' ),
5144 5142
 		register: Date.now(),
5145 5143
 		time    : inMS
5146 5144
 	};
@@ -5159,7 +5157,7 @@ bot.addCommand({
5159 5157
 
5160 5158
 	description : 'Register a nudge after an interval. ' +
5161 5159
 		'`/nudge intervalInMinutes message`, or the listener, ' +
5162  
-		'`nudge|remind|poke me? in? intervalInMinutes message'
  5160
+		'`nudge|remind|poke me? in? intervalInMinutes message`'
5163 5161
 });
5164 5162
 
5165 5163
 bot.listen(/(?:nudge|remind|poke)\s(?:me\s)?(?:in\s)?(\d+m?)\s?(.*)$/,
@@ -5899,6 +5897,15 @@ bot.addCommand({
5899 5897
 ;
5900 5898
 
5901 5899
 ;
  5900
+IO.register( 'input', function ( msgObj ) {
  5901
+	var content = msgObj.content.toUpperCase().match( /\w+/ )[ 0 ];
  5902
+
  5903
+	if ( content === 'STOP' ) {
  5904
+		bot.adapter.out.add( 'HAMMERTIME!', msgObj.room_id );
  5905
+	}
  5906
+});
  5907
+
  5908
+;
5902 5909
 (function () {
5903 5910
 var list = JSON.parse( localStorage.getItem('bot_todo') || '{}' ),
5904 5911
 
4  source/bot.js
@@ -48,9 +48,7 @@ var IO = window.IO = {
48 48
 		function fireEvent( evt ) {
49 49
 			var call = evt.fun.apply( evt.thisArg, evt.args.concat(args) );
50 50
 
51  
-			if ( call === false ) {
52  
-				that.preventDefault = true;
53  
-			}
  51
+			that.preventDefault = call === false;
54 52
 		}
55 53
 	},
56 54
 
7  source/plugins/STOP.js
... ...
@@ -0,0 +1,7 @@
  1
+IO.register( 'input', function ( msgObj ) {
  2
+	var content = msgObj.content.toUpperCase().match( /\w+/ )[ 0 ];
  3
+
  4
+	if ( content === 'STOP' ) {
  5
+		bot.adapter.out.add( 'HAMMERTIME!', msgObj.room_id );
  6
+	}
  7
+});
6  source/plugins/nudge.js
... ...
@@ -1,5 +1,5 @@
1  
-/*global bot:true, IO:true */
2 1
 (function () {
  2
+
3 3
 //collection of nudges; msgObj, time left and the message itself
4 4
 var nudges = [],
5 5
 	interval = bot.adapter.in.interval || 5000;
@@ -50,7 +50,7 @@ function addNudge ( delay, msg, msgObj ) {
50 50
 
51 51
 	var nudge = {
52 52
 		msgObj  : msgObj,
53  
-		message : msg || '*nudge*',
  53
+		message : '*nudge*' + ( msg || '' ),
54 54
 		register: Date.now(),
55 55
 		time    : inMS
56 56
 	};
@@ -69,7 +69,7 @@ bot.addCommand({
69 69
 
70 70
 	description : 'Register a nudge after an interval. ' +
71 71
 		'`/nudge intervalInMinutes message`, or the listener, ' +
72  
-		'`nudge|remind|poke me? in? intervalInMinutes message'
  72
+		'`nudge|remind|poke me? in? intervalInMinutes message`'
73 73
 });
74 74
 
75 75
 bot.listen(/(?:nudge|remind|poke)\s(?:me\s)?(?:in\s)?(\d+m?)\s?(.*)$/,

No commit comments for this range

Something went wrong with that request. Please try again.