3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-25 04:02:39 +01:00

lowercase

This commit is contained in:
reality 2014-05-25 18:24:13 +00:00
parent 4acf17f636
commit 569265f1c7

View File

@ -5,7 +5,11 @@ var uuid = require('node-uuid'),
var api = function(dbot) { var api = function(dbot) {
var api = { var api = {
'notify': function(type, server, user, cName, message) { 'notify': function(type, server, user, cName, message) {
var id = uuid.v4(); var id = uuid.v4(),
tags = [];
_.each(message.match(/(#\w+)/g), function(match) {
tags.push(match.toLowerCase());
});
this.db.save('notifies', id, { this.db.save('notifies', id, {
'id': id, 'id': id,
'server': server, 'server': server,
@ -14,7 +18,7 @@ var api = function(dbot) {
'user': user.id, 'user': user.id,
'time': new Date().getTime(), 'time': new Date().getTime(),
'message': message, 'message': message,
'tags': message.match(/(#\w+)/g) 'tags': tags
}, function() {}); }, function() {});
var channel = dbot.instance.connections[server].channels[cName]; var channel = dbot.instance.connections[server].channels[cName];