diff --git a/modules/command/api.js b/modules/command/api.js index e19927e..4cf92a9 100644 --- a/modules/command/api.js +++ b/modules/command/api.js @@ -9,7 +9,10 @@ var api = function(dbot) { var accessNeeded = dbot.commands[command].access; if(accessNeeded == 'admin' || accessNeeded == 'moderator') { - if(!_.include(dbot.config[accessNeeded + 's'], user)) { // lol + var allowedNicks = dbot.config.admins; + if(accessNeeded == 'moderator') allowedNicks = _.union(allowedNicks, dbot.config.moderators); + + if(!_.include(allowedNicks, user)) { callback(false); } else { if(_.has(dbot.modules, 'nickserv') && this.config.useNickserv == true) { diff --git a/modules/flashy/README.md b/modules/flashy/README.md new file mode 100644 index 0000000..2ed5530 --- /dev/null +++ b/modules/flashy/README.md @@ -0,0 +1,9 @@ +## Flashy + +Make big flashy text at people. + +### Commands + +#### ~flashy [color] [message] +Give a link to a page hosted by the flashy module which produces big flashing +text in the given colour. diff --git a/modules/flashy/config.json b/modules/flashy/config.json new file mode 100644 index 0000000..39287b4 --- /dev/null +++ b/modules/flashy/config.json @@ -0,0 +1,3 @@ +{ + "help": "https://github.com/reality/depressionbot/blob/master/modules/flashy/README.md" +} diff --git a/modules/kick/commands.js b/modules/kick/commands.js index a3dd294..d5cd3b3 100644 --- a/modules/kick/commands.js +++ b/modules/kick/commands.js @@ -1,6 +1,9 @@ +var _ = require('underscore')._; + var commands = function(dbot) { var commands = { /*** Kick Management ***/ + '~ckick': function(event) { var server = event.server, kicker = event.user, @@ -9,7 +12,8 @@ var commands = function(dbot) { reason = event.input[3]; this.api.kick(server, kickee, channel, reason + ' (requested by ' + kicker + ')'); - dbot.api.report.notify(server, channel, kicker, kickee, dbot.t('ckicked', { + + dbot.api.report.notify(server, channel, dbot.t('ckicked', { 'kicker': kicker, 'kickee': kickee, 'channel': channel, @@ -17,6 +21,95 @@ var commands = function(dbot) { })); }, + '~cban': function(event) { + var server = event.server, + banner = event.user, + banee = event.input[2], + channel = event.input[1], + reason = event.input[3]; + + this.api.ban(server, banee, channel); + this.api.kick(server, kickee, channel, reason + ' (requested by ' + banner + ')'); + + dbot.api.report.notify(server, channel, dbot.t('cbanned', { + 'banner': banner, + 'banee': banee, + 'channel': channel, + 'reason': reason + })); + }, + + /*'~cquiet': function(event) { + var server = event.server, + quieter = event.user, + quietee = event.input[2], + channel = event.input[1], + reason = event.input[3]; + + this.api.quiet(server, quietee, channel); + + dbot.api.report(server, channel, dbot.t('cquieted', { + 'quieter': quieter, + 'quietee': quietee, + 'channel': channel, + 'reason': reason + })); + }, + + '~nquiet': function(event) { + var server = event.server, + quieter = event.user, + quietee = event.input[1], + channels = dbot.config.servers[server].channels, + reason = event.input[2]; + + _.each(channels, function(channel) { + this.api.quiet(server, quietee, channel); + }, this); + + dbot.api.report(server, channel, dbot.t('nquieted', { + 'quieter': quieter, + 'quietee': quietee, + 'reason': reason + })); + },*/ + + // Kick and ban from all channels on the network. + '~nban': function(event) { + var server = event.server, + banner = event.user, + banee = event.input[1], + reason = event.input[2], + channels = dbot.config.servers[server].channels; + + _.each(channels, function(channel) { + this.api.ban(server, banee, channel); + this.api.kick(server, banee, channel, reason + + ' (network-wide ban requested by ' + banner + ')'); + }, this); + + var notifyString = dbot.t('nbanned', { + 'banner': banner, + 'banee': banee, + 'reason': reason + }); + + // TODO: When this is merged into database branch, have it use the + // api.quotes.addQuote function + if(this.config.document_bans && _.has(dbot.modules, 'quotes')) { + dbot.db.quoteArrs['ban_' + banee] = [ dbot.t('nban_quote', { + 'banee': banee, + 'banner': banner, + 'time': new Date().toUTCString(), + 'reason': reason + }) ]; + + notifyString += ' ' + dbot.t('quote_recorded', { 'user': banee }); + } + + dbot.api.report.notify(server, this.config.admin_channels[event.server], notifyString); + }, + /*** Kick Stats ***/ // Give the number of times a given user has been kicked and has kicked @@ -67,8 +160,12 @@ var commands = function(dbot) { } }; - commands['~ckick'].access = 'moderator'; + _.each(commands, function(command) { + command.access = 'moderator'; + }); + commands['~ckick'].regex = [/^~ckick ([^ ]+) ([^ ]+) (.+)$/, 4]; + commands['~nban'].regex = [/^~nban ([^ ]+) (.+)$/, 3]; return commands; }; diff --git a/modules/kick/config.json b/modules/kick/config.json index c32561f..bf4cd1d 100644 --- a/modules/kick/config.json +++ b/modules/kick/config.json @@ -4,5 +4,9 @@ "help": "http://github.com/reality/depressionbot/blob/master/modules/kick/README.md", "ignorable": true, "countSilently": true, - "chanserv": "ChanServ" + "admin_channels": { + "aberwiki": "#fishbox" + }, + "chanserv": "ChanServ", + "document_bans": false } diff --git a/modules/kick/strings.json b/modules/kick/strings.json index 6764552..f71fd0e 100644 --- a/modules/kick/strings.json +++ b/modules/kick/strings.json @@ -13,8 +13,17 @@ "cy": "Ni ddylech cicio {botname}" }, "ckicked": { - "en": "Attention: {kicker} has kicked {kickee} from {channel}. The reason given was: \"{reason}.\"" + "en": "Attention: {kicker} has kicked {kickee} from {channel}. The reason given was: \"{reason}.\"", "cy": "Ni ddylech cicio {botname}", "nl": "Gij zult {botname} niet kicken" + }, + "nbanned": { + "en": "Attention: {banner} has banned {banee} network-wide. The reason given was \"{reason}.\"" + }, + "nban_quote": { + "en": "{banee} was banned from the network by {banner} on {time}. The reason given was \"{reason}.\"" + }, + "quote_recorded": { + "en": "This has been recorded in ~ban_{user}." } } diff --git a/modules/nickserv/README.md b/modules/nickserv/README.md new file mode 100644 index 0000000..93c0ebe --- /dev/null +++ b/modules/nickserv/README.md @@ -0,0 +1,41 @@ +## Nickserv + +Check nick authentication with nickserv. + +### Description + +This module provides an API function which allows you to check the +authentication status of a given nick. This is useful for checking that someone +is actually who they say they are, and not an imposter; for example, this API +function will be used in the command module to check if a user is authed before +running commands which require elevated access (if the useNickserv configuration +option is set). + +### Configuration + +#### Servers + +This is a data structure which allows you to define the data behaviour for +nickservs on various different servers. + + _nc_: { + _matcher_: This is a regular expression which will be used to match login + status responses from nickserv. + _acceptableState_: The numeric response from nickserv which will be + accepted as meaning the user is authenticated. + _infoCommand_: The command to be sent to nickserv inquiring about user + authentication status. + } + +The server name should match that of the one configured in the main DBot +config.json file. Also note that the name of the services bot these commands +will be sent to will also be taken from the 'nickserv' configuration option in +the server definition in the main config file. + +### API + +#### auth(server, nick, callback) +This will send a message to the configured nickserv bot inquiring as to the +login status of the given user. The callback will be called with one argument, +true or false depending on the nickserv's response as to whether the nick is +authed or not. diff --git a/modules/nickserv/config.json b/modules/nickserv/config.json index 3bcaece..06ef457 100644 --- a/modules/nickserv/config.json +++ b/modules/nickserv/config.json @@ -5,5 +5,6 @@ "acceptableState": 3, "infoCommand": "status" } - } + }, + "help": "https://github.com/reality/depressionbot/blob/master/modules/nickserv/README.md" } diff --git a/modules/report/report.js b/modules/report/report.js index 9c7953b..1f545df 100644 --- a/modules/report/report.js +++ b/modules/report/report.js @@ -2,7 +2,7 @@ var _ = require('underscore')._; var report = function(dbot) { this.api = { - 'notify': function(server, channel, reporter, reported, message) { + 'notify': function(server, channel, message) { var channel = dbot.instance.connections[server].channels[channel]; var ops = _.filter(channel.nicks, function(user) { if(this.config.notifyVoice) { @@ -27,7 +27,7 @@ var report = function(dbot) { if(_.has(event.allChannels, channelName)) { if(dbot.api.users.isChannelUser(event.server, nick, channelName, true)) { nick = dbot.api.users.resolveUser(event.server, nick, true); - this.api.notify(event.server, channelName, event.user, nick, dbot.t('report', { + this.api.notify(event.server, channelName, dbot.t('report', { 'reporter': event.user, 'reported': nick, 'channel': channelName, diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..b402290 Binary files /dev/null and b/public/favicon.ico differ diff --git a/views/layout.jade b/views/layout.jade index ad2d14e..c7b9b65 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -6,6 +6,7 @@ html(lang='en') link(rel="stylesheet", type="text/css", href="http://fonts.googleapis.com/css?family=Source+Sans+Pro") link(rel="stylesheet", type="text/css", href="/bootstrap/css/bootstrap.min.css") link(rel='stylesheet', type='text/css', href='/styles.css') + link(rel='shortcut icon', type='image/png', href='/favicon.ico') title #{name} web interface body div.container