Only known users can add quotes

May not work due to callback inside dbot.users.api.isKnownUser(…)
This commit is contained in:
thoso 2014-02-20 06:32:46 +01:00
parent df87621241
commit f21745305e
2 changed files with 9 additions and 1 deletions

View File

@ -11,6 +11,10 @@ var commands = function(dbot) {
var key = event.input[1].toLowerCase().trim(),
quote = event.input[2];
var server=event.server,
user=event.rUser;
if (dbot.users.api.isKnownUser(server,user,function(x) {return x})==true)
{
this.api.addQuote(key, quote, event.user, function(newCount) {
if(newCount) {
dbot.api.event.emit('~qadd', [ key, quote ]);
@ -22,6 +26,10 @@ var commands = function(dbot) {
event.reply(dbot.t('quote_exists'));
}
});
}
else{
event.reply(dbot.t('You have no permissions to add quotes. :('));
}
},
/*** Quote Retrieval ***/

View File

@ -1,6 +1,6 @@
{
"ignorable": false,
"dependencies": [ "event" ],
"dependencies": [ "event" , "users"],
"dbKeys": [ "knownUsers" ],
"dbType": "redis"
}