Skip to content
This repository was archived by the owner on Jul 17, 2020. It is now read-only.

Commit bff952e

Browse files
author
Zirak
committed
fix #87
1 parent 7f1151b commit bff952e

File tree

5 files changed

+18
-16
lines changed

5 files changed

+18
-16
lines changed

bookmarklet-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(function(){var a=document.createElement("script");a.src="https://raw.github.com/Zirak/SO-ChatBot/master/master.js";a.onload=function(){bot.activateDevMode();document.head.appendChild(a)})();
1+
(function(){var a=document.createElement("script");a.src="https://raw.github.com/Zirak/SO-ChatBot/master/master.js";a.onload=function(){bot.activateDevMode();}document.head.appendChild(a)})();

master.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -891,12 +891,12 @@ var bot = window.bot = {
891891
},
892892

893893
devMode : false,
894-
activateDevMode : function (pattern) {
894+
activateDevMode : function ( pattern ) {
895895
this.devMode = true;
896896
this.invocationPattern = pattern || 'beer!';
897897
IO.events.userjoin.length = 0;
898-
this.validateMessage = function (msgObj) {
899-
return msgObj.content.trim().startsWith(this.invocationPattern);
898+
this.validateMessage = function ( msgObj ) {
899+
return msgObj.content.trim().startsWith( this.invocationPattern );
900900
};
901901
}
902902
};
@@ -1214,7 +1214,9 @@ return function ( msg, cb ) {
12141214
var worker = new Worker( code_url ),
12151215
timeout;
12161216

1217-
var code = msg.toString();
1217+
// issue #87, trim out zwsp and zwnj
1218+
var code = msg.toString().replace( /\u200b|\u200c/g, '' );
1219+
12181220
if ( code[0] === 'c' ) {
12191221
code = CoffeeScript.compile( code.replace(/^c>/, ''), {bare:1} );
12201222
}
@@ -3085,8 +3087,6 @@ bot.listen(
30853087
bot.personality.apologize, bot.personality );
30863088
bot.listen( /^bitch/i, bot.personality.bitch, bot.personality );
30873089

3088-
;
3089-
30903090
;
30913091
(function () {
30923092
var hammers = {
@@ -4012,6 +4012,8 @@ bot.addCommand({
40124012
});
40134013
})();
40144014

4015+
;
4016+
40154017
;
40164018
//listener to help decide which Firefly episode to watch
40174019

@@ -4369,8 +4371,6 @@ bot.addCommand({
43694371
async : true
43704372
});
43714373

4372-
;
4373-
43744374
;
43754375
(function () {
43764376
var nulls = [
@@ -5223,8 +5223,6 @@ IO.register( 'userregister', function tracker ( user, room ) {
52235223

52245224
})();
52255225

5226-
;
5227-
52285226
;
52295227
(function () {
52305228

@@ -5588,6 +5586,8 @@ bot.addCommand({
55885586

55895587
})();
55905588

5589+
;
5590+
55915591
;
55925592
(function () {
55935593
var specParts;

master.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/bot.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,12 @@ var bot = window.bot = {
240240
},
241241

242242
devMode : false,
243-
activateDevMode : function (pattern) {
243+
activateDevMode : function ( pattern ) {
244244
this.devMode = true;
245245
this.invocationPattern = pattern || 'beer!';
246246
IO.events.userjoin.length = 0;
247-
this.validateMessage = function (msgObj) {
248-
return msgObj.content.trim().startsWith(this.invocationPattern);
247+
this.validateMessage = function ( msgObj ) {
248+
return msgObj.content.trim().startsWith( this.invocationPattern );
249249
};
250250
}
251251
};

source/eval.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ return function ( msg, cb ) {
1818
var worker = new Worker( code_url ),
1919
timeout;
2020

21-
var code = msg.toString();
21+
// issue #87, trim out zwsp and zwnj
22+
var code = msg.toString().replace( /\u200b|\u200c/g, '' );
23+
2224
if ( code[0] === 'c' ) {
2325
code = CoffeeScript.compile( code.replace(/^c>/, ''), {bare:1} );
2426
}

0 commit comments

Comments
 (0)