- case m.params
- when /^set\s+(.+?)\s+(is|are)\s+(.+)$/
- keyword_command(m, $1, $2, $3) if @bot.auth.allow?('keycmd', m.source, m.replyto)
- when /^forget\s+(.+)$/
- keyword_forget(m, $1) if @bot.auth.allow?('keycmd', m.source, m.replyto)
- when /^lookup\s+(.+)$/
- keyword_lookup(m, $1) if @bot.auth.allow?('keyword', m.source, m.replyto)
- when /^stats\s*$/
- keyword_stats(m) if @bot.auth.allow?('keyword', m.source, m.replyto)
- when /^search\s+(.+)$/
- key = $1
- full = key.sub!('--full ', '')
- all = key.sub!('--all ', '')
- keyword_search(m, key, full, all) if @bot.auth.allow?('keyword', m.source, m.replyto)
- when /^tell\s+(\S+)\s+about\s+(.+)$/
- keyword_tell(m, $1, $2) if @bot.auth.allow?('keyword', m.source, m.replyto)
- else
- keyword_lookup(m, m.params) if @bot.auth.allow?('keyword', m.source, m.replyto)
+ case m.plugin
+ when "keyword"
+ case m.params
+ when /^set\s+(.+?)\s+(is|are)\s+(.+)$/
+ keyword_command(m, $1, $2, $3) if @bot.auth.allow?('keycmd', m.source, m.replyto)
+ when /^forget\s+(.+)$/
+ keyword_forget(m, $1) if @bot.auth.allow?('keycmd', m.source, m.replyto)
+ when /^lookup\s+(.+)$/
+ keyword_lookup(m, $1) if @bot.auth.allow?('keyword', m.source, m.replyto)
+ when /^stats\s*$/
+ keyword_stats(m) if @bot.auth.allow?('keyword', m.source, m.replyto)
+ when /^search\s+(.+)$/
+ key = $1
+ full = key.sub!('--full ', '')
+ all = key.sub!('--all ', '')
+ if key.sub!(/--from (\d+) /, '')
+ from = $1.to_i
+ else
+ from = 1
+ end
+ from = 1 unless from > 0
+ keyword_search(m, key, full, all, from) if @bot.auth.allow?('keyword', m.source, m.replyto)
+ when /^tell\s+(\S+)\s+about\s+(.+)$/
+ keyword_tell(m, $1, $2) if @bot.auth.allow?('keyword', m.source, m.replyto)
+ else
+ keyword_lookup(m, m.params) if @bot.auth.allow?('keyword', m.source, m.replyto)
+ end
+ when "forget"
+ keyword_forget(m, m.params) if @bot.auth.allow?('keycmd', m.source, m.replyto)
+ when "tell"
+ if m.params =~ /(\S+)\s+about\s+(.+)$/
+ keyword_tell(m, $1, $2) if @bot.auth.allow?('keyword', m.source, m.replyto)
+ else
+ m.reply "wrong 'tell' syntax"
+ end
+ when "learn"
+ if m.params =~ /^that\s+(.+?)\s+(is|are)\s+(.+)$/
+ keyword_command(m, $1, $2, $3) if @bot.auth.allow?('keycmd', m.source, m.replyto)
+ else
+ m.reply "wrong 'learn' syntax"
+ end