Skip to content

Commit ddd2df5

Browse files
committed
add join/part to api
1 parent 04d37cd commit ddd2df5

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

javascript/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"author": "Wraithan <[email protected]> (Chris McDonald)",
33
"name": "zenircbot-api",
44
"description": "API for ZenIRCBot",
5-
"version": "2.3.1",
5+
"version": "2.4.0",
66
"homepage": "http://zenircbot.rtfd.org/",
77
"repository": {
88
"type": "git",

javascript/zenircbot-api.js

+19
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,25 @@ ZenIRCBot.prototype.publish_out = function(type, to, message) {
4444
});
4545
};
4646

47+
ZenIRCBot.prototype.join_channel = function(channel) {
48+
var self = this;
49+
self.redis.publish('out', JSON.stringify({
50+
version: 1,
51+
type: 'raw',
52+
command: 'JOIN ' + channel
53+
}));
54+
};
55+
56+
ZenIRCBot.prototype.part_channel = function(channel, message) {
57+
var self = this;
58+
var message = message || 'Doing as my master bids.'
59+
self.redis.publish('out', JSON.stringify({
60+
version: 1,
61+
type: 'raw',
62+
command: 'PART ' + channel + ' :' + message
63+
}));
64+
};
65+
4766
ZenIRCBot.prototype.send_admin_message = function(message) {
4867
var self = this;
4968
self.redis.get('zenircbot:admin_spew_channels', function(err, channels) {

0 commit comments

Comments
 (0)