diff --git a/modules/quotes/commands.js b/modules/quotes/commands.js new file mode 100644 index 0000000..c6061ad --- /dev/null +++ b/modules/quotes/commands.js @@ -0,0 +1,235 @@ +var _ = require('underscore')._; + +var commands = function(dbot) { + var commands = { + // Alternative syntax to ~q + '~': function(event) { + commands['~q'].bind(this)(event); + }, + + '~rmstatus': function(event) { + var rmCacheCount = this.rmCache.length; + if(rmCacheCount < dbot.config.quotes.rmLimit) { + event.reply(dbot.t('quote_cache_auto_remove', + { 'count': rmCacheCount })); + } else { + event.reply(dbot.t('quote_cache_manual_remove', + { 'count': rmCacheCount })); + } + }, + + '~rmconfirm': function(event) { + var rmCacheCount = this.rmCache.length; + this.rmCache.length = 0; + event.reply(dbot.t('quote_cache_cleared', + { 'count': rmCacheCount })); + }, + + '~rmdeny': function(event) { + var quotes = this.quotes; + var rmCache = this.rmCache; + var rmCacheCount = rmCache.length; + for(var i=0;i