3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-30 16:09:27 +01:00

Merge git://github.com/reality/depressionbot into database

This commit is contained in:
reality 2013-05-10 18:13:41 +00:00
commit 41ec896dfc
11 changed files with 176 additions and 8 deletions

View File

@ -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) {

9
modules/flashy/README.md Normal file
View File

@ -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.

View File

@ -0,0 +1,3 @@
{
"help": "https://github.com/reality/depressionbot/blob/master/modules/flashy/README.md"
}

View File

@ -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;
};

View File

@ -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
}

View File

@ -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}."
}
}

View File

@ -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.

View File

@ -5,5 +5,6 @@
"acceptableState": 3,
"infoCommand": "status"
}
}
},
"help": "https://github.com/reality/depressionbot/blob/master/modules/nickserv/README.md"
}

View File

@ -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,

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View File

@ -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