Created
February 10, 2014 18:38
-
-
Save whiskers75/8921603 to your computer and use it in GitHub Desktop.
protect plugin for fluxbot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
coffee = require 'coffee-script/register' | |
Command = require '../command.coffee' | |
Protect = {} | |
Protect.name = 'protect' | |
Protect.modify = (g) => | |
g.bot.on 'part', (chan, nick) => | |
bot.join '#botwar' | |
g.bot.on 'join', (chan, nick, raw) => | |
g.db.smembers 'protected', (err, res) => | |
if res.indexOf(nick) != -1 | |
g.bot.send 'REMOVE', chan, nick, 'You are on the fluxbot banlist.' | |
else | |
g.db.smembers 'hbans', (err, res) => | |
res.forEach (host) => | |
if raw.host.indexOf(host) != -1 | |
g.bot.send 'REMOVE', chan, nick, 'You are on the fluxbot banlist.' | |
g.bot.on '-mode', (chan, user, mode, arg) => | |
if arg == g.config.nick && mode == 'o' | |
g.bot.say 'ChanServ', 'OP ' + chan + ' ' + g.config.nick | |
g.bot.send 'REMOVE', chan, user, 'Deopping fluxbot is violation of intergalactic law and will not be tolerated!' | |
Protect.commands = {} | |
Protect.commands.padd = new Command {args: 1, perm: 'protect'}, (g, m, u, t) => | |
if m[0] == 'whiskers75' || m[0] == g.config.nick | |
return g.bot.send 'REMOVE', t, u, 'pls' | |
g.bot.send 'REMOVE', t, m[0], 'You have been banned. Do not try to reconnect, it will just cause spam.' | |
g.db.sadd 'protected', m[0], (err, res) => | |
if !err | |
db.smembers 'protected', (err, res) => | |
g.bot.say t, 'Banned users: ' + res.join(' ') | |
Protect.commands.prem = new Command {args: 1, perm: 'protect'}, (g, m, u, t) => | |
g.db.srem 'protected', m[0], (err, res) => | |
if !err | |
db.smembers 'protected', (err, res) => | |
g.bot.say t, 'Banned users: ' + res.join(' ') | |
Protect.commands.plist = new Command {perm: 'protect'}, (g, m, u, t) => | |
g.db.smembers 'protected', (err, res) => | |
g.bot.say t, 'Banned users: ' + res.join(' ') | |
Protect.commands.hadd = new Command {args: 1, perm: 'protect'}, (g, m, u, t) => | |
g.db.sadd 'hbans', m[0], (err, res) => | |
if !err | |
db.smembers 'protected', (err, res) => | |
g.bot.say t, 'Banned hosts: ' + res.join(' ') | |
Protect.commands.hrem = new Command {args: 1, perm: 'protect'}, (g, m, u, t) => | |
g.db.srem 'hbans', m[0], (err, res) => | |
if !err | |
db.smembers 'protected', (err, res) => | |
g.bot.say t, 'Banned hosts: ' + res.join(' ') | |
Protect.commands.hlist = new Command {perm: 'protect'}, (g, m, u, t) => | |
g.db.smembers 'hbans', (err, res) => | |
g.bot.say t, 'Banned hosts: ' + res.join(' ') | |
module.exports = Protect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment