summaryrefslogtreecommitdiff
path: root/data/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-11-04 21:51:49 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-11-04 21:51:49 +0000
commitde9ddb8a7eb436c0cb8db81289373dc169f484ba (patch)
treeabf763e13286b0dcc6708c38b2a3290dd4149553 /data/rbot
parentb0c7f5f17b65043a796f8b3f4dc27cbfa287e087 (diff)
keywords plugin: keyword wipe command to remove unforgettable keywords
Diffstat (limited to 'data/rbot')
-rw-r--r--data/rbot/plugins/keywords.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/data/rbot/plugins/keywords.rb b/data/rbot/plugins/keywords.rb
index 3cf19599..5ed52565 100644
--- a/data/rbot/plugins/keywords.rb
+++ b/data/rbot/plugins/keywords.rb
@@ -450,6 +450,18 @@ class Keywords < Plugin
end
end
+ # low-level keyword wipe command for when forget doesn't work
+ def keyword_wipe(m, key)
+ reg = @keywords.registry
+ reg.env.begin(reg) { |t, b|
+ b.delete_if { |k, v|
+ (k == key) && (m.reply "wiping keyword #{key} with stored value #{Marshal.restore(v)}")
+ }
+ t.commit
+ }
+ m.reply "done"
+ end
+
# export keywords to factoids file
def keyword_factoids_export
ar = Array.new
@@ -489,6 +501,8 @@ class Keywords < Plugin
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 /^wipe\s(.+)$/ # note that only one space is stripped, allowing removal of space-prefixed keywords
+ keyword_wipe(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*$/