Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5819c8a
Begin the port to Node JS. Bot works, around half the modules work.
fourkbomb Sep 13, 2014
ce5d897
Finish porting the second half of the modules.
fourkbomb Sep 14, 2014
a4aa2ee
Remove comments, update README.md
fourkbomb Sep 14, 2014
ee6e167
Something about "use strict" and crashes
fourkbomb Oct 4, 2014
c51a087
Fix some weirdness when a single data event contains multiple lines
fourkbomb Oct 17, 2014
092479a
Add run.sh because CLI switches are too complicated.
fourkbomb Oct 17, 2014
118f2ae
Fix flood control
fourkbomb Oct 28, 2014
f7cc5d1
Fix command things being buggy.
fourkbomb Dec 19, 2014
37a7774
todo.jsm: save todos after delete
mcpower Dec 20, 2014
9e8b274
todo.jsm: display todo indices when getting todos
mcpower Dec 21, 2014
99e35bd
todo.jsm: allow deletion of multiple todos
mcpower Dec 21, 2014
a34c051
todo.jsm: allow deletion of todos by name
mcpower Dec 21, 2014
90cbdae
updated tododel help string
mcpower Dec 21, 2014
ba0b124
todo.jsm: implemented todoins
mcpower Dec 21, 2014
b7dab05
Begin the port to Node JS. Bot works, around half the modules work.
fourkbomb Sep 13, 2014
994e0f2
Finish porting the second half of the modules.
fourkbomb Sep 14, 2014
f7f1758
Remove comments, update README.md
fourkbomb Sep 14, 2014
ac664c2
Something about "use strict" and crashes
fourkbomb Oct 4, 2014
9053b61
Fix some weirdness when a single data event contains multiple lines
fourkbomb Oct 17, 2014
60eb0cb
Add run.sh because CLI switches are too complicated.
fourkbomb Oct 17, 2014
318dc8f
Fix flood control
fourkbomb Oct 28, 2014
0e460aa
Fix command things being buggy.
fourkbomb Dec 19, 2014
ed438a1
Merge branch 'mcpower-master' into nodejs
fourkbomb Dec 24, 2014
511da4a
todo.jsm: more concise, doesn't notice people
mcpower Dec 24, 2014
1358ab5
Begin the port to Node JS. Bot works, around half the modules work.
fourkbomb Sep 13, 2014
2d73391
Finish porting the second half of the modules.
fourkbomb Sep 14, 2014
2a38364
Remove comments, update README.md
fourkbomb Sep 14, 2014
0c92c88
Something about "use strict" and crashes
fourkbomb Oct 4, 2014
68c0e97
Fix some weirdness when a single data event contains multiple lines
fourkbomb Oct 17, 2014
e4411b2
Add run.sh because CLI switches are too complicated.
fourkbomb Oct 17, 2014
8501dc5
Fix flood control
fourkbomb Oct 28, 2014
7b72132
Fix command things being buggy.
fourkbomb Dec 19, 2014
0d1187a
Merge branch 'mcpower-master' into nodejs
fourkbomb Dec 24, 2014
94368f8
Bugfixes, etc.
fourkbomb Dec 24, 2014
08076dd
Fix a bug in prefixing that crashed stuff
fourkbomb Jan 14, 2015
8b06ee0
Switch to urllib-sync: iojs compatible.
fourkbomb Jan 15, 2015
fd09e5b
Fix prefix crashes
fourkbomb Jan 14, 2015
5cc764e
Bugfixes are the best fixes
fourkbomb Jan 16, 2015
c3fb7f2
Fix HTTP requests
fourkbomb Jan 16, 2015
32bcf39
rip math.js, misc changes
fourkbomb Jul 8, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
*.log
*.json
!package.json
*.ini
*.csv
*.sqlite
*.db
.settings
.project
excuses.txt
node_modules
*~
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
aucgbot - auscompgeek's JavaScript IRC bot
==========================================

This bot is designed to be run with [JSDB](http://jsdb.org/) 1.8.0.6 or higher.
This bot is designed to be run with [NodeJS](http://nodejs.org/) 0.10.31 or higher.

It is licensed under the [Mozilla Public License v. 2.0](http://mozilla.org/MPL/2.0/).

Expand Down Expand Up @@ -69,15 +69,17 @@ Basic usage
-----------

``` javascript
run("aucgbot.js");
require("aucgbot.js");
aucgbot.prefs[pref] = setting;
aucgbot.loadModule("helloworld");
aucgbot.start([hostname, port, nick, ident, pass, channels]...);
```

Note that the bot should be run using `node --harmony --use-strict`.

The above can be run from a script, not just from a jsdb prompt.
I don't recommend storing passwords on disk however.
Running `./start-aucgbot` will prompt for modules and each server property.
Editing `./start-aucgbot` and then running it will launch the bot.

License
-------
Expand Down
10 changes: 5 additions & 5 deletions acidtrip.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*global module: false */
/*global module.exports: false */

module.version = "0.2 (2013-10-26)";
module.cmd_acidtrip = function cmd_acidtrip(e) {
module.exports.version = "0.2 (2013-10-26)";
module.exports.cmd_acidtrip = function cmd_acidtrip(e) {
var s = '', msg = e.args,
maxi = Math.ceil(msg.length / 60),
last = msg.length % 60,
lastIndex = 0;
lastIndex = 0, mlen = 0, fg = 0, bg = 0;
for (var j = 0; j < maxi; j++) {
mlen = 60;
if (j + 1 == maxi) {
Expand All @@ -25,7 +25,7 @@ module.cmd_acidtrip = function cmd_acidtrip(e) {
if (bg < 10) {
bg = '0' + bg;
}
s += '\003' + fg + ',' + bg + msg[i];
s += '\x03' + fg + ',' + bg + msg[i];
}
e.conn.msg(e.dest, s);
lastIndex += mlen;
Expand Down
67 changes: 54 additions & 13 deletions aucgbot-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

run("es5-shim.js");

if (typeof randint !== "function")
/* jshint eqnull: true */
"use strict";
if (typeof global.randint !== "function")
/**
* Generate a psuedo-random integer. Similar to Python's random.randint method.
*
* @param {number} [min] Minimum number (default: 1).
* @param {number} [max] Maximum number (default: 10).
* @return {number} Random integer.
*/
randint = function randint(min, max) {
global.randint = function randint(min, max) {
min = min != null ? +min : 1;
max = max != null ? +max : 10;
if (min >= max)
Expand Down Expand Up @@ -62,7 +61,7 @@ if (typeof String.prototype.contains !== "function")
* @return {Boolean} Whether the string contains the substring.
*/
String.prototype.contains = function contains(s, pos) {
//"use asm";
"use asm";
s = s + "";
pos = pos | 0;
var S = this + "";
Expand All @@ -79,23 +78,65 @@ if (typeof String.prototype.startsWith !== "function")
* @return {Boolean} Whether the string starts with the substring.
*/
String.prototype.startsWith = function startsWith(s, pos) {
//"use asm";
"use asm";
s = s + "";
pos = pos | 0;
var S = this + "";
//return S.indexOf(s, pos) === pos;
return S.substr(pos, s.length) === s;
};

if (typeof Object.keys !== "function")
Object.keys = function keys(o) {
var a = [];
for (var i in o) {
if (Object.hasOwnProperty(o, i))
a.push(i);
}
return a;
};

if (typeof Object.is !== "function")
Object.is = function is(x, y) {
return x === y ? x !== 0 || 1 / x == 1 / y : x !== x && y !== y;
};


if (typeof Array.slice !== "function")
Array.slice = function (obj, start, end) {
var res = [];
for (let i in obj) {
if (obj.hasOwnProperty(i)) {
res.push(obj[i]);
}
}
return res.slice(start, end);
};

if (typeof Array.join !== "function")
Array.join = function (args, sep) {
var res = [];
for (let i in args) {
if (args.hasOwnProperty(i)) {
res.push(args[i]);
}
}
return res.join(sep);
};

global.encodeUTF8 = function(a) {
return a;
};

global.encodeB64 = function(a) {
return new Buffer(a).toString("base64");
};

global.decodeB64 = function(a) {
return new Buffer(a, "base64").toString("utf8");
};
// and now, for something completely different
if (typeof btoa !== "function" && typeof encodeB64 === "function") {
btoa = encodeB64;
}
if (typeof atob !== "function" && typeof decodeB64 === "function") {
atob = decodeB64;
}
if (typeof btoa !== "function" && typeof encodeB64 === "function")
global.btoa = encodeB64;
if (typeof atob !== "function" && typeof decodeB64 === "function")
global.atob = decodeB64;
Loading