rbot 0.9.10 → 0.9.12
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +22 -4
- data/COPYING +5 -18
- data/ChangeLog +396 -0
- data/README +23 -25
- data/REQUIREMENTS +58 -12
- data/Rakefile +215 -0
- data/bin/rbot +47 -25
- data/bin/rbot-remote +76 -0
- data/data/rbot/languages/french.lang +5 -5
- data/data/rbot/languages/german.lang +4 -4
- data/data/rbot/languages/italian.lang +53 -0
- data/data/rbot/languages/japanese.lang +43 -0
- data/data/rbot/languages/russian.lang +60 -60
- data/data/rbot/languages/traditional_chinese.lang +75 -0
- data/data/rbot/plugins/alias.rb +192 -0
- data/data/rbot/plugins/autoop.rb +74 -37
- data/data/rbot/plugins/autorejoin.rb +15 -5
- data/data/rbot/plugins/bans.rb +454 -150
- data/data/rbot/plugins/bash.rb +173 -31
- data/data/rbot/plugins/botsnack.rb +37 -0
- data/data/rbot/plugins/cal.rb +11 -2
- data/data/rbot/plugins/chanserv.rb +132 -0
- data/data/rbot/plugins/chucknorris.rb +2 -2
- data/data/rbot/plugins/chucknorris.yml.gz +0 -0
- data/data/rbot/plugins/debugger.rb +136 -0
- data/data/rbot/plugins/deepthoughts.rb +89 -95
- data/data/rbot/plugins/delicious.rb +109 -0
- data/data/rbot/plugins/dice.rb +77 -25
- data/data/rbot/plugins/dict.rb +243 -0
- data/data/rbot/plugins/dictclient.rb +211 -0
- data/data/rbot/plugins/digg.rb +2 -2
- data/data/rbot/plugins/excuse.rb +4 -4
- data/data/rbot/plugins/factoids.rb +506 -0
- data/data/rbot/plugins/figlet.rb +127 -18
- data/data/rbot/plugins/fish.rb +93 -33
- data/data/rbot/plugins/forecast.rb +40 -27
- data/data/rbot/plugins/fortune.rb +86 -11
- data/data/rbot/plugins/freshmeat.rb +46 -12
- data/data/rbot/plugins/games/azgame.rb +565 -0
- data/data/rbot/plugins/games/quiz.rb +961 -0
- data/data/rbot/plugins/games/roshambo.rb +62 -0
- data/data/rbot/plugins/{roulette.rb → games/roulette.rb} +58 -8
- data/data/rbot/plugins/games/shiritori.rb +485 -0
- data/data/rbot/plugins/games/uno.rb +1205 -0
- data/data/rbot/plugins/games/wheelfortune.rb +615 -0
- data/data/rbot/plugins/grouphug.rb +76 -22
- data/data/rbot/plugins/hl2.rb +97 -0
- data/data/rbot/plugins/host.rb +10 -1
- data/data/rbot/plugins/httpd.rb.disabled +1 -0
- data/data/rbot/plugins/imdb.rb +511 -47
- data/data/rbot/plugins/insult.rb +32 -37
- data/data/rbot/plugins/iplookup.rb +224 -224
- data/data/rbot/plugins/karma.rb +45 -21
- data/data/rbot/plugins/keywords.rb +258 -160
- data/data/rbot/plugins/lart.rb +126 -95
- data/data/rbot/plugins/lastfm.rb +421 -12
- data/data/rbot/plugins/linkbot.rb +75 -0
- data/data/rbot/plugins/markov.rb +103 -46
- data/data/rbot/plugins/math.rb +6 -5
- data/data/rbot/plugins/modes.rb +114 -0
- data/data/rbot/plugins/nickrecover.rb +97 -0
- data/data/rbot/plugins/nickserv.rb +111 -48
- data/data/rbot/plugins/nslookup.rb +15 -19
- data/data/rbot/plugins/plugin.header +11 -0
- data/data/rbot/plugins/quakeauth.rb +74 -11
- data/data/rbot/plugins/quotes.rb +189 -233
- data/data/rbot/plugins/reaction.rb +415 -0
- data/data/rbot/plugins/remind.rb +11 -15
- data/data/rbot/plugins/remotectl.rb +29 -0
- data/data/rbot/plugins/ri.rb +74 -0
- data/data/rbot/plugins/rot13.rb +16 -1
- data/data/rbot/plugins/rss.rb +1219 -585
- data/data/rbot/plugins/salut.rb +226 -0
- data/data/rbot/plugins/script.rb +184 -0
- data/data/rbot/plugins/search.rb +233 -0
- data/data/rbot/plugins/seen.rb +44 -40
- data/data/rbot/plugins/shortenurls.rb +93 -0
- data/data/rbot/plugins/slashdot.rb +49 -11
- data/data/rbot/plugins/spell.rb +37 -27
- data/data/rbot/plugins/theyfightcrime.rb +36 -39
- data/data/rbot/plugins/threat.rb +25 -22
- data/data/rbot/plugins/time.rb +135 -0
- data/data/rbot/plugins/topic.rb +107 -50
- data/data/rbot/plugins/translator.rb +360 -0
- data/data/rbot/plugins/tube.rb +28 -40
- data/data/rbot/plugins/twitter.rb +187 -0
- data/data/rbot/plugins/urban.rb +62 -53
- data/data/rbot/plugins/url.rb +193 -409
- data/data/rbot/plugins/usermodes.rb +26 -0
- data/data/rbot/plugins/wall.rb +60 -0
- data/data/rbot/plugins/weather.rb +254 -598
- data/data/rbot/plugins/wow.rb +41 -37
- data/data/rbot/plugins/wserver.rb +17 -25
- data/data/rbot/plugins/youtube.rb +237 -0
- data/data/rbot/templates/lart/{larts → larts-english} +0 -0
- data/data/rbot/templates/lart/larts-italian +25 -0
- data/data/rbot/templates/lart/larts-japanese +10 -0
- data/data/rbot/templates/lart/{praises → praises-english} +0 -0
- data/data/rbot/templates/lart/praises-italian +4 -0
- data/data/rbot/templates/lart/praises-japanese +3 -0
- data/data/rbot/templates/quiz/win_messages +11 -0
- data/data/rbot/templates/salut/salut-english +40 -0
- data/data/rbot/templates/salut/salut-french +29 -0
- data/data/rbot/templates/salut/salut-italian +51 -0
- data/data/rbot/templates/salut/salut-japanese +31 -0
- data/lib/rbot/botuser.rb +940 -0
- data/lib/rbot/config-compat.rb +23 -0
- data/lib/rbot/config.rb +211 -276
- data/lib/rbot/core/auth.rb +1063 -0
- data/lib/rbot/core/basics.rb +214 -0
- data/lib/rbot/core/config.rb +330 -0
- data/lib/rbot/core/filters_ui.rb +64 -0
- data/lib/rbot/core/irclog.rb +292 -0
- data/lib/rbot/core/remote.rb +401 -0
- data/lib/rbot/core/unicode.rb +91 -0
- data/lib/rbot/core/userdata.rb +200 -0
- data/lib/rbot/core/utils/extends.rb +444 -0
- data/lib/rbot/core/utils/filters.rb +154 -0
- data/lib/rbot/core/utils/httputil.rb +689 -0
- data/lib/rbot/core/utils/utils.rb +717 -0
- data/lib/rbot/dbhash.rb +30 -9
- data/lib/rbot/irc.rb +1966 -0
- data/lib/rbot/ircbot.rb +816 -675
- data/lib/rbot/ircsocket.rb +246 -232
- data/lib/rbot/language.rb +86 -8
- data/lib/rbot/load-gettext.rb +154 -0
- data/lib/rbot/maskdb.rb +162 -0
- data/lib/rbot/message.rb +392 -65
- data/lib/rbot/messagemapper.rb +438 -94
- data/lib/rbot/pkgconfig.rb +6 -0
- data/lib/rbot/plugins.rb +713 -172
- data/lib/rbot/post-config.rb +1 -0
- data/lib/rbot/rbotconfig.rb +31 -12
- data/lib/rbot/registry.rb +79 -48
- data/lib/rbot/rfc2812.rb +927 -519
- data/lib/rbot/timer.rb +232 -167
- data/po/en_US/rbot-alias.po +82 -0
- data/po/en_US/rbot-autoop.po +0 -0
- data/po/en_US/rbot-autorejoin.po +0 -0
- data/po/en_US/rbot-azgame.po +200 -0
- data/po/en_US/rbot-bans.po +0 -0
- data/po/en_US/rbot-bash.po +0 -0
- data/po/en_US/rbot-botsnack.po +0 -0
- data/po/en_US/rbot-cal.po +3 -0
- data/po/en_US/rbot-chanserv.po +0 -0
- data/po/en_US/rbot-chucknorris.po +0 -0
- data/po/en_US/rbot-debugger.po +0 -0
- data/po/en_US/rbot-deepthoughts.po +0 -0
- data/po/en_US/rbot-delicious.po +0 -0
- data/po/en_US/rbot-dice.po +0 -0
- data/po/en_US/rbot-dict.po +0 -0
- data/po/en_US/rbot-dictclient.po +124 -0
- data/po/en_US/rbot-digg.po +0 -0
- data/po/en_US/rbot-eightball.po +0 -0
- data/po/en_US/rbot-excuse.po +0 -0
- data/po/en_US/rbot-factoids.po +107 -0
- data/po/en_US/rbot-figlet.po +36 -0
- data/po/en_US/rbot-fish.po +0 -0
- data/po/en_US/rbot-forecast.po +0 -0
- data/po/en_US/rbot-fortune.po +0 -0
- data/po/en_US/rbot-freshmeat.po +0 -0
- data/po/en_US/rbot-grouphug.po +18 -0
- data/po/en_US/rbot-hl2.po +0 -0
- data/po/en_US/rbot-host.po +3 -0
- data/po/en_US/rbot-imdb.po +0 -0
- data/po/en_US/rbot-insult.po +0 -0
- data/po/en_US/rbot-iplookup.po +0 -0
- data/po/en_US/rbot-karma.po +0 -0
- data/po/en_US/rbot-keywords.po +24 -0
- data/po/en_US/rbot-lart.po +0 -0
- data/po/en_US/rbot-lastfm.po +172 -0
- data/po/en_US/rbot-linkbot.po +0 -0
- data/po/en_US/rbot-markov.po +20 -0
- data/po/en_US/rbot-math.po +0 -0
- data/po/en_US/rbot-modes.po +0 -0
- data/po/en_US/rbot-nickrecover.po +40 -0
- data/po/en_US/rbot-nickserv.po +104 -0
- data/po/en_US/rbot-nslookup.po +0 -0
- data/po/en_US/rbot-quakeauth.po +0 -0
- data/po/en_US/rbot-quiz.po +0 -0
- data/po/en_US/rbot-quotes.po +108 -0
- data/po/en_US/rbot-reaction.po +0 -0
- data/po/en_US/rbot-remind.po +0 -0
- data/po/en_US/rbot-remotectl.po +0 -0
- data/po/en_US/rbot-ri.po +0 -0
- data/po/en_US/rbot-roshambo.po +0 -0
- data/po/en_US/rbot-rot13.po +0 -0
- data/po/en_US/rbot-roulette.po +0 -0
- data/po/en_US/rbot-rss.po +20 -0
- data/po/en_US/rbot-salut.po +0 -0
- data/po/en_US/rbot-script.po +0 -0
- data/po/en_US/rbot-search.po +0 -0
- data/po/en_US/rbot-seen.po +0 -0
- data/po/en_US/rbot-shiritori.po +113 -0
- data/po/en_US/rbot-shortenurls.po +0 -0
- data/po/en_US/rbot-slashdot.po +0 -0
- data/po/en_US/rbot-spell.po +54 -0
- data/po/en_US/rbot-theyfightcrime.po +0 -0
- data/po/en_US/rbot-threat.po +0 -0
- data/po/en_US/rbot-time.po +0 -0
- data/po/en_US/rbot-topic.po +0 -0
- data/po/en_US/rbot-translator.po +77 -0
- data/po/en_US/rbot-tube.po +0 -0
- data/po/en_US/rbot-twitter.po +24 -0
- data/po/en_US/rbot-uno.po +512 -0
- data/po/en_US/rbot-urban.po +0 -0
- data/po/en_US/rbot-url.po +0 -0
- data/po/en_US/rbot-usermodes.po +0 -0
- data/po/en_US/rbot-wall.po +33 -0
- data/po/en_US/rbot-weather.po +0 -0
- data/po/en_US/rbot-wheelfortune.po +205 -0
- data/po/en_US/rbot-wow.po +0 -0
- data/po/en_US/rbot-wserver.po +0 -0
- data/po/en_US/rbot-youtube.po +58 -0
- data/po/en_US/rbot.po +1097 -0
- data/po/fr/rbot-alias.po +97 -0
- data/po/fr/rbot-autoop.po +0 -0
- data/po/fr/rbot-autorejoin.po +0 -0
- data/po/fr/rbot-azgame.po +204 -0
- data/po/fr/rbot-bans.po +0 -0
- data/po/fr/rbot-bash.po +0 -0
- data/po/fr/rbot-botsnack.po +0 -0
- data/po/fr/rbot-cal.po +3 -0
- data/po/fr/rbot-chanserv.po +0 -0
- data/po/fr/rbot-chucknorris.po +0 -0
- data/po/fr/rbot-debugger.po +0 -0
- data/po/fr/rbot-deepthoughts.po +0 -0
- data/po/fr/rbot-delicious.po +0 -0
- data/po/fr/rbot-dice.po +0 -0
- data/po/fr/rbot-dict.po +0 -0
- data/po/fr/rbot-dictclient.po +134 -0
- data/po/fr/rbot-digg.po +0 -0
- data/po/fr/rbot-eightball.po +0 -0
- data/po/fr/rbot-excuse.po +0 -0
- data/po/fr/rbot-factoids.po +111 -0
- data/po/fr/rbot-figlet.po +37 -0
- data/po/fr/rbot-fish.po +0 -0
- data/po/fr/rbot-forecast.po +0 -0
- data/po/fr/rbot-fortune.po +0 -0
- data/po/fr/rbot-freshmeat.po +0 -0
- data/po/fr/rbot-grouphug.po +18 -0
- data/po/fr/rbot-hl2.po +0 -0
- data/po/fr/rbot-host.po +3 -0
- data/po/fr/rbot-imdb.po +0 -0
- data/po/fr/rbot-insult.po +0 -0
- data/po/fr/rbot-iplookup.po +0 -0
- data/po/fr/rbot-karma.po +0 -0
- data/po/fr/rbot-keywords.po +24 -0
- data/po/fr/rbot-lart.po +0 -0
- data/po/fr/rbot-lastfm.po +172 -0
- data/po/fr/rbot-linkbot.po +0 -0
- data/po/fr/rbot-markov.po +20 -0
- data/po/fr/rbot-math.po +0 -0
- data/po/fr/rbot-modes.po +0 -0
- data/po/fr/rbot-nickrecover.po +36 -0
- data/po/fr/rbot-nickserv.po +116 -0
- data/po/fr/rbot-nslookup.po +0 -0
- data/po/fr/rbot-quakeauth.po +0 -0
- data/po/fr/rbot-quiz.po +0 -0
- data/po/fr/rbot-quotes.po +138 -0
- data/po/fr/rbot-reaction.po +0 -0
- data/po/fr/rbot-remind.po +0 -0
- data/po/fr/rbot-remotectl.po +0 -0
- data/po/fr/rbot-ri.po +0 -0
- data/po/fr/rbot-roshambo.po +0 -0
- data/po/fr/rbot-rot13.po +0 -0
- data/po/fr/rbot-roulette.po +0 -0
- data/po/fr/rbot-rss.po +20 -0
- data/po/fr/rbot-salut.po +0 -0
- data/po/fr/rbot-script.po +0 -0
- data/po/fr/rbot-search.po +0 -0
- data/po/fr/rbot-seen.po +0 -0
- data/po/fr/rbot-shiritori.po +119 -0
- data/po/fr/rbot-shortenurls.po +0 -0
- data/po/fr/rbot-slashdot.po +0 -0
- data/po/fr/rbot-spell.po +56 -0
- data/po/fr/rbot-theyfightcrime.po +0 -0
- data/po/fr/rbot-threat.po +0 -0
- data/po/fr/rbot-time.po +0 -0
- data/po/fr/rbot-topic.po +0 -0
- data/po/fr/rbot-translator.po +90 -0
- data/po/fr/rbot-tube.po +0 -0
- data/po/fr/rbot-twitter.po +24 -0
- data/po/fr/rbot-uno.po +521 -0
- data/po/fr/rbot-urban.po +0 -0
- data/po/fr/rbot-url.po +0 -0
- data/po/fr/rbot-usermodes.po +0 -0
- data/po/fr/rbot-wall.po +33 -0
- data/po/fr/rbot-weather.po +0 -0
- data/po/fr/rbot-wheelfortune.po +255 -0
- data/po/fr/rbot-wow.po +0 -0
- data/po/fr/rbot-wserver.po +0 -0
- data/po/fr/rbot-youtube.po +64 -0
- data/po/fr/rbot.po +1133 -0
- data/po/it/rbot-alias.po +82 -0
- data/po/it/rbot-autoop.po +0 -0
- data/po/it/rbot-autorejoin.po +0 -0
- data/po/it/rbot-azgame.po +186 -0
- data/po/it/rbot-bans.po +0 -0
- data/po/it/rbot-bash.po +0 -0
- data/po/it/rbot-botsnack.po +0 -0
- data/po/it/rbot-cal.po +3 -0
- data/po/it/rbot-chanserv.po +0 -0
- data/po/it/rbot-chucknorris.po +0 -0
- data/po/it/rbot-debugger.po +0 -0
- data/po/it/rbot-deepthoughts.po +0 -0
- data/po/it/rbot-delicious.po +0 -0
- data/po/it/rbot-dice.po +0 -0
- data/po/it/rbot-dict.po +0 -0
- data/po/it/rbot-dictclient.po +111 -0
- data/po/it/rbot-digg.po +0 -0
- data/po/it/rbot-eightball.po +0 -0
- data/po/it/rbot-excuse.po +0 -0
- data/po/it/rbot-factoids.po +110 -0
- data/po/it/rbot-figlet.po +36 -0
- data/po/it/rbot-fish.po +0 -0
- data/po/it/rbot-forecast.po +0 -0
- data/po/it/rbot-fortune.po +0 -0
- data/po/it/rbot-freshmeat.po +0 -0
- data/po/it/rbot-grouphug.po +18 -0
- data/po/it/rbot-hl2.po +0 -0
- data/po/it/rbot-host.po +3 -0
- data/po/it/rbot-imdb.po +0 -0
- data/po/it/rbot-insult.po +0 -0
- data/po/it/rbot-iplookup.po +0 -0
- data/po/it/rbot-karma.po +0 -0
- data/po/it/rbot-keywords.po +24 -0
- data/po/it/rbot-lart.po +0 -0
- data/po/it/rbot-lastfm.po +172 -0
- data/po/it/rbot-linkbot.po +0 -0
- data/po/it/rbot-markov.po +20 -0
- data/po/it/rbot-math.po +0 -0
- data/po/it/rbot-modes.po +0 -0
- data/po/it/rbot-nickrecover.po +36 -0
- data/po/it/rbot-nickserv.po +104 -0
- data/po/it/rbot-nslookup.po +0 -0
- data/po/it/rbot-quakeauth.po +0 -0
- data/po/it/rbot-quiz.po +0 -0
- data/po/it/rbot-quotes.po +108 -0
- data/po/it/rbot-reaction.po +0 -0
- data/po/it/rbot-remind.po +0 -0
- data/po/it/rbot-remotectl.po +0 -0
- data/po/it/rbot-ri.po +0 -0
- data/po/it/rbot-roshambo.po +0 -0
- data/po/it/rbot-rot13.po +0 -0
- data/po/it/rbot-roulette.po +0 -0
- data/po/it/rbot-rss.po +20 -0
- data/po/it/rbot-salut.po +0 -0
- data/po/it/rbot-script.po +0 -0
- data/po/it/rbot-search.po +0 -0
- data/po/it/rbot-seen.po +0 -0
- data/po/it/rbot-shiritori.po +102 -0
- data/po/it/rbot-shortenurls.po +0 -0
- data/po/it/rbot-slashdot.po +0 -0
- data/po/it/rbot-spell.po +54 -0
- data/po/it/rbot-theyfightcrime.po +0 -0
- data/po/it/rbot-threat.po +0 -0
- data/po/it/rbot-time.po +0 -0
- data/po/it/rbot-topic.po +0 -0
- data/po/it/rbot-translator.po +77 -0
- data/po/it/rbot-tube.po +0 -0
- data/po/it/rbot-twitter.po +24 -0
- data/po/it/rbot-uno.po +564 -0
- data/po/it/rbot-urban.po +0 -0
- data/po/it/rbot-url.po +0 -0
- data/po/it/rbot-usermodes.po +0 -0
- data/po/it/rbot-wall.po +33 -0
- data/po/it/rbot-weather.po +0 -0
- data/po/it/rbot-wheelfortune.po +251 -0
- data/po/it/rbot-wow.po +0 -0
- data/po/it/rbot-wserver.po +0 -0
- data/po/it/rbot-youtube.po +64 -0
- data/po/it/rbot.po +1127 -0
- data/po/ja/rbot-alias.po +82 -0
- data/po/ja/rbot-autoop.po +0 -0
- data/po/ja/rbot-autorejoin.po +0 -0
- data/po/ja/rbot-azgame.po +194 -0
- data/po/ja/rbot-bans.po +0 -0
- data/po/ja/rbot-bash.po +0 -0
- data/po/ja/rbot-botsnack.po +0 -0
- data/po/ja/rbot-cal.po +3 -0
- data/po/ja/rbot-chanserv.po +0 -0
- data/po/ja/rbot-chucknorris.po +0 -0
- data/po/ja/rbot-debugger.po +0 -0
- data/po/ja/rbot-deepthoughts.po +0 -0
- data/po/ja/rbot-delicious.po +0 -0
- data/po/ja/rbot-dice.po +0 -0
- data/po/ja/rbot-dict.po +0 -0
- data/po/ja/rbot-dictclient.po +111 -0
- data/po/ja/rbot-digg.po +0 -0
- data/po/ja/rbot-eightball.po +0 -0
- data/po/ja/rbot-excuse.po +0 -0
- data/po/ja/rbot-factoids.po +107 -0
- data/po/ja/rbot-figlet.po +36 -0
- data/po/ja/rbot-fish.po +0 -0
- data/po/ja/rbot-forecast.po +0 -0
- data/po/ja/rbot-fortune.po +0 -0
- data/po/ja/rbot-freshmeat.po +0 -0
- data/po/ja/rbot-grouphug.po +18 -0
- data/po/ja/rbot-hl2.po +0 -0
- data/po/ja/rbot-host.po +3 -0
- data/po/ja/rbot-imdb.po +0 -0
- data/po/ja/rbot-insult.po +0 -0
- data/po/ja/rbot-iplookup.po +0 -0
- data/po/ja/rbot-karma.po +0 -0
- data/po/ja/rbot-keywords.po +24 -0
- data/po/ja/rbot-lart.po +0 -0
- data/po/ja/rbot-lastfm.po +172 -0
- data/po/ja/rbot-linkbot.po +0 -0
- data/po/ja/rbot-markov.po +20 -0
- data/po/ja/rbot-math.po +0 -0
- data/po/ja/rbot-modes.po +0 -0
- data/po/ja/rbot-nickrecover.po +36 -0
- data/po/ja/rbot-nickserv.po +104 -0
- data/po/ja/rbot-nslookup.po +0 -0
- data/po/ja/rbot-quakeauth.po +0 -0
- data/po/ja/rbot-quiz.po +0 -0
- data/po/ja/rbot-quotes.po +108 -0
- data/po/ja/rbot-reaction.po +0 -0
- data/po/ja/rbot-remind.po +0 -0
- data/po/ja/rbot-remotectl.po +0 -0
- data/po/ja/rbot-ri.po +0 -0
- data/po/ja/rbot-roshambo.po +0 -0
- data/po/ja/rbot-rot13.po +0 -0
- data/po/ja/rbot-roulette.po +0 -0
- data/po/ja/rbot-rss.po +20 -0
- data/po/ja/rbot-salut.po +0 -0
- data/po/ja/rbot-script.po +0 -0
- data/po/ja/rbot-search.po +0 -0
- data/po/ja/rbot-seen.po +0 -0
- data/po/ja/rbot-shiritori.po +115 -0
- data/po/ja/rbot-shortenurls.po +0 -0
- data/po/ja/rbot-slashdot.po +0 -0
- data/po/ja/rbot-spell.po +54 -0
- data/po/ja/rbot-theyfightcrime.po +0 -0
- data/po/ja/rbot-threat.po +0 -0
- data/po/ja/rbot-time.po +0 -0
- data/po/ja/rbot-topic.po +0 -0
- data/po/ja/rbot-translator.po +77 -0
- data/po/ja/rbot-tube.po +0 -0
- data/po/ja/rbot-twitter.po +24 -0
- data/po/ja/rbot-uno.po +512 -0
- data/po/ja/rbot-urban.po +0 -0
- data/po/ja/rbot-url.po +0 -0
- data/po/ja/rbot-usermodes.po +0 -0
- data/po/ja/rbot-wall.po +33 -0
- data/po/ja/rbot-weather.po +0 -0
- data/po/ja/rbot-wheelfortune.po +205 -0
- data/po/ja/rbot-wow.po +0 -0
- data/po/ja/rbot-wserver.po +0 -0
- data/po/ja/rbot-youtube.po +58 -0
- data/po/ja/rbot.po +999 -0
- data/po/rbot-alias.pot +83 -0
- data/po/rbot-autoop.pot +0 -0
- data/po/rbot-autorejoin.pot +0 -0
- data/po/rbot-azgame.pot +187 -0
- data/po/rbot-bans.pot +0 -0
- data/po/rbot-bash.pot +0 -0
- data/po/rbot-botsnack.pot +0 -0
- data/po/rbot-cal.pot +21 -0
- data/po/rbot-chanserv.pot +0 -0
- data/po/rbot-chucknorris.pot +0 -0
- data/po/rbot-debugger.pot +0 -0
- data/po/rbot-deepthoughts.pot +0 -0
- data/po/rbot-delicious.pot +0 -0
- data/po/rbot-dice.pot +0 -0
- data/po/rbot-dict.pot +0 -0
- data/po/rbot-dictclient.pot +112 -0
- data/po/rbot-digg.pot +0 -0
- data/po/rbot-eightball.pot +0 -0
- data/po/rbot-excuse.pot +0 -0
- data/po/rbot-factoids.pot +108 -0
- data/po/rbot-figlet.pot +37 -0
- data/po/rbot-fish.pot +0 -0
- data/po/rbot-forecast.pot +0 -0
- data/po/rbot-fortune.pot +0 -0
- data/po/rbot-freshmeat.pot +0 -0
- data/po/rbot-grouphug.pot +36 -0
- data/po/rbot-hl2.pot +0 -0
- data/po/rbot-host.pot +21 -0
- data/po/rbot-imdb.pot +0 -0
- data/po/rbot-insult.pot +0 -0
- data/po/rbot-iplookup.pot +0 -0
- data/po/rbot-karma.pot +0 -0
- data/po/rbot-keywords.pot +25 -0
- data/po/rbot-lart.pot +0 -0
- data/po/rbot-lastfm.pot +190 -0
- data/po/rbot-linkbot.pot +0 -0
- data/po/rbot-markov.pot +21 -0
- data/po/rbot-math.pot +0 -0
- data/po/rbot-modes.pot +0 -0
- data/po/rbot-nickrecover.pot +37 -0
- data/po/rbot-nickserv.pot +105 -0
- data/po/rbot-nslookup.pot +0 -0
- data/po/rbot-quakeauth.pot +0 -0
- data/po/rbot-quiz.pot +0 -0
- data/po/rbot-quotes.pot +109 -0
- data/po/rbot-reaction.pot +0 -0
- data/po/rbot-remind.pot +0 -0
- data/po/rbot-remotectl.pot +0 -0
- data/po/rbot-ri.pot +0 -0
- data/po/rbot-roshambo.pot +0 -0
- data/po/rbot-rot13.pot +0 -0
- data/po/rbot-roulette.pot +0 -0
- data/po/rbot-rss.pot +21 -0
- data/po/rbot-salut.pot +0 -0
- data/po/rbot-script.pot +0 -0
- data/po/rbot-search.pot +0 -0
- data/po/rbot-seen.pot +0 -0
- data/po/rbot-shiritori.pot +103 -0
- data/po/rbot-shortenurls.pot +0 -0
- data/po/rbot-slashdot.pot +0 -0
- data/po/rbot-spell.pot +55 -0
- data/po/rbot-theyfightcrime.pot +0 -0
- data/po/rbot-threat.pot +0 -0
- data/po/rbot-time.pot +0 -0
- data/po/rbot-topic.pot +0 -0
- data/po/rbot-translator.pot +78 -0
- data/po/rbot-tube.pot +0 -0
- data/po/rbot-twitter.pot +25 -0
- data/po/rbot-uno.pot +513 -0
- data/po/rbot-urban.pot +0 -0
- data/po/rbot-url.pot +0 -0
- data/po/rbot-usermodes.pot +0 -0
- data/po/rbot-wall.pot +33 -0
- data/po/rbot-weather.pot +0 -0
- data/po/rbot-wheelfortune.pot +206 -0
- data/po/rbot-wow.pot +0 -0
- data/po/rbot-wserver.pot +0 -0
- data/po/rbot-youtube.pot +59 -0
- data/po/rbot.pot +1004 -0
- data/po/zh_CN/rbot-alias.po +82 -0
- data/po/zh_CN/rbot-autoop.po +0 -0
- data/po/zh_CN/rbot-autorejoin.po +0 -0
- data/po/zh_CN/rbot-azgame.po +186 -0
- data/po/zh_CN/rbot-bans.po +0 -0
- data/po/zh_CN/rbot-bash.po +0 -0
- data/po/zh_CN/rbot-botsnack.po +0 -0
- data/po/zh_CN/rbot-cal.po +3 -0
- data/po/zh_CN/rbot-chanserv.po +0 -0
- data/po/zh_CN/rbot-chucknorris.po +0 -0
- data/po/zh_CN/rbot-debugger.po +0 -0
- data/po/zh_CN/rbot-deepthoughts.po +0 -0
- data/po/zh_CN/rbot-delicious.po +0 -0
- data/po/zh_CN/rbot-dice.po +0 -0
- data/po/zh_CN/rbot-dict.po +0 -0
- data/po/zh_CN/rbot-dictclient.po +111 -0
- data/po/zh_CN/rbot-digg.po +0 -0
- data/po/zh_CN/rbot-eightball.po +0 -0
- data/po/zh_CN/rbot-excuse.po +0 -0
- data/po/zh_CN/rbot-factoids.po +107 -0
- data/po/zh_CN/rbot-figlet.po +36 -0
- data/po/zh_CN/rbot-fish.po +0 -0
- data/po/zh_CN/rbot-forecast.po +0 -0
- data/po/zh_CN/rbot-fortune.po +0 -0
- data/po/zh_CN/rbot-freshmeat.po +0 -0
- data/po/zh_CN/rbot-grouphug.po +18 -0
- data/po/zh_CN/rbot-hl2.po +0 -0
- data/po/zh_CN/rbot-host.po +3 -0
- data/po/zh_CN/rbot-imdb.po +0 -0
- data/po/zh_CN/rbot-insult.po +0 -0
- data/po/zh_CN/rbot-iplookup.po +0 -0
- data/po/zh_CN/rbot-karma.po +0 -0
- data/po/zh_CN/rbot-keywords.po +24 -0
- data/po/zh_CN/rbot-lart.po +0 -0
- data/po/zh_CN/rbot-lastfm.po +172 -0
- data/po/zh_CN/rbot-linkbot.po +0 -0
- data/po/zh_CN/rbot-markov.po +20 -0
- data/po/zh_CN/rbot-math.po +0 -0
- data/po/zh_CN/rbot-modes.po +0 -0
- data/po/zh_CN/rbot-nickrecover.po +36 -0
- data/po/zh_CN/rbot-nickserv.po +104 -0
- data/po/zh_CN/rbot-nslookup.po +0 -0
- data/po/zh_CN/rbot-quakeauth.po +0 -0
- data/po/zh_CN/rbot-quiz.po +0 -0
- data/po/zh_CN/rbot-quotes.po +108 -0
- data/po/zh_CN/rbot-reaction.po +0 -0
- data/po/zh_CN/rbot-remind.po +0 -0
- data/po/zh_CN/rbot-remotectl.po +0 -0
- data/po/zh_CN/rbot-ri.po +0 -0
- data/po/zh_CN/rbot-roshambo.po +0 -0
- data/po/zh_CN/rbot-rot13.po +0 -0
- data/po/zh_CN/rbot-roulette.po +0 -0
- data/po/zh_CN/rbot-rss.po +20 -0
- data/po/zh_CN/rbot-salut.po +0 -0
- data/po/zh_CN/rbot-script.po +0 -0
- data/po/zh_CN/rbot-search.po +0 -0
- data/po/zh_CN/rbot-seen.po +0 -0
- data/po/zh_CN/rbot-shiritori.po +102 -0
- data/po/zh_CN/rbot-shortenurls.po +0 -0
- data/po/zh_CN/rbot-slashdot.po +0 -0
- data/po/zh_CN/rbot-spell.po +54 -0
- data/po/zh_CN/rbot-theyfightcrime.po +0 -0
- data/po/zh_CN/rbot-threat.po +0 -0
- data/po/zh_CN/rbot-time.po +0 -0
- data/po/zh_CN/rbot-topic.po +0 -0
- data/po/zh_CN/rbot-translator.po +77 -0
- data/po/zh_CN/rbot-tube.po +0 -0
- data/po/zh_CN/rbot-twitter.po +24 -0
- data/po/zh_CN/rbot-uno.po +512 -0
- data/po/zh_CN/rbot-urban.po +0 -0
- data/po/zh_CN/rbot-url.po +0 -0
- data/po/zh_CN/rbot-usermodes.po +0 -0
- data/po/zh_CN/rbot-wall.po +33 -0
- data/po/zh_CN/rbot-weather.po +0 -0
- data/po/zh_CN/rbot-wheelfortune.po +205 -0
- data/po/zh_CN/rbot-wow.po +0 -0
- data/po/zh_CN/rbot-wserver.po +0 -0
- data/po/zh_CN/rbot-youtube.po +58 -0
- data/po/zh_CN/rbot.po +1006 -0
- data/po/zh_TW/rbot-alias.po +82 -0
- data/po/zh_TW/rbot-autoop.po +0 -0
- data/po/zh_TW/rbot-autorejoin.po +0 -0
- data/po/zh_TW/rbot-azgame.po +186 -0
- data/po/zh_TW/rbot-bans.po +0 -0
- data/po/zh_TW/rbot-bash.po +0 -0
- data/po/zh_TW/rbot-botsnack.po +0 -0
- data/po/zh_TW/rbot-cal.po +3 -0
- data/po/zh_TW/rbot-chanserv.po +0 -0
- data/po/zh_TW/rbot-chucknorris.po +0 -0
- data/po/zh_TW/rbot-debugger.po +0 -0
- data/po/zh_TW/rbot-deepthoughts.po +0 -0
- data/po/zh_TW/rbot-delicious.po +0 -0
- data/po/zh_TW/rbot-dice.po +0 -0
- data/po/zh_TW/rbot-dict.po +0 -0
- data/po/zh_TW/rbot-dictclient.po +111 -0
- data/po/zh_TW/rbot-digg.po +0 -0
- data/po/zh_TW/rbot-eightball.po +0 -0
- data/po/zh_TW/rbot-excuse.po +0 -0
- data/po/zh_TW/rbot-factoids.po +107 -0
- data/po/zh_TW/rbot-figlet.po +36 -0
- data/po/zh_TW/rbot-fish.po +0 -0
- data/po/zh_TW/rbot-forecast.po +0 -0
- data/po/zh_TW/rbot-fortune.po +0 -0
- data/po/zh_TW/rbot-freshmeat.po +0 -0
- data/po/zh_TW/rbot-grouphug.po +18 -0
- data/po/zh_TW/rbot-hl2.po +0 -0
- data/po/zh_TW/rbot-host.po +3 -0
- data/po/zh_TW/rbot-imdb.po +0 -0
- data/po/zh_TW/rbot-insult.po +0 -0
- data/po/zh_TW/rbot-iplookup.po +0 -0
- data/po/zh_TW/rbot-karma.po +0 -0
- data/po/zh_TW/rbot-keywords.po +24 -0
- data/po/zh_TW/rbot-lart.po +0 -0
- data/po/zh_TW/rbot-lastfm.po +172 -0
- data/po/zh_TW/rbot-linkbot.po +0 -0
- data/po/zh_TW/rbot-markov.po +20 -0
- data/po/zh_TW/rbot-math.po +0 -0
- data/po/zh_TW/rbot-modes.po +0 -0
- data/po/zh_TW/rbot-nickrecover.po +36 -0
- data/po/zh_TW/rbot-nickserv.po +104 -0
- data/po/zh_TW/rbot-nslookup.po +0 -0
- data/po/zh_TW/rbot-quakeauth.po +0 -0
- data/po/zh_TW/rbot-quiz.po +0 -0
- data/po/zh_TW/rbot-quotes.po +108 -0
- data/po/zh_TW/rbot-reaction.po +0 -0
- data/po/zh_TW/rbot-remind.po +0 -0
- data/po/zh_TW/rbot-remotectl.po +0 -0
- data/po/zh_TW/rbot-ri.po +0 -0
- data/po/zh_TW/rbot-roshambo.po +0 -0
- data/po/zh_TW/rbot-rot13.po +0 -0
- data/po/zh_TW/rbot-roulette.po +0 -0
- data/po/zh_TW/rbot-rss.po +20 -0
- data/po/zh_TW/rbot-salut.po +0 -0
- data/po/zh_TW/rbot-script.po +0 -0
- data/po/zh_TW/rbot-search.po +0 -0
- data/po/zh_TW/rbot-seen.po +0 -0
- data/po/zh_TW/rbot-shiritori.po +102 -0
- data/po/zh_TW/rbot-shortenurls.po +0 -0
- data/po/zh_TW/rbot-slashdot.po +0 -0
- data/po/zh_TW/rbot-spell.po +54 -0
- data/po/zh_TW/rbot-theyfightcrime.po +0 -0
- data/po/zh_TW/rbot-threat.po +0 -0
- data/po/zh_TW/rbot-time.po +0 -0
- data/po/zh_TW/rbot-topic.po +0 -0
- data/po/zh_TW/rbot-translator.po +77 -0
- data/po/zh_TW/rbot-tube.po +0 -0
- data/po/zh_TW/rbot-twitter.po +24 -0
- data/po/zh_TW/rbot-uno.po +512 -0
- data/po/zh_TW/rbot-urban.po +0 -0
- data/po/zh_TW/rbot-url.po +0 -0
- data/po/zh_TW/rbot-usermodes.po +0 -0
- data/po/zh_TW/rbot-wall.po +33 -0
- data/po/zh_TW/rbot-weather.po +0 -0
- data/po/zh_TW/rbot-wheelfortune.po +205 -0
- data/po/zh_TW/rbot-wow.po +0 -0
- data/po/zh_TW/rbot-wserver.po +0 -0
- data/po/zh_TW/rbot-youtube.po +58 -0
- data/po/zh_TW/rbot.po +1034 -0
- data/setup.rb +800 -574
- metadata +723 -108
- data/data/rbot/contrib/plugins/figlet.rb +0 -20
- data/data/rbot/contrib/plugins/ri.rb +0 -83
- data/data/rbot/plugins/demauro.rb +0 -95
- data/data/rbot/plugins/google.rb +0 -53
- data/data/rbot/plugins/opme.rb +0 -19
- data/data/rbot/plugins/roshambo.rb +0 -54
- data/data/rbot/plugins/rubyurl.rb +0 -39
- data/data/rbot/plugins/tinyurl.rb +0 -39
- data/data/rbot/plugins/xmlrpc.rb.disabled +0 -52
- data/data/rbot/templates/levels.rbot +0 -32
- data/data/rbot/templates/users.rbot +0 -1
- data/lib/rbot/auth.rb +0 -314
- data/lib/rbot/channel.rb +0 -54
- data/lib/rbot/httputil.rb +0 -309
- data/lib/rbot/utils.rb +0 -83
data/data/rbot/plugins/karma.rb
CHANGED
@@ -25,7 +25,6 @@ class KarmaPlugin < Plugin
|
|
25
25
|
end
|
26
26
|
File.delete("#{@bot.botclass}/karma.rbot")
|
27
27
|
end
|
28
|
-
|
29
28
|
end
|
30
29
|
|
31
30
|
def stats(m, params)
|
@@ -49,37 +48,62 @@ class KarmaPlugin < Plugin
|
|
49
48
|
m.reply "#{thing} has neutral karma"
|
50
49
|
end
|
51
50
|
end
|
52
|
-
|
51
|
+
|
52
|
+
def setkarma(m, params)
|
53
|
+
thing = (params[:key] || m.sourcenick).to_s
|
54
|
+
@registry[thing] = params[:val].to_i
|
55
|
+
karma(m, params)
|
56
|
+
end
|
53
57
|
|
54
58
|
def help(plugin, topic="")
|
55
59
|
"karma module: Listens to everyone's chat. <thing>++/<thing>-- => increase/decrease karma for <thing>, karma for <thing>? => show karma for <thing>, karmastats => show stats. Karma is a community rating system - only in-channel messages can affect karma and you cannot adjust your own."
|
56
60
|
end
|
57
|
-
def listen(m)
|
58
|
-
return unless m.kind_of?(PrivMessage) && m.public?
|
59
|
-
# in channel message, the kind we are interested in
|
60
|
-
if(m.message =~ /(\+\+|--)/)
|
61
|
-
string = m.message.sub(/\W(--|\+\+)(\(.*?\)|[^(++)(\-\-)\s]+)/, "\2\1")
|
62
|
-
seen = Hash.new
|
63
|
-
while(string.sub!(/(\(.*?\)|[^(++)(\-\-)\s]+)(\+\+|--)/, ""))
|
64
|
-
key = $1
|
65
|
-
change = $2
|
66
|
-
next if seen[key]
|
67
|
-
seen[key] = true
|
68
61
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
62
|
+
def message(m)
|
63
|
+
return unless m.public? && m.message.match(/\+\+|--/)
|
64
|
+
arg = nil
|
65
|
+
op = nil
|
66
|
+
ac = Hash.new
|
67
|
+
m.message.split.each_with_index do |tok, i|
|
68
|
+
tok.sub!(/[:,]$/, '') if i == 0
|
69
|
+
catch :me_if_you_can do
|
70
|
+
if m.channel.users[tok].nil?
|
71
|
+
if (tok =~ /^(?:--)(.*[^-].*)$/) || (tok =~ /^(.*[^-].*)(?:--)$/)
|
72
|
+
op, arg = '--', $1
|
73
|
+
next
|
74
|
+
elsif (tok =~ /^(?:\+\+)(.*[^+].*)$/)||(tok =~ /^(.*[^+].*)(?:\+\+)$/)
|
75
|
+
op, arg = '++', $1
|
76
|
+
next
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
if (tok =~ /^--+$/) || (tok =~ /^\+\++$/)
|
81
|
+
op = tok.slice(0, 2)
|
82
|
+
else
|
83
|
+
arg = tok
|
77
84
|
end
|
85
|
+
end # catch
|
86
|
+
|
87
|
+
if op && arg
|
88
|
+
ac[arg] ||= 0
|
89
|
+
ac[arg] += (op == '--' ? -1 : 1)
|
90
|
+
op = arg = nil
|
78
91
|
end
|
79
92
|
end
|
93
|
+
|
94
|
+
ac.each do |k, v|
|
95
|
+
next if v == 0
|
96
|
+
@registry[k] += (v > 0 ? 1 : -1)
|
97
|
+
m.reply @bot.lang.get("thanks") if k == @bot.nick && v > 0
|
98
|
+
end
|
80
99
|
end
|
81
100
|
end
|
101
|
+
|
82
102
|
plugin = KarmaPlugin.new
|
103
|
+
|
104
|
+
plugin.default_auth( 'edit', false )
|
105
|
+
|
83
106
|
plugin.map 'karmastats', :action => 'stats'
|
84
107
|
plugin.map 'karma :key', :defaults => {:key => false}
|
108
|
+
plugin.map 'setkarma :key :val', :defaults => {:key => false}, :requirements => {:val => /^-?\d+$/}, :auth_path => 'edit::set!'
|
85
109
|
plugin.map 'karma for :key'
|
@@ -9,10 +9,10 @@ class Keyword
|
|
9
9
|
|
10
10
|
# type of keyword (e.g. "is" or "are")
|
11
11
|
attr_reader :type
|
12
|
-
|
12
|
+
|
13
13
|
# type:: type of keyword (e.g "is" or "are")
|
14
14
|
# values:: array of values
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# create a keyword of type +type+ with values +values+
|
17
17
|
def initialize(type, values)
|
18
18
|
@type = type.downcase
|
@@ -28,6 +28,19 @@ class Keyword
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
# return an array of all the possible values
|
32
|
+
def to_factoids(key)
|
33
|
+
ar = Array.new
|
34
|
+
@values.each { |val|
|
35
|
+
debug "key #{key}, value #{val}"
|
36
|
+
vals = val.split(" or ")
|
37
|
+
vals.each { |v|
|
38
|
+
ar << "%s %s %s" % [key, @type, v]
|
39
|
+
}
|
40
|
+
}
|
41
|
+
return ar
|
42
|
+
end
|
43
|
+
|
31
44
|
# describe the keyword (show all values without interpolation)
|
32
45
|
def desc
|
33
46
|
@values.join(" | ")
|
@@ -71,7 +84,7 @@ class Keyword
|
|
71
84
|
end
|
72
85
|
end
|
73
86
|
|
74
|
-
# keywords class.
|
87
|
+
# keywords class.
|
75
88
|
#
|
76
89
|
# Handles all that stuff like "bot: foo is bar", "bot: foo?"
|
77
90
|
#
|
@@ -79,14 +92,20 @@ end
|
|
79
92
|
# handle it, checks for a keyword command or lookup, otherwise the message
|
80
93
|
# is delegated to plugins
|
81
94
|
class Keywords < Plugin
|
82
|
-
|
95
|
+
Config.register Config::BooleanValue.new('keyword.listen',
|
83
96
|
:default => false,
|
84
97
|
:desc => "Should the bot listen to all chat and attempt to automatically detect keywords? (e.g. by spotting someone say 'foo is bar')")
|
85
|
-
|
98
|
+
Config.register Config::BooleanValue.new('keyword.address',
|
86
99
|
:default => true,
|
87
100
|
:desc => "Should the bot require that keyword lookups are addressed to it? If not, the bot will attempt to lookup foo if someone says 'foo?' in channel")
|
88
|
-
|
89
|
-
|
101
|
+
Config.register Config::IntegerValue.new('keyword.search_results',
|
102
|
+
:default => 3,
|
103
|
+
:desc => "How many search results to display at a time")
|
104
|
+
Config.register Config::ArrayValue.new('keyword.ignore_words',
|
105
|
+
:default => ["how", "that", "these", "they", "this", "what", "when", "where", "who", "why", "you"],
|
106
|
+
:desc => "A list of words that the bot should passively ignore.")
|
107
|
+
|
108
|
+
# create a new KeywordPlugin instance, associated to bot +bot+
|
90
109
|
def initialize
|
91
110
|
super
|
92
111
|
|
@@ -95,7 +114,7 @@ class Keywords < Plugin
|
|
95
114
|
upgrade_data
|
96
115
|
|
97
116
|
scan
|
98
|
-
|
117
|
+
|
99
118
|
# import old format keywords into DBHash
|
100
119
|
if(File.exist?("#{@bot.botclass}/keywords.rbot"))
|
101
120
|
log "auto importing old keywords.rbot"
|
@@ -113,13 +132,6 @@ class Keywords < Plugin
|
|
113
132
|
File.rename("#{@bot.botclass}/keywords.rbot", "#{@bot.botclass}/keywords.rbot.old")
|
114
133
|
end
|
115
134
|
end
|
116
|
-
|
117
|
-
# drop static keywords and reload them from files, picking up any new
|
118
|
-
# keyword files that have been added
|
119
|
-
def rescan
|
120
|
-
@statickeywords = Hash.new
|
121
|
-
scan
|
122
|
-
end
|
123
135
|
|
124
136
|
# load static keywords from files, picking up any new keyword files that
|
125
137
|
# have been added
|
@@ -129,9 +141,9 @@ class Keywords < Plugin
|
|
129
141
|
next unless f =~ /\.db$/
|
130
142
|
log "upgrading keyword db #{f} (rbot 0.9.5 or prior) database format"
|
131
143
|
newname = f.gsub(/\.db$/, ".kdb")
|
132
|
-
old = BDB::Hash.open f, nil,
|
144
|
+
old = BDB::Hash.open f, nil,
|
133
145
|
"r+", 0600
|
134
|
-
new = BDB::CIBtree.open(newname, nil,
|
146
|
+
new = BDB::CIBtree.open(newname, nil,
|
135
147
|
BDB::CREATE | BDB::EXCL,
|
136
148
|
0600)
|
137
149
|
old.each {|k,v|
|
@@ -141,7 +153,7 @@ class Keywords < Plugin
|
|
141
153
|
new.close
|
142
154
|
File.delete(f)
|
143
155
|
}
|
144
|
-
|
156
|
+
|
145
157
|
# then scan for current DBTree files, and load them
|
146
158
|
Dir["#{@bot.botclass}/keywords/*"].each {|f|
|
147
159
|
next unless f =~ /\.kdb$/
|
@@ -150,7 +162,7 @@ class Keywords < Plugin
|
|
150
162
|
debug "keywords module: loading DBTree file #{f}, key #{key}"
|
151
163
|
@statickeywords[key] = hsh
|
152
164
|
}
|
153
|
-
|
165
|
+
|
154
166
|
# then scan for non DB files, and convert/import them and delete
|
155
167
|
Dir["#{@bot.botclass}/keywords/*"].each {|f|
|
156
168
|
next if f =~ /\.kdb$/
|
@@ -182,7 +194,7 @@ class Keywords < Plugin
|
|
182
194
|
def upgrade_data
|
183
195
|
if File.exist?("#{@bot.botclass}/keywords.db")
|
184
196
|
log "upgrading old keywords (rbot 0.9.5 or prior) database format"
|
185
|
-
old = BDB::Hash.open "#{@bot.botclass}/keywords.db", nil,
|
197
|
+
old = BDB::Hash.open "#{@bot.botclass}/keywords.db", nil,
|
186
198
|
"r+", 0600
|
187
199
|
old.each {|k,v|
|
188
200
|
@keywords[k] = v
|
@@ -191,10 +203,10 @@ class Keywords < Plugin
|
|
191
203
|
@keywords.flush
|
192
204
|
File.rename("#{@bot.botclass}/keywords.db", "#{@bot.botclass}/keywords.db.old")
|
193
205
|
end
|
194
|
-
|
206
|
+
|
195
207
|
if File.exist?("#{@bot.botclass}/keyword.db")
|
196
208
|
log "upgrading old keywords (rbot 0.9.9 or prior) database format"
|
197
|
-
old = BDB::CIBtree.open "#{@bot.botclass}/keyword.db", nil,
|
209
|
+
old = BDB::CIBtree.open "#{@bot.botclass}/keyword.db", nil,
|
198
210
|
"r+", 0600
|
199
211
|
old.each {|k,v|
|
200
212
|
@keywords[k] = v
|
@@ -209,6 +221,7 @@ class Keywords < Plugin
|
|
209
221
|
def save
|
210
222
|
@keywords.flush
|
211
223
|
end
|
224
|
+
|
212
225
|
def oldsave
|
213
226
|
File.open("#{@bot.botclass}/keywords.rbot", "w") do |file|
|
214
227
|
@keywords.each do |key, value|
|
@@ -216,7 +229,7 @@ class Keywords < Plugin
|
|
216
229
|
end
|
217
230
|
end
|
218
231
|
end
|
219
|
-
|
232
|
+
|
220
233
|
# lookup keyword +key+, return it or nil
|
221
234
|
def [](key)
|
222
235
|
return nil if key.nil?
|
@@ -248,41 +261,52 @@ class Keywords < Plugin
|
|
248
261
|
return false
|
249
262
|
end
|
250
263
|
|
264
|
+
# is +word+ a passively ignored keyword?
|
265
|
+
def ignored_word?(word)
|
266
|
+
@bot.config["keyword.ignore_words"].include?(word)
|
267
|
+
end
|
268
|
+
|
251
269
|
# m:: PrivMessage containing message info
|
252
270
|
# key:: key being queried
|
253
|
-
#
|
254
|
-
#
|
271
|
+
# quiet:: optional, if false, complain if +key+ is not found
|
272
|
+
#
|
255
273
|
# handle a message asking about a keyword
|
256
|
-
def
|
274
|
+
def keyword_lookup(m, key, quiet = false)
|
257
275
|
return if key.nil?
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
276
|
+
unless(kw = self[key])
|
277
|
+
m.reply "sorry, I don't know about \"#{key}\"" unless quiet
|
278
|
+
return
|
279
|
+
end
|
280
|
+
|
281
|
+
response = kw.to_s
|
282
|
+
response.gsub!(/<who>/, m.sourcenick)
|
283
|
+
|
284
|
+
if(response =~ /^<reply>\s*(.*)/)
|
285
|
+
m.reply $1
|
286
|
+
elsif(response =~ /^<action>\s*(.*)/)
|
287
|
+
m.act $1
|
288
|
+
elsif(m.public? && response =~ /^<topic>\s*(.*)/)
|
289
|
+
@bot.topic m.target, $1
|
290
|
+
else
|
291
|
+
m.reply "#{key} #{kw.type} #{response}"
|
292
|
+
end
|
274
293
|
end
|
275
294
|
|
276
|
-
|
295
|
+
|
277
296
|
# handle a message which alters a keyword
|
278
|
-
# like "foo is bar"
|
279
|
-
def keyword_command(
|
297
|
+
# like "foo is bar" or "foo is also qux"
|
298
|
+
def keyword_command(m, lhs, mhs, rhs, quiet = false)
|
280
299
|
debug "got keyword command #{lhs}, #{mhs}, #{rhs}"
|
300
|
+
return if lhs.strip.empty?
|
301
|
+
|
281
302
|
overwrite = false
|
282
303
|
overwrite = true if(lhs.gsub!(/^no,\s*/, ""))
|
304
|
+
also = false
|
283
305
|
also = true if(rhs.gsub!(/^also\s+/, ""))
|
306
|
+
|
284
307
|
values = rhs.split(/\s+\|\s+/)
|
285
308
|
lhs = Keyword.unescape lhs
|
309
|
+
|
286
310
|
if(overwrite || also || !has_key?(lhs))
|
287
311
|
if(also && has_key?(lhs))
|
288
312
|
kw = self[lhs]
|
@@ -291,67 +315,65 @@ class Keywords < Plugin
|
|
291
315
|
else
|
292
316
|
@keywords[lhs] = Keyword.new(mhs, values).dump
|
293
317
|
end
|
294
|
-
|
318
|
+
m.okay if !quiet
|
295
319
|
elsif(has_key?(lhs))
|
296
320
|
kw = self[lhs]
|
297
|
-
|
321
|
+
m.reply "but #{lhs} #{kw.type} #{kw.desc}" if kw && !quiet
|
298
322
|
end
|
299
323
|
end
|
300
324
|
|
301
325
|
# return help string for Keywords with option topic +topic+
|
302
|
-
def help(plugin, topic=
|
303
|
-
case
|
304
|
-
|
305
|
-
|
306
|
-
when
|
307
|
-
|
308
|
-
when
|
309
|
-
|
310
|
-
when
|
311
|
-
|
312
|
-
when
|
313
|
-
|
314
|
-
when
|
315
|
-
|
316
|
-
when
|
317
|
-
|
318
|
-
when
|
319
|
-
|
320
|
-
when
|
321
|
-
|
322
|
-
when
|
323
|
-
|
324
|
-
when
|
325
|
-
|
326
|
-
when
|
327
|
-
|
328
|
-
when "<who>"
|
329
|
-
return "<who> => replaced with questioner in reply"
|
330
|
-
when "<topic>"
|
331
|
-
return "<topic> => respond by setting the topic to the rest of the definition"
|
332
|
-
when "search"
|
333
|
-
return "keywords search [--all] [--full] <regexp> => search keywords for <regexp>. If --all is set, search static keywords too, if --full is set, search definitions too."
|
326
|
+
def help(plugin, topic = '')
|
327
|
+
case plugin
|
328
|
+
when /keyword/
|
329
|
+
case topic
|
330
|
+
when 'lookup'
|
331
|
+
'keyword [lookup] <keyword> => look up the definition for a keyword; writing "lookup" is optional'
|
332
|
+
when 'set'
|
333
|
+
'keyword set <keyword> is/are <definition> => define a keyword, definition can contain "|" to separate multiple randomly chosen replies'
|
334
|
+
when 'forget'
|
335
|
+
'keyword forget <keyword> => forget a keyword'
|
336
|
+
when 'tell'
|
337
|
+
'keyword tell <nick> about <keyword> => tell somebody about a keyword'
|
338
|
+
when 'search'
|
339
|
+
'keyword search [--all] [--full] <pattern> => search keywords for <pattern>, which can be a regular expression. If --all is set, search static keywords too, if --full is set, search definitions too.'
|
340
|
+
when 'listen'
|
341
|
+
'when the config option "keyword.listen" is set to false, rbot will try to extract keyword definitions from regular channel messages'
|
342
|
+
when 'address'
|
343
|
+
'when the config option "keyword.address" is set to true, rbot will try to answer channel questions of the form "<keyword>?"'
|
344
|
+
when '<reply>'
|
345
|
+
'<reply> => normal response is "<keyword> is <definition>", but if <definition> begins with <reply>, the response will be "<definition>"'
|
346
|
+
when '<action>'
|
347
|
+
'<action> => makes keyword respond with "/me <definition>"'
|
348
|
+
when '<who>'
|
349
|
+
'<who> => replaced with questioner in reply'
|
350
|
+
when '<topic>'
|
351
|
+
'<topic> => respond by setting the topic to the rest of the definition'
|
334
352
|
else
|
335
|
-
|
353
|
+
'keyword module (fact learning and regurgitation) topics: lookup, set, forget, tell, search, listen, address, <reply>, <action>, <who>, <topic>'
|
354
|
+
end
|
355
|
+
when "forget"
|
356
|
+
'forget <keyword> => forget a keyword'
|
357
|
+
when "tell"
|
358
|
+
'tell <nick> about <keyword> => tell somebody about a keyword'
|
359
|
+
when "learn"
|
360
|
+
'learn that <keyword> is/are <definition> => define a keyword, definition can contain "|" to separate multiple randomly chosen replies'
|
361
|
+
else
|
362
|
+
'keyword module (fact learning and regurgitation) topics: lookup, set, forget, tell, search, listen, address, <reply>, <action>, <who>, <topic>'
|
336
363
|
end
|
337
364
|
end
|
338
365
|
|
339
366
|
# handle a message asking the bot to tell someone about a keyword
|
340
|
-
def keyword_tell(m,
|
341
|
-
target = param[:target]
|
342
|
-
key = nil
|
343
|
-
|
344
|
-
# extract the keyword from the message, because unfortunately
|
345
|
-
# the message mapper doesn't preserve whtiespace
|
346
|
-
if m.message =~ /about\s+(.+)$/
|
347
|
-
key = $1
|
348
|
-
end
|
349
|
-
|
367
|
+
def keyword_tell(m, target, key)
|
350
368
|
unless(kw = self[key])
|
351
369
|
m.reply @bot.lang.get("dunno_about_X") % key
|
352
370
|
return
|
353
371
|
end
|
354
|
-
|
372
|
+
if target == @bot.nick
|
373
|
+
m.reply "very funny, trying to make me tell something to myself"
|
374
|
+
return
|
375
|
+
end
|
376
|
+
|
355
377
|
response = kw.to_s
|
356
378
|
response.gsub!(/<who>/, m.sourcenick)
|
357
379
|
if(response =~ /^<reply>\s*(.*)/)
|
@@ -367,7 +389,7 @@ class Keywords < Plugin
|
|
367
389
|
end
|
368
390
|
|
369
391
|
# return the number of known keywords
|
370
|
-
def keyword_stats(m
|
392
|
+
def keyword_stats(m)
|
371
393
|
length = 0
|
372
394
|
@statickeywords.each {|k,v|
|
373
395
|
length += v.length
|
@@ -376,95 +398,171 @@ class Keywords < Plugin
|
|
376
398
|
end
|
377
399
|
|
378
400
|
# search for keywords, optionally also the definition and the static keywords
|
379
|
-
def keyword_search(m,
|
380
|
-
str = param[:pattern]
|
381
|
-
all = (param[:all] == '--all')
|
382
|
-
full = (param[:full] == '--full')
|
383
|
-
|
401
|
+
def keyword_search(m, key, full = false, all = false, from = 1)
|
384
402
|
begin
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
if
|
395
|
-
|
396
|
-
v.each {|kk,vv|
|
397
|
-
kw = Keyword.restore(vv)
|
398
|
-
if re.match(kk) || (full && re.match(kw.desc))
|
399
|
-
matches << [kk,kw]
|
400
|
-
end
|
401
|
-
}
|
402
|
-
}
|
403
|
+
if key =~ /^\/(.+)\/$/
|
404
|
+
re = Regexp.new($1, Regexp::IGNORECASE)
|
405
|
+
else
|
406
|
+
re = Regexp.new(Regexp.escape(key), Regexp::IGNORECASE)
|
407
|
+
end
|
408
|
+
|
409
|
+
matches = Array.new
|
410
|
+
@keywords.each {|k,v|
|
411
|
+
kw = Keyword.restore(v)
|
412
|
+
if re.match(k) || (full && re.match(kw.desc))
|
413
|
+
matches << [k,kw]
|
403
414
|
end
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
break if i == 3
|
415
|
+
}
|
416
|
+
if all
|
417
|
+
@statickeywords.each {|k,v|
|
418
|
+
v.each {|kk,vv|
|
419
|
+
kw = Keyword.restore(vv)
|
420
|
+
if re.match(kk) || (full && re.match(kw.desc))
|
421
|
+
matches << [kk,kw]
|
422
|
+
end
|
413
423
|
}
|
414
|
-
|
415
|
-
|
424
|
+
}
|
425
|
+
end
|
426
|
+
|
427
|
+
if matches.length == 1
|
428
|
+
rkw = matches[0]
|
429
|
+
m.reply "#{rkw[0]} #{rkw[1].type} #{rkw[1].desc}"
|
430
|
+
elsif matches.length > 0
|
431
|
+
if from > matches.length
|
432
|
+
m.reply "#{matches.length} found, can't tell you about #{from}"
|
433
|
+
return
|
416
434
|
end
|
435
|
+
i = 1
|
436
|
+
matches.each {|rkw|
|
437
|
+
m.reply "[#{i}/#{matches.length}] #{rkw[0]} #{rkw[1].type} #{rkw[1].desc}" if i >= from
|
438
|
+
i += 1
|
439
|
+
break if i == from+@bot.config['keyword.search_results']
|
440
|
+
}
|
441
|
+
else
|
442
|
+
m.reply "no keywords match #{key}"
|
417
443
|
end
|
418
444
|
rescue RegexpError => e
|
419
|
-
m.reply "no keywords match #{
|
445
|
+
m.reply "no keywords match #{key}: #{e}"
|
420
446
|
rescue
|
421
447
|
debug e.inspect
|
422
|
-
m.reply "no keywords match #{
|
448
|
+
m.reply "no keywords match #{key}: an error occurred"
|
423
449
|
end
|
424
450
|
end
|
425
451
|
|
426
452
|
# forget one of the dynamic keywords
|
427
|
-
def keyword_forget(m,
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
453
|
+
def keyword_forget(m, key)
|
454
|
+
if @keywords.delete(key)
|
455
|
+
m.okay
|
456
|
+
else
|
457
|
+
m.reply _("couldn't find keyword %{key}" % { :key => key })
|
458
|
+
end
|
459
|
+
end
|
460
|
+
|
461
|
+
# low-level keyword wipe command for when forget doesn't work
|
462
|
+
def keyword_wipe(m, key)
|
463
|
+
reg = @keywords.registry
|
464
|
+
reg.env.begin(reg) { |t, b|
|
465
|
+
b.delete_if { |k, v|
|
466
|
+
(k == key) && (m.reply "wiping keyword #{key} with stored value #{Marshal.restore(v)}")
|
467
|
+
}
|
468
|
+
t.commit
|
469
|
+
}
|
470
|
+
m.reply "done"
|
471
|
+
end
|
472
|
+
|
473
|
+
# export keywords to factoids file
|
474
|
+
def keyword_factoids_export
|
475
|
+
ar = Array.new
|
476
|
+
|
477
|
+
debug @keywords.keys
|
478
|
+
|
479
|
+
@keywords.each { |k, val|
|
480
|
+
next unless val
|
481
|
+
kw = Keyword.restore(val)
|
482
|
+
ar |= kw.to_factoids(k)
|
483
|
+
}
|
484
|
+
|
485
|
+
# TODO check factoids config
|
486
|
+
# also TODO: runtime export
|
487
|
+
dir = File.join(@bot.botclass,"factoids")
|
488
|
+
fname = File.join(dir,"keyword_factoids.rbot")
|
489
|
+
|
490
|
+
Dir.mkdir(dir) unless FileTest.directory?(dir)
|
491
|
+
Utils.safe_save(fname) do |file|
|
492
|
+
file.puts ar
|
432
493
|
end
|
433
494
|
end
|
434
495
|
|
435
496
|
# privmsg handler
|
436
|
-
def
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
497
|
+
def privmsg(m)
|
498
|
+
case m.plugin
|
499
|
+
when "keyword"
|
500
|
+
case m.params
|
501
|
+
when /^export$/
|
502
|
+
begin
|
503
|
+
keyword_factoids_export
|
504
|
+
m.okay
|
505
|
+
rescue
|
506
|
+
m.reply _("failed to export keywords as factoids (%{err})" % {:err => $!})
|
507
|
+
end
|
508
|
+
when /^set\s+(.+?)\s+(is|are)\s+(.+)$/
|
509
|
+
keyword_command(m, $1, $2, $3) if @bot.auth.allow?('keycmd', m.source, m.replyto)
|
510
|
+
when /^forget\s+(.+)$/
|
511
|
+
keyword_forget(m, $1) if @bot.auth.allow?('keycmd', m.source, m.replyto)
|
512
|
+
when /^wipe\s(.+)$/ # note that only one space is stripped, allowing removal of space-prefixed keywords
|
513
|
+
keyword_wipe(m, $1) if @bot.auth.allow?('keycmd', m.source, m.replyto)
|
514
|
+
when /^lookup\s+(.+)$/
|
515
|
+
keyword_lookup(m, $1) if @bot.auth.allow?('keyword', m.source, m.replyto)
|
516
|
+
when /^stats\s*$/
|
517
|
+
keyword_stats(m) if @bot.auth.allow?('keyword', m.source, m.replyto)
|
518
|
+
when /^search\s+(.+)$/
|
519
|
+
key = $1
|
520
|
+
full = key.sub!('--full ', '')
|
521
|
+
all = key.sub!('--all ', '')
|
522
|
+
if key.sub!(/--from (\d+) /, '')
|
523
|
+
from = $1.to_i
|
524
|
+
else
|
525
|
+
from = 1
|
526
|
+
end
|
527
|
+
from = 1 unless from > 0
|
528
|
+
keyword_search(m, key, full, all, from) if @bot.auth.allow?('keyword', m.source, m.replyto)
|
529
|
+
when /^tell\s+(\S+)\s+about\s+(.+)$/
|
530
|
+
keyword_tell(m, $1, $2) if @bot.auth.allow?('keyword', m.source, m.replyto)
|
531
|
+
else
|
532
|
+
keyword_lookup(m, m.params) if @bot.auth.allow?('keyword', m.source, m.replyto)
|
443
533
|
end
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
534
|
+
when "forget"
|
535
|
+
keyword_forget(m, m.params) if @bot.auth.allow?('keycmd', m.source, m.replyto)
|
536
|
+
when "tell"
|
537
|
+
if m.params =~ /(\S+)\s+about\s+(.+)$/
|
538
|
+
keyword_tell(m, $1, $2) if @bot.auth.allow?('keyword', m.source, m.replyto)
|
539
|
+
else
|
540
|
+
m.reply "wrong 'tell' syntax"
|
541
|
+
end
|
542
|
+
when "learn"
|
543
|
+
if m.params =~ /^that\s+(.+?)\s+(is|are)\s+(.+)$/
|
544
|
+
keyword_command(m, $1, $2, $3) if @bot.auth.allow?('keycmd', m.source, m.replyto)
|
545
|
+
else
|
546
|
+
m.reply "wrong 'learn' syntax"
|
453
547
|
end
|
454
548
|
end
|
455
549
|
end
|
550
|
+
|
551
|
+
def unreplied(m)
|
552
|
+
# TODO option to do if(m.message =~ /^(.*)$/, ie try any line as a
|
553
|
+
# keyword lookup.
|
554
|
+
if m.message =~ /^(.*\S)\s*\?\s*$/ and (m.address? or not @bot.config["keyword.address"])
|
555
|
+
keyword_lookup m, $1, true if !ignored_word?($1) && @bot.auth.allow?("keyword", m.source)
|
556
|
+
elsif @bot.config["keyword.listen"] && (m.message =~ /^(.*?)\s+(is|are)\s+(.*)$/)
|
557
|
+
# TODO MUCH more selective on what's allowed here
|
558
|
+
keyword_command m, $1, $2, $3, true if !ignored_word?($1) && @bot.auth.allow?("keycmd", m.source)
|
559
|
+
end
|
560
|
+
end
|
456
561
|
end
|
457
562
|
|
458
563
|
plugin = Keywords.new
|
564
|
+
plugin.register 'keyword'
|
565
|
+
plugin.register 'forget' rescue nil
|
566
|
+
plugin.register 'tell' rescue nil
|
567
|
+
plugin.register 'learn' rescue nil
|
459
568
|
|
460
|
-
plugin.map 'keyword stats', :action => 'keyword_stats'
|
461
|
-
|
462
|
-
plugin.map 'keyword search :all :full :pattern', :action => 'keyword_search',
|
463
|
-
:defaults => {:all => '', :full => ''},
|
464
|
-
:requirements => {:all => '--all', :full => '--full'}
|
465
|
-
|
466
|
-
plugin.map 'keyword forget :key', :action => 'keyword_forget'
|
467
|
-
plugin.map 'forget :key', :action => 'keyword_forget', :auth => 'keycmd'
|
468
|
-
|
469
|
-
plugin.map 'keyword tell :target about *keyword', :action => 'keyword_tell'
|
470
|
-
plugin.map 'tell :target about *keyword', :action => 'keyword_tell', :auth => 'keyword'
|