Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * General commands
- *
- * Add custom commands here.
- */
- tell: 'say',
- say: function(arg, by, room, con) {
- if (!this.canUse('say', room, by)) return false;
- this.say(con, room, stripCommands(arg) + ' (' + by + ' said this)');
- },
- joke: function(arg, by, room, con) {
- if (!this.canUse('joke', room, by) || room.charAt(0) === ',') return false;
- var self = this;
- var reqOpt = {
- hostname: 'api.icndb.com',
- path: '/jokes/random',
- method: 'GET'
- };
- var req = http.request(reqOpt, function(res) {
- res.on('data', function(chunk) {
- try {
- var data = JSON.parse(chunk);
- self.say(con, room, data.value.joke.replace(/"/g, "\""));
- } catch (e) {
- self.say(con, room, 'Sorry, couldn\'t fetch a random joke... :(');
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement