mirror of
https://github.com/reality/dbot.git
synced 2024-11-23 20:39:25 +01:00
fixed kick
This commit is contained in:
parent
df4c7a0e24
commit
013908d6b2
9
admin.js
9
admin.js
@ -4,22 +4,21 @@ var adminCommands = function(dbot) {
|
|||||||
var commands = {
|
var commands = {
|
||||||
'join': function(data, params) {
|
'join': function(data, params) {
|
||||||
dbot.join(params[1]);
|
dbot.join(params[1]);
|
||||||
dbot.say(admin, 'Joined ' + params[1]);
|
dbot.say(dbot.admin, 'Joined ' + params[1]);
|
||||||
},
|
},
|
||||||
|
|
||||||
'part': function(data, params) {
|
'part': function(data, params) {
|
||||||
dbot.part(params[1]);
|
dbot.part(params[1]);
|
||||||
dbot.say(admin);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
'reload': function(data, params) {
|
'reload': function(data, params) {
|
||||||
dbot.say(admin, 'Reloading DB.');
|
dbot.say(dbot.admin, 'Reloading DB.');
|
||||||
try {
|
try {
|
||||||
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
|
dbot.db = JSON.parse(fs.readFileSync('db.json', 'utf-8'));
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
dbot.say(admin, 'DB reload failed.');
|
dbot.say(dbot.admin, 'DB reload failed.');
|
||||||
} finally {
|
} finally {
|
||||||
dbot.say(admin, 'DB Reload successful.');
|
dbot.say(dbot.admin, 'DB Reload successful.');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
6
kick.js
6
kick.js
@ -1,12 +1,14 @@
|
|||||||
var kick = function(dbot) {
|
var kick = function(dbot) {
|
||||||
|
var dbot = dbot;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'listener': function(data) {
|
'listener': function(data) {
|
||||||
if(data.kickee == dbot.name) {
|
if(data.kickee == dbot.name) {
|
||||||
dbot.instance.join(data.channel); // make interface
|
dbot.instance.join(data.channel); // TODO: make interface
|
||||||
dbot.say(data.channel, 'Thou shalt not kick ' + dbot.name);
|
dbot.say(data.channel, 'Thou shalt not kick ' + dbot.name);
|
||||||
dbot.db.kicks[name] += 1;
|
dbot.db.kicks[name] += 1;
|
||||||
} else {
|
} else {
|
||||||
if(dbot.db.kicks[data.kickee] == undefined) {
|
if(dbot.db.kicks.hasOwnProperty(data.kickee)) {
|
||||||
dbot.db.kicks[data.kickee] = 1;
|
dbot.db.kicks[data.kickee] = 1;
|
||||||
} else {
|
} else {
|
||||||
dbot.db.kicks[data.kickee] += 1;
|
dbot.db.kicks[data.kickee] += 1;
|
||||||
|
2
puns.js
2
puns.js
@ -7,7 +7,7 @@ var puns = function(dbot) {
|
|||||||
dbot.say(data.channel, dbot.db.quoteArrs.lamp.random());
|
dbot.say(data.channel, dbot.db.quoteArrs.lamp.random());
|
||||||
} else if(data.user == 'reality') {
|
} else if(data.user == 'reality') {
|
||||||
dbot.instance.say(data.channel, dbot.db.realiPuns.random());
|
dbot.instance.say(data.channel, dbot.db.realiPuns.random());
|
||||||
} else if(instance.inChannel(data.channel)) {
|
} else if(dbot.instance.inChannel(data.channel)) {
|
||||||
dbot.instance.say('aisbot', '.karma ' + data.user);
|
dbot.instance.say('aisbot', '.karma ' + data.user);
|
||||||
dbot.waitingForKarma = data.channel;
|
dbot.waitingForKarma = data.channel;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user