rbot 0.9.14 → 0.9.15
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +6 -2
- data/REQUIREMENTS +7 -1
- data/Rakefile +10 -32
- data/bin/rbot +6 -1
- data/bin/svnwatch-postcommit-hook +68 -0
- data/data/rbot/contrib/plugins/stats.rb +3 -3
- data/data/rbot/contrib/plugins/vandale.rb +1 -1
- data/data/rbot/filters/rss.rb +72 -0
- data/data/rbot/languages/finnish.lang +50 -0
- data/data/rbot/plugins/alias.rb +6 -6
- data/data/rbot/plugins/autorejoin.rb +41 -2
- data/data/rbot/plugins/bans.rb +100 -6
- data/data/rbot/plugins/bash.rb +9 -4
- data/data/rbot/plugins/cal.rb +1 -1
- data/data/rbot/plugins/chucknorris.rb +6 -6
- data/data/rbot/plugins/debugger.rb +7 -3
- data/data/rbot/plugins/deepthoughts.rb +1 -1
- data/data/rbot/plugins/delicious.rb +6 -2
- data/data/rbot/plugins/dice.rb +7 -7
- data/data/rbot/plugins/dict.rb +4 -3
- data/data/rbot/plugins/dictclient.rb +17 -13
- data/data/rbot/plugins/digg.rb +3 -3
- data/data/rbot/plugins/eightball.rb +1 -1
- data/data/rbot/plugins/factoids.rb +13 -4
- data/data/rbot/plugins/figlet.rb +4 -4
- data/data/rbot/plugins/forecast.rb +3 -3
- data/data/rbot/plugins/fortune.rb +14 -8
- data/data/rbot/plugins/freshmeat.rb +2 -2
- data/data/rbot/plugins/games/azgame.rb +72 -19
- data/data/rbot/plugins/games/hangman.rb +499 -0
- data/data/rbot/plugins/games/quiz.rb +15 -13
- data/data/rbot/plugins/games/roshambo.rb +1 -1
- data/data/rbot/plugins/games/roulette.rb +4 -4
- data/data/rbot/plugins/games/shiritori.rb +31 -31
- data/data/rbot/plugins/games/uno.rb +28 -6
- data/data/rbot/plugins/games/wheelfortune.rb +1 -3
- data/data/rbot/plugins/geoip.rb +83 -28
- data/data/rbot/plugins/googlefight.rb +64 -0
- data/data/rbot/plugins/greet.rb +45 -0
- data/data/rbot/plugins/grouphug.rb +40 -12
- data/data/rbot/plugins/imdb.rb +4 -4
- data/data/rbot/plugins/insult.rb +2 -2
- data/data/rbot/plugins/karma.rb +6 -5
- data/data/rbot/plugins/keywords.rb +26 -22
- data/data/rbot/plugins/lart.rb +5 -6
- data/data/rbot/plugins/lastfm.rb +488 -125
- data/data/rbot/plugins/lib_spotify.rb +84 -0
- data/data/rbot/plugins/linkbot.rb +1 -1
- data/data/rbot/plugins/markov.rb +567 -78
- data/data/rbot/plugins/math.rb +3 -3
- data/data/rbot/plugins/modes.rb +1 -1
- data/data/rbot/plugins/nickrecover.rb +1 -1
- data/data/rbot/plugins/nickserv.rb +7 -7
- data/data/rbot/plugins/note.rb +55 -0
- data/data/rbot/plugins/nslookup.rb +2 -2
- data/data/rbot/plugins/quakeauth.rb +4 -4
- data/data/rbot/plugins/quotes.rb +53 -19
- data/data/rbot/plugins/reaction.rb +76 -19
- data/data/rbot/plugins/remind.rb +3 -96
- data/data/rbot/plugins/ri.rb +1 -1
- data/data/rbot/plugins/rot13.rb +1 -1
- data/data/rbot/plugins/rss.rb +296 -190
- data/data/rbot/plugins/salut.rb +8 -8
- data/data/rbot/plugins/script.rb +48 -11
- data/data/rbot/plugins/search.rb +124 -28
- data/data/rbot/plugins/seen.rb +162 -31
- data/data/rbot/plugins/shortenurls.rb +1 -1
- data/data/rbot/plugins/slashdot.rb +19 -6
- data/data/rbot/plugins/spotify.rb +78 -0
- data/data/rbot/plugins/theyfightcrime.rb +10 -10
- data/data/rbot/plugins/time.rb +2 -2
- data/data/rbot/plugins/translator.rb +161 -85
- data/data/rbot/plugins/tube.rb +2 -2
- data/data/rbot/plugins/tumblr.rb +143 -0
- data/data/rbot/plugins/twitter.rb +25 -6
- data/data/rbot/plugins/urban.rb +6 -4
- data/data/rbot/plugins/url.rb +49 -10
- data/data/rbot/plugins/weather.rb +6 -6
- data/data/rbot/plugins/wserver.rb +5 -5
- data/data/rbot/plugins/youtube.rb +12 -12
- data/data/rbot/templates/lart/larts-italian +1 -1
- data/launch_here.rb +68 -0
- data/lib/rbot/botuser.rb +1 -1
- data/lib/rbot/compat19.rb +70 -0
- data/lib/rbot/config.rb +8 -6
- data/lib/rbot/core/auth.rb +37 -21
- data/lib/rbot/core/basics.rb +33 -2
- data/lib/rbot/core/config.rb +24 -17
- data/lib/rbot/core/filters_ui.rb +2 -2
- data/lib/rbot/core/irclog.rb +20 -11
- data/lib/rbot/core/remote.rb +9 -9
- data/lib/rbot/core/unicode.rb +4 -0
- data/lib/rbot/core/userdata.rb +16 -1
- data/lib/rbot/core/utils/extends.rb +76 -0
- data/lib/rbot/core/utils/filters.rb +47 -0
- data/lib/rbot/core/utils/httputil.rb +36 -26
- data/lib/rbot/core/utils/parse_time.rb +193 -0
- data/lib/rbot/core/utils/utils.rb +81 -56
- data/lib/rbot/core/utils/wordlist.rb +66 -0
- data/lib/rbot/core/wordlist_ui.rb +27 -0
- data/lib/rbot/irc.rb +59 -19
- data/lib/rbot/ircbot.rb +190 -58
- data/lib/rbot/ircsocket.rb +14 -8
- data/lib/rbot/language.rb +4 -3
- data/lib/rbot/load-gettext.rb +22 -9
- data/lib/rbot/message.rb +89 -18
- data/lib/rbot/messagemapper.rb +71 -19
- data/lib/rbot/plugins.rb +112 -44
- data/lib/rbot/{registry.rb → registry/bdb.rb} +226 -22
- data/lib/rbot/registry/tc.rb +531 -0
- data/lib/rbot/rfc2812.rb +33 -8
- data/lib/rbot/timer.rb +12 -20
- data/po/en_US/rbot-autorejoin.po +3 -0
- data/po/en_US/rbot-azgame.po +51 -43
- data/po/en_US/rbot-bash.po +15 -0
- data/po/en_US/rbot-dictclient.po +20 -20
- data/po/en_US/rbot-factoids.po +9 -9
- data/po/en_US/rbot-geoip.po +0 -0
- data/po/en_US/rbot-googlefight.po +24 -0
- data/po/en_US/rbot-grouphug.po +4 -4
- data/po/en_US/rbot-hangman.po +114 -0
- data/po/en_US/rbot-keywords.po +3 -3
- data/po/en_US/rbot-lastfm.po +268 -70
- data/po/en_US/rbot-markov.po +73 -2
- data/po/en_US/rbot-quotes.po +21 -21
- data/po/en_US/rbot-rss.po +6 -2
- data/po/en_US/rbot-script.po +3 -0
- data/po/en_US/rbot-seen.po +72 -0
- data/po/en_US/rbot-spell.po +2 -2
- data/po/en_US/rbot-translator.po +13 -13
- data/po/en_US/rbot-twitter.po +3 -3
- data/po/en_US/rbot-uno.po +131 -114
- data/po/en_US/rbot-wall.po +12 -13
- data/po/en_US/rbot-wheelfortune.po +41 -41
- data/po/en_US/rbot.po +254 -194
- data/po/fi/rbot-alias.po +82 -0
- data/po/fi/rbot-autoop.po +0 -0
- data/po/fi/rbot-autorejoin.po +20 -0
- data/po/fi/rbot-azgame.po +194 -0
- data/po/fi/rbot-bans.po +0 -0
- data/po/fi/rbot-bash.po +32 -0
- data/po/fi/rbot-botsnack.po +0 -0
- data/po/fi/rbot-cal.po +20 -0
- data/po/fi/rbot-chanserv.po +0 -0
- data/po/fi/rbot-chucknorris.po +0 -0
- data/po/fi/rbot-debugger.po +0 -0
- data/po/fi/rbot-deepthoughts.po +0 -0
- data/po/fi/rbot-delicious.po +0 -0
- data/po/fi/rbot-dice.po +0 -0
- data/po/fi/rbot-dict.po +0 -0
- data/po/fi/rbot-dictclient.po +111 -0
- data/po/fi/rbot-digg.po +0 -0
- data/po/fi/rbot-eightball.po +0 -0
- data/po/fi/rbot-excuse.po +0 -0
- data/po/fi/rbot-factoids.po +107 -0
- data/po/fi/rbot-figlet.po +36 -0
- data/po/fi/rbot-fish.po +0 -0
- data/po/fi/rbot-forecast.po +0 -0
- data/po/fi/rbot-fortune.po +0 -0
- data/po/fi/rbot-freshmeat.po +0 -0
- data/po/fi/rbot-geoip.po +0 -0
- data/po/fi/rbot-googlefight.po +24 -0
- data/po/fi/rbot-grouphug.po +35 -0
- data/po/fi/rbot-hangman.po +121 -0
- data/po/fi/rbot-hl2.po +0 -0
- data/po/fi/rbot-host.po +20 -0
- data/po/fi/rbot-imdb.po +0 -0
- data/po/fi/rbot-insult.po +0 -0
- data/po/fi/rbot-iplookup.po +0 -0
- data/po/fi/rbot-karma.po +0 -0
- data/po/fi/rbot-keywords.po +24 -0
- data/po/fi/rbot-lart.po +0 -0
- data/po/fi/rbot-lastfm.po +377 -0
- data/po/fi/rbot-linkbot.po +0 -0
- data/po/fi/rbot-markov.po +91 -0
- data/po/fi/rbot-math.po +0 -0
- data/po/fi/rbot-modes.po +0 -0
- data/po/fi/rbot-nickrecover.po +36 -0
- data/po/fi/rbot-nickserv.po +104 -0
- data/po/fi/rbot-nslookup.po +0 -0
- data/po/fi/rbot-quakeauth.po +0 -0
- data/po/fi/rbot-quiz.po +0 -0
- data/po/fi/rbot-quotes.po +108 -0
- data/po/fi/rbot-reaction.po +0 -0
- data/po/fi/rbot-remind.po +0 -0
- data/po/fi/rbot-remotectl.po +0 -0
- data/po/fi/rbot-ri.po +0 -0
- data/po/fi/rbot-roshambo.po +0 -0
- data/po/fi/rbot-rot13.po +0 -0
- data/po/fi/rbot-roulette.po +0 -0
- data/po/fi/rbot-rss.po +24 -0
- data/po/fi/rbot-salut.po +0 -0
- data/po/fi/rbot-script.po +20 -0
- data/po/fi/rbot-search.po +0 -0
- data/po/fi/rbot-seen.po +92 -0
- data/po/fi/rbot-shiritori.po +102 -0
- data/po/fi/rbot-shortenurls.po +0 -0
- data/po/fi/rbot-slashdot.po +0 -0
- data/po/fi/rbot-spell.po +54 -0
- data/po/fi/rbot-theyfightcrime.po +0 -0
- data/po/fi/rbot-threat.po +0 -0
- data/po/fi/rbot-time.po +0 -0
- data/po/fi/rbot-topic.po +0 -0
- data/po/fi/rbot-translator.po +77 -0
- data/po/fi/rbot-tube.po +0 -0
- data/po/fi/rbot-twitter.po +24 -0
- data/po/fi/rbot-uno.po +529 -0
- data/po/fi/rbot-urban.po +0 -0
- data/po/fi/rbot-url.po +0 -0
- data/po/fi/rbot-usermodes.po +0 -0
- data/po/fi/rbot-wall.po +32 -0
- data/po/fi/rbot-weather.po +0 -0
- data/po/fi/rbot-wheelfortune.po +205 -0
- data/po/fi/rbot-wow.po +0 -0
- data/po/fi/rbot-wserver.po +0 -0
- data/po/fi/rbot-youtube.po +58 -0
- data/po/fi/rbot.po +1152 -0
- data/po/fr/rbot-autorejoin.po +3 -0
- data/po/fr/rbot-azgame.po +51 -43
- data/po/fr/rbot-bash.po +15 -0
- data/po/fr/rbot-dictclient.po +20 -20
- data/po/fr/rbot-factoids.po +9 -9
- data/po/fr/rbot-geoip.po +0 -0
- data/po/fr/rbot-googlefight.po +24 -0
- data/po/fr/rbot-grouphug.po +4 -4
- data/po/fr/rbot-hangman.po +114 -0
- data/po/fr/rbot-keywords.po +3 -3
- data/po/fr/rbot-lastfm.po +268 -70
- data/po/fr/rbot-markov.po +74 -2
- data/po/fr/rbot-quotes.po +21 -21
- data/po/fr/rbot-rss.po +6 -2
- data/po/fr/rbot-script.po +3 -0
- data/po/fr/rbot-seen.po +72 -0
- data/po/fr/rbot-spell.po +2 -2
- data/po/fr/rbot-translator.po +13 -13
- data/po/fr/rbot-twitter.po +3 -3
- data/po/fr/rbot-uno.po +132 -114
- data/po/fr/rbot-wall.po +8 -9
- data/po/fr/rbot-wheelfortune.po +41 -41
- data/po/fr/rbot.po +268 -197
- data/po/it/rbot-autorejoin.po +3 -0
- data/po/it/rbot-azgame.po +50 -42
- data/po/it/rbot-bash.po +15 -0
- data/po/it/rbot-dictclient.po +20 -20
- data/po/it/rbot-factoids.po +9 -9
- data/po/it/rbot-geoip.po +0 -0
- data/po/it/rbot-googlefight.po +24 -0
- data/po/it/rbot-grouphug.po +4 -4
- data/po/it/rbot-hangman.po +114 -0
- data/po/it/rbot-keywords.po +3 -3
- data/po/it/rbot-lastfm.po +268 -70
- data/po/it/rbot-markov.po +75 -3
- data/po/it/rbot-quotes.po +21 -21
- data/po/it/rbot-rss.po +7 -3
- data/po/it/rbot-script.po +19 -0
- data/po/it/rbot-seen.po +72 -0
- data/po/it/rbot-spell.po +2 -2
- data/po/it/rbot-translator.po +13 -13
- data/po/it/rbot-twitter.po +3 -3
- data/po/it/rbot-uno.po +137 -116
- data/po/it/rbot-wall.po +8 -9
- data/po/it/rbot-wheelfortune.po +41 -41
- data/po/it/rbot.po +265 -208
- data/po/ja/rbot-autorejoin.po +3 -0
- data/po/ja/rbot-azgame.po +51 -43
- data/po/ja/rbot-bash.po +15 -0
- data/po/ja/rbot-dictclient.po +20 -20
- data/po/ja/rbot-factoids.po +9 -9
- data/po/ja/rbot-geoip.po +0 -0
- data/po/ja/rbot-googlefight.po +24 -0
- data/po/ja/rbot-grouphug.po +4 -4
- data/po/ja/rbot-hangman.po +114 -0
- data/po/ja/rbot-keywords.po +3 -3
- data/po/ja/rbot-lastfm.po +268 -70
- data/po/ja/rbot-markov.po +73 -2
- data/po/ja/rbot-quotes.po +21 -21
- data/po/ja/rbot-rss.po +6 -2
- data/po/ja/rbot-script.po +3 -0
- data/po/ja/rbot-seen.po +72 -0
- data/po/ja/rbot-spell.po +2 -2
- data/po/ja/rbot-translator.po +13 -13
- data/po/ja/rbot-twitter.po +3 -3
- data/po/ja/rbot-uno.po +131 -114
- data/po/ja/rbot-wall.po +8 -9
- data/po/ja/rbot-wheelfortune.po +41 -41
- data/po/ja/rbot.po +248 -192
- data/po/rbot-alias.pot +2 -2
- data/po/rbot-autorejoin.pot +21 -0
- data/po/rbot-azgame.pot +51 -43
- data/po/rbot-bash.pot +33 -0
- data/po/rbot-cal.pot +2 -2
- data/po/rbot-dictclient.pot +21 -21
- data/po/rbot-factoids.pot +10 -10
- data/po/rbot-figlet.pot +2 -2
- data/po/rbot-geoip.pot +0 -0
- data/po/rbot-googlefight.pot +25 -0
- data/po/rbot-grouphug.pot +6 -6
- data/po/rbot-hangman.pot +115 -0
- data/po/rbot-host.pot +2 -2
- data/po/rbot-keywords.pot +4 -4
- data/po/rbot-lastfm.pot +270 -72
- data/po/rbot-markov.pot +74 -3
- data/po/rbot-nickrecover.pot +2 -2
- data/po/rbot-nickserv.pot +2 -2
- data/po/rbot-quotes.pot +22 -22
- data/po/rbot-rss.pot +7 -3
- data/po/rbot-script.pot +21 -0
- data/po/rbot-seen.pot +90 -0
- data/po/rbot-shiritori.pot +2 -2
- data/po/rbot-spell.pot +3 -3
- data/po/rbot-translator.pot +14 -14
- data/po/rbot-twitter.pot +4 -4
- data/po/rbot-uno.pot +132 -115
- data/po/rbot-wall.pot +2 -2
- data/po/rbot-wheelfortune.pot +42 -42
- data/po/rbot-youtube.pot +2 -2
- data/po/rbot.pot +249 -193
- data/po/zh_CN/rbot-autorejoin.po +3 -0
- data/po/zh_CN/rbot-azgame.po +50 -42
- data/po/zh_CN/rbot-bash.po +15 -0
- data/po/zh_CN/rbot-dictclient.po +20 -20
- data/po/zh_CN/rbot-factoids.po +9 -9
- data/po/zh_CN/rbot-geoip.po +0 -0
- data/po/zh_CN/rbot-googlefight.po +24 -0
- data/po/zh_CN/rbot-grouphug.po +4 -4
- data/po/zh_CN/rbot-hangman.po +114 -0
- data/po/zh_CN/rbot-keywords.po +3 -3
- data/po/zh_CN/rbot-lastfm.po +268 -70
- data/po/zh_CN/rbot-markov.po +73 -2
- data/po/zh_CN/rbot-quotes.po +21 -21
- data/po/zh_CN/rbot-rss.po +6 -2
- data/po/zh_CN/rbot-script.po +3 -0
- data/po/zh_CN/rbot-seen.po +72 -0
- data/po/zh_CN/rbot-spell.po +2 -2
- data/po/zh_CN/rbot-translator.po +13 -13
- data/po/zh_CN/rbot-twitter.po +3 -3
- data/po/zh_CN/rbot-uno.po +131 -114
- data/po/zh_CN/rbot-wall.po +7 -8
- data/po/zh_CN/rbot-wheelfortune.po +41 -41
- data/po/zh_CN/rbot.po +248 -192
- data/po/zh_TW/rbot-autorejoin.po +3 -0
- data/po/zh_TW/rbot-azgame.po +50 -42
- data/po/zh_TW/rbot-bash.po +15 -0
- data/po/zh_TW/rbot-dictclient.po +20 -20
- data/po/zh_TW/rbot-factoids.po +9 -9
- data/po/zh_TW/rbot-geoip.po +0 -0
- data/po/zh_TW/rbot-googlefight.po +24 -0
- data/po/zh_TW/rbot-grouphug.po +4 -4
- data/po/zh_TW/rbot-hangman.po +114 -0
- data/po/zh_TW/rbot-keywords.po +3 -3
- data/po/zh_TW/rbot-lastfm.po +268 -70
- data/po/zh_TW/rbot-markov.po +73 -2
- data/po/zh_TW/rbot-quotes.po +21 -21
- data/po/zh_TW/rbot-rss.po +6 -2
- data/po/zh_TW/rbot-script.po +3 -0
- data/po/zh_TW/rbot-seen.po +72 -0
- data/po/zh_TW/rbot-spell.po +2 -2
- data/po/zh_TW/rbot-translator.po +13 -13
- data/po/zh_TW/rbot-twitter.po +3 -3
- data/po/zh_TW/rbot-uno.po +131 -114
- data/po/zh_TW/rbot-wall.po +7 -8
- data/po/zh_TW/rbot-wheelfortune.po +41 -41
- data/po/zh_TW/rbot.po +253 -194
- data/setup.rb +4 -4
- metadata +127 -18
- data/README +0 -43
- data/data/rbot/plugins/fish.rb +0 -121
- data/lib/rbot/dbhash.rb +0 -199
data/data/rbot/plugins/seen.rb
CHANGED
@@ -8,10 +8,33 @@
|
|
8
8
|
define_structure :Saw, :nick, :time, :type, :where, :message
|
9
9
|
|
10
10
|
class SeenPlugin < Plugin
|
11
|
+
|
12
|
+
MSG_PUBLIC = N_("saying \"%{message}\" in %{where}")
|
13
|
+
MSG_ACTION = N_("doing *%{nick} %{message}* in %{where}")
|
14
|
+
MSG_NICK = N_("changing nick from %{nick} to %{message}")
|
15
|
+
MSG_PART = N_("leaving %{where} (%{message})")
|
16
|
+
MSG_PART_EMPTY = N_("leaving %{where}")
|
17
|
+
MSG_JOIN = N_("joining %{where}")
|
18
|
+
MSG_QUIT = N_("quitting IRC (%{message})")
|
19
|
+
MSG_TOPIC = N_("changing the topic of %{where} to \"%{message}\"")
|
20
|
+
|
21
|
+
CHANPRIV_CHAN = N_("a private channel")
|
22
|
+
CHANPRIV_MSG_TOPIC = N_("changing the topic of %{where}")
|
23
|
+
|
24
|
+
MSGPRIV_MSG_PUBLIC = N_("speaking in %{where}")
|
25
|
+
MSGPRIV_MSG_ACTION = N_("doing something in %{where}")
|
26
|
+
|
27
|
+
FORMAT_NORMAL = N_("%{nick} was last seen %{when}, %{doing}")
|
28
|
+
FORMAT_WITH_BEFORE = N_("%{nick} was last seen %{when}, %{doing} and %{time} before %{did_before}")
|
29
|
+
|
30
|
+
Config.register Config::IntegerValue.new('seen.max_results',
|
31
|
+
:default => 3, :validate => Proc.new{|v| v >= 0},
|
32
|
+
:desc => _("Maximum number of seen users to return in search (0 = no limit)."))
|
33
|
+
|
11
34
|
def help(plugin, topic="")
|
12
|
-
"seen <nick> => have you seen, or when did you last see <nick>"
|
35
|
+
_("seen <nick> => have you seen, or when did you last see <nick>")
|
13
36
|
end
|
14
|
-
|
37
|
+
|
15
38
|
def privmsg(m)
|
16
39
|
unless(m.params =~ /^(\S)+$/)
|
17
40
|
m.reply "incorrect usage: " + help(m.plugin)
|
@@ -23,7 +46,17 @@ class SeenPlugin < Plugin
|
|
23
46
|
if @registry.has_key?(m.params)
|
24
47
|
m.reply seen(@registry[m.params])
|
25
48
|
else
|
26
|
-
m.
|
49
|
+
rx = Regexp.new(m.params, true)
|
50
|
+
num_matched = 0
|
51
|
+
@registry.each {|nick, saw|
|
52
|
+
if nick.match(rx)
|
53
|
+
m.reply seen(saw)
|
54
|
+
num_matched += 1
|
55
|
+
break if num_matched == @bot.config['seen.max_results']
|
56
|
+
end
|
57
|
+
}
|
58
|
+
|
59
|
+
m.reply _("nope!") if num_matched.zero?
|
27
60
|
end
|
28
61
|
end
|
29
62
|
|
@@ -35,60 +68,158 @@ class SeenPlugin < Plugin
|
|
35
68
|
when PrivMessage
|
36
69
|
return if m.private?
|
37
70
|
type = m.action? ? 'ACTION' : 'PUBLIC'
|
38
|
-
|
39
|
-
|
71
|
+
store m, Saw.new(m.sourcenick.dup, now, type,
|
72
|
+
m.target.to_s, m.message.dup)
|
40
73
|
when QuitMessage
|
41
74
|
return if m.address?
|
42
|
-
|
43
|
-
|
75
|
+
store m, Saw.new(m.sourcenick.dup, now, "QUIT",
|
76
|
+
nil, m.message.dup)
|
44
77
|
when NickMessage
|
45
78
|
return if m.address?
|
46
|
-
|
47
|
-
@registry[m.oldnick] = saw
|
48
|
-
@registry[m.newnick] = saw
|
79
|
+
store m, Saw.new(m.oldnick, now, "NICK", nil, m.newnick)
|
49
80
|
when PartMessage
|
50
81
|
return if m.address?
|
51
|
-
|
52
|
-
|
82
|
+
store m, Saw.new(m.sourcenick.dup, Time.new, "PART",
|
83
|
+
m.target.to_s, m.message.dup)
|
53
84
|
when JoinMessage
|
54
85
|
return if m.address?
|
55
|
-
|
56
|
-
|
86
|
+
store m, Saw.new(m.sourcenick.dup, Time.new, "JOIN",
|
87
|
+
m.target.to_s, m.message.dup)
|
57
88
|
when TopicMessage
|
58
89
|
return if m.address? or m.info_or_set == :info
|
59
|
-
|
60
|
-
|
90
|
+
store m, Saw.new(m.sourcenick.dup, Time.new, "TOPIC",
|
91
|
+
m.target.to_s, m.message.dup)
|
61
92
|
end
|
62
93
|
end
|
63
|
-
|
64
|
-
def seen(
|
65
|
-
|
94
|
+
|
95
|
+
def seen(reg)
|
96
|
+
saw = case reg
|
97
|
+
when Struct::Saw
|
98
|
+
reg # for backwards compatibility
|
99
|
+
when Array
|
100
|
+
reg.last
|
101
|
+
end
|
102
|
+
|
103
|
+
if reg.kind_of? Array
|
104
|
+
before = reg.first
|
105
|
+
end
|
106
|
+
|
107
|
+
# TODO: a message should not be disclosed if:
|
108
|
+
# - it was said in a channel that was/is invite-only, private or secret
|
109
|
+
# - UNLESS the requester is also in the channel now, or the request is made
|
110
|
+
# in the channel?
|
111
|
+
msg_privacy = false
|
112
|
+
# TODO: a channel or it's topic should not be disclosed if:
|
113
|
+
# - the channel was/is private or secret
|
114
|
+
# - UNLESS the requester is also in the channel now, or the request is made
|
115
|
+
# in the channel?
|
116
|
+
chan_privacy = false
|
117
|
+
|
118
|
+
# What should be displayed for channel?
|
119
|
+
where = chan_privacy ? _(CHANPRIV_CHAN) : saw.where
|
120
|
+
|
121
|
+
formats = {
|
122
|
+
:normal => _(FORMAT_NORMAL),
|
123
|
+
:with_before => _(FORMAT_WITH_BEFORE)
|
124
|
+
}
|
125
|
+
|
126
|
+
if before && [:PART, :QUIT].include?(saw.type.to_sym) &&
|
127
|
+
[:PUBLIC, :ACTION].include?(before.type.to_sym)
|
128
|
+
# TODO see chan_privacy
|
129
|
+
prev_chan_privacy = false
|
130
|
+
prev_where = prev_chan_privacy ? _(CHANPRIV_CHAN) : before.where
|
131
|
+
did_before = case before.type.to_sym
|
132
|
+
when :PUBLIC
|
133
|
+
_(msg_privacy ? MSGPRIV_MSG_PUBLIC : MSG_PUBLIC)
|
134
|
+
when :ACTION
|
135
|
+
_(msg_privacy ? MSGPRIV_MSG_ACTION : MSG_ACTION)
|
136
|
+
end % {
|
137
|
+
:nick => saw.nick,
|
138
|
+
:message => before.message,
|
139
|
+
:where => prev_where
|
140
|
+
}
|
141
|
+
|
142
|
+
format = :with_before
|
143
|
+
|
144
|
+
time_diff = saw.time - before.time
|
145
|
+
if time_diff < 300
|
146
|
+
time_before = _("a moment")
|
147
|
+
elsif time_diff < 3600
|
148
|
+
time_before = _("a while")
|
149
|
+
else
|
150
|
+
format = :normal
|
151
|
+
end
|
152
|
+
else
|
153
|
+
format = :normal
|
154
|
+
end
|
155
|
+
|
156
|
+
nick = saw.nick
|
66
157
|
ago = Time.new - saw.time
|
67
|
-
|
158
|
+
|
68
159
|
if (ago.to_i == 0)
|
69
|
-
|
160
|
+
time = _("just now")
|
70
161
|
else
|
71
|
-
|
162
|
+
time = _("%{time} ago") % { :time => Utils.secs_to_string(ago) }
|
72
163
|
end
|
73
164
|
|
74
|
-
case saw.type.to_sym
|
165
|
+
doing = case saw.type.to_sym
|
75
166
|
when :PUBLIC
|
76
|
-
|
167
|
+
_(msg_privacy ? MSGPRIV_MSG_PUBLIC : MSG_PUBLIC)
|
77
168
|
when :ACTION
|
78
|
-
|
169
|
+
_(msg_privacy ? MSGPRIV_MSG_ACTION : MSG_ACTION)
|
79
170
|
when :NICK
|
80
|
-
|
171
|
+
_(MSG_NICK)
|
81
172
|
when :PART
|
82
|
-
|
173
|
+
if saw.message.empty?
|
174
|
+
_(MSG_PART_EMPTY)
|
175
|
+
else
|
176
|
+
_(MSG_PART)
|
177
|
+
end
|
83
178
|
when :JOIN
|
84
|
-
|
179
|
+
_(MSG_JOIN)
|
85
180
|
when :QUIT
|
86
|
-
|
181
|
+
_(MSG_QUIT)
|
87
182
|
when :TOPIC
|
88
|
-
|
183
|
+
_(chan_privacy ? CHANPRIV_MSG_TOPIC : MSG_TOPIC)
|
184
|
+
end % { :message => saw.message, :where => where, :nick => saw.nick }
|
185
|
+
|
186
|
+
case format
|
187
|
+
when :normal
|
188
|
+
formats[:normal] % {
|
189
|
+
:nick => saw.nick,
|
190
|
+
:when => time,
|
191
|
+
:doing => doing,
|
192
|
+
}
|
193
|
+
when :with_before
|
194
|
+
formats[:with_before] % {
|
195
|
+
:nick => saw.nick,
|
196
|
+
:when => time,
|
197
|
+
:doing => doing,
|
198
|
+
:time => time_before,
|
199
|
+
:did_before => did_before
|
200
|
+
}
|
89
201
|
end
|
90
202
|
end
|
91
|
-
|
203
|
+
|
204
|
+
def store(m, saw)
|
205
|
+
# TODO: we need to store the channel state INVITE/SECRET/PRIVATE here, in
|
206
|
+
# some symbolic form, so that we know the prior state of the channel when
|
207
|
+
# it comes time to display.
|
208
|
+
reg = @registry[saw.nick]
|
209
|
+
|
210
|
+
if reg && reg.is_a?(Array)
|
211
|
+
reg.shift if reg.size > 1
|
212
|
+
reg.push(saw)
|
213
|
+
else
|
214
|
+
reg = [saw]
|
215
|
+
end
|
216
|
+
|
217
|
+
if m.is_a? NickMessage
|
218
|
+
@registry[m.newnick] = reg
|
219
|
+
end
|
220
|
+
|
221
|
+
@registry[saw.nick] = reg
|
222
|
+
end
|
92
223
|
end
|
93
224
|
plugin = SeenPlugin.new
|
94
225
|
plugin.register("seen")
|
@@ -15,7 +15,7 @@ require "shorturl"
|
|
15
15
|
require "uri"
|
16
16
|
|
17
17
|
class ShortenURLs < Plugin
|
18
|
-
# starting from about shorturl 0.8.4, the WWW module is not defined
|
18
|
+
# starting from about shorturl 0.8.4, the WWW module is not defined
|
19
19
|
include WWW rescue nil
|
20
20
|
|
21
21
|
Config.register Config::ArrayValue.new('shortenurls.services_blacklist',
|
@@ -31,7 +31,20 @@ class SlashdotPlugin < Plugin
|
|
31
31
|
if arts.length > 1
|
32
32
|
tits = []
|
33
33
|
arts.each { |el|
|
34
|
-
|
34
|
+
# see if the div tag with generaltitle class is present
|
35
|
+
artitle = (el/"div.generaltitle").first
|
36
|
+
if artitle
|
37
|
+
tits << artitle.to_html.ircify_html
|
38
|
+
next
|
39
|
+
end
|
40
|
+
# otherwise, check for skin+datitle a tags
|
41
|
+
datitle = (el/"a.datitle").first
|
42
|
+
next unless datitle
|
43
|
+
skin = (el/"a.skin").first
|
44
|
+
artitle = [
|
45
|
+
skin ? skin.innerHTML.ircify_html : nil,
|
46
|
+
datitle.innerHTML.ircify_html
|
47
|
+
].compact.join(" ")
|
35
48
|
tits << artitle
|
36
49
|
}
|
37
50
|
content = tits.join(" | ")
|
@@ -49,7 +62,7 @@ class SlashdotPlugin < Plugin
|
|
49
62
|
@bot.register_filter(:slashdot, :htmlinfo) { |s| slashdot_filter(s) }
|
50
63
|
end
|
51
64
|
end
|
52
|
-
|
65
|
+
|
53
66
|
def search_slashdot(m, params)
|
54
67
|
max = params[:limit].to_i
|
55
68
|
search = params[:search].to_s
|
@@ -86,7 +99,7 @@ class SlashdotPlugin < Plugin
|
|
86
99
|
m.reply "search for #{search} failed"
|
87
100
|
end
|
88
101
|
end
|
89
|
-
|
102
|
+
|
90
103
|
def slashdot(m, params)
|
91
104
|
debug params.inspect
|
92
105
|
max = params[:limit].to_i
|
@@ -110,12 +123,12 @@ class SlashdotPlugin < Plugin
|
|
110
123
|
max = 8 if max > 8
|
111
124
|
matches = Array.new
|
112
125
|
doc.elements.each("*/story") {|e|
|
113
|
-
matches << [ e.elements["title"].text,
|
114
|
-
e.elements["author"].text,
|
126
|
+
matches << [ e.elements["title"].text,
|
127
|
+
e.elements["author"].text,
|
115
128
|
e.elements["time"].text.gsub(/\d{4}-(\d{2})-(\d{2})/, "\\2/\\1").gsub(/:\d\d$/, "") ]
|
116
129
|
done += 1
|
117
130
|
break if done >= max
|
118
|
-
}
|
131
|
+
}
|
119
132
|
if oneline
|
120
133
|
m.reply matches.collect{|mat| mat[0]}.join(" | ")
|
121
134
|
else
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#-- vim:sw=2:et
|
2
|
+
#++
|
3
|
+
#
|
4
|
+
# :title: spotify plugin for rbot
|
5
|
+
#
|
6
|
+
# Author:: Raine Virta <raine.virta@gmail.com>
|
7
|
+
#
|
8
|
+
# Copyright:: (C) 2009 Raine Virta
|
9
|
+
#
|
10
|
+
# License:: GPL v2
|
11
|
+
|
12
|
+
class SpotifyPlugin < Plugin
|
13
|
+
def initialize
|
14
|
+
super
|
15
|
+
|
16
|
+
unless Object.const_defined?('Spotify')
|
17
|
+
raise 'Spotify module not found (lib_spotify plugin probably not enabled)'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def help(plugin, topic)
|
22
|
+
_("spotify plugin - usage: spotify <spotify>, spotify artist <artist>, spotify album <album>")
|
23
|
+
end
|
24
|
+
|
25
|
+
def search(m, params)
|
26
|
+
method = params[:method] || 'track'
|
27
|
+
begin
|
28
|
+
result = Spotify.search(method, params[:query].to_s)
|
29
|
+
rescue
|
30
|
+
m.reply "problems connecting to Spotify"
|
31
|
+
end
|
32
|
+
|
33
|
+
if result.nil?
|
34
|
+
m.reply "no results"
|
35
|
+
return
|
36
|
+
end
|
37
|
+
|
38
|
+
case method
|
39
|
+
when 'track'
|
40
|
+
reply = _("%{b}%{artist}%{b} – %{track}") % {
|
41
|
+
:artist => result.artist.name,
|
42
|
+
:track => result.name,
|
43
|
+
:b => Bold
|
44
|
+
}
|
45
|
+
|
46
|
+
if result.album.released
|
47
|
+
reply << _(" [%{u}%{album}%{u}, %{released}]") % {
|
48
|
+
:released => result.album.released,
|
49
|
+
:album => result.album.name,
|
50
|
+
:u => Underline
|
51
|
+
}
|
52
|
+
else
|
53
|
+
reply << _(" [%{u}%{album}%{u}]") % { :album => result.album.name, :u => Underline }
|
54
|
+
end
|
55
|
+
|
56
|
+
reply << _(" — %{url}") % { :url => result.url }
|
57
|
+
when 'artist'
|
58
|
+
reply = _("%{b}%{artist}%{b} — %{url}") % {
|
59
|
+
:b => Bold,
|
60
|
+
:artist => result.name,
|
61
|
+
:url => result.url
|
62
|
+
}
|
63
|
+
when 'album'
|
64
|
+
reply = _("%{b}%{artist}%{b} – %{u}%{album}%{u} — %{url}") % {
|
65
|
+
:b => Bold,
|
66
|
+
:u => Underline,
|
67
|
+
:artist => result.artist.name,
|
68
|
+
:album => result.name,
|
69
|
+
:url => result.url
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
m.reply reply
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
plugin = SpotifyPlugin.new
|
78
|
+
plugin.map 'spotify [:method] *query', :action => :search, :requirements => { :method => /track|artist|album/ }
|
@@ -1,21 +1,21 @@
|
|
1
1
|
HE = [
|
2
2
|
|
3
3
|
['a superhumanly strong','an underprivileged','a globe-trotting','an impetuous','a shy','a suave','a notorious','a one-legged','an all-American','a short-sighted','an otherworldly','a hate-fuelled','a scrappy','an unconventional','a jaded','a leather-clad','a fiendish','a Nobel prize-winning','a suicidal','a maverick','a bookish','an old-fashioned','a witless','a lounge-singing','a war-weary','a scarfaced','a gun-slinging','an obese','a time-tossed','a benighted','an uncontrollable','an immortal','an oversexed','a world-famous','an ungodly','a fast talking','a deeply religious','a lonely','a sword-wielding','a genetically engineered'],
|
4
|
-
|
4
|
+
|
5
5
|
['white trash','zombie','shark-wrestling','playboy','guitar-strumming','Jewish',
|
6
6
|
'sweet-toothed','bohemian','crooked','chivalrous','moralistic','amnesiac','devious','drug-addicted',
|
7
7
|
'voodoo','Catholic','overambitious','coffee-fuelled','pirate','misogynist','skateboarding',
|
8
8
|
'arachnophobic','Amish','small-town','Republican','one-eyed','gay','guerilla','vegetarian',
|
9
9
|
'dishevelled','alcoholic','flyboy','ninja','albino','hunchbacked','neurotic','umbrella-wielding',
|
10
10
|
'native American','soccer-playing','day-dreaming'],
|
11
|
-
|
11
|
+
|
12
12
|
['grifter','stage actor','paramedic','gentleman spy','jungle king','hairdresser',
|
13
13
|
'photographer','ex-con','vagrant','filmmaker','werewolf','senator','romance novelist','shaman','cop',
|
14
14
|
'rock star','farmboy','cat burglar','cowboy','cyborg','inventor','assassin','boxer','dog-catcher',
|
15
15
|
'master criminal','gangster','firefighter','househusband','dwarf','librarian','paranormal investigator',
|
16
16
|
'Green Beret','waffle chef','vampire hunter','messiah','astronaut','sorceror','card sharp','matador',
|
17
17
|
'barbarian'],
|
18
|
-
|
18
|
+
|
19
19
|
['with a robot buddy named Sparky','whom everyone believes is mad','gone bad',
|
20
20
|
'with a mysterious suitcase handcuffed to his arm','living undercover at Ringling Bros. Circus',
|
21
21
|
'searching for his wife''s true killer','who dotes on his loving old ma','looking for ''the Big One''',
|
@@ -42,19 +42,19 @@ SHE = [
|
|
42
42
|
'a plucky','a sarcastic','a psychotic','a hard-bitten','a manipulative','an orphaned','a cosmopolitan',
|
43
43
|
'a chain-smoking','a cold-hearted','a warm-hearted','a sharp-shooting','an enchanted','a wealthy','a pregnant',
|
44
44
|
'a mentally unstable','a virginal','a brilliant','a disco-crazy','a provocative','an artistic'],
|
45
|
-
|
45
|
+
|
46
46
|
['tempestuous', 'Buddhist', 'foul-mouthed', 'nymphomaniac', 'green-skinned', 'impetuous', 'African-American','punk','hypochondriac','junkie','blonde','goth','insomniac','gypsy','mutant','renegade', 'tomboy','French-Canadian','motormouth','belly-dancing','communist','hip-hop','thirtysomething',
|
47
47
|
'cigar-chomping','extravagent','out-of-work','Bolivian','mute','cat-loving','snooty','wisecracking',
|
48
48
|
'red-headed','winged','kleptomaniac','antique-collecting','psychic','gold-digging','bisexual','paranoid',
|
49
49
|
'streetsmart'],
|
50
|
-
|
50
|
+
|
51
51
|
['archaeologist','pearl diver','mechanic','detective','hooker','femme fatale',
|
52
52
|
'former first lady','barmaid','fairy princess','magician''s assistant','schoolgirl','college professor',
|
53
53
|
'angel','bounty hunter','opera singer','cab driver','soap star','doctor','politician','lawyer','nun',
|
54
54
|
'snake charmer','journalist','bodyguard','vampire','stripper','Valkyrie','wrestler','mermaid','single mother',
|
55
55
|
'safe cracker','traffic cop','research scientist','queen of the dead','Hell''s Angel','museum curator',
|
56
56
|
'advertising executive','widow','mercenary','socialite'],
|
57
|
-
|
57
|
+
|
58
58
|
['on her way to prison for a murder she didn''t commit','trying to make a difference in a man''s world',
|
59
59
|
'with the soul of a mighty warrior','looking for love in all the wrong places','with an MBA from Harvard',
|
60
60
|
'who hides her beauty behind a pair of thick-framed spectacles','with the power to see death',
|
@@ -80,14 +80,14 @@ TITLE = [
|
|
80
80
|
'BLOOD', 'HARD', 'STEEL', 'TERMINAL', 'HOT', 'COLD', 'TOTAL', 'PROGNOSIS:',
|
81
81
|
'BURNING', 'FAST', 'PAINFUL', 'MISSION:', 'DEADLY', 'PARTIAL',
|
82
82
|
'RAGING', 'CORDIAL'],
|
83
|
-
|
83
|
+
|
84
84
|
['DECISION', 'INCISION', 'CONCLUSION',
|
85
85
|
'CONCUSSION', 'HEAT', 'FIRE', 'RECOIL', 'INSTINCT', 'DESIRE', 'WEAPON',
|
86
86
|
'BADGE', 'DEED', 'JUSTICE', 'HEAT', 'VENGEANCE', 'RECESSION', 'COMBUSTION',
|
87
87
|
'JUDGEMENT', 'WARNING', 'AWAKENING', 'JURISDICTION', 'BASIS', 'FINDINGS',
|
88
88
|
'INJECTION', 'REJECTION', 'REMISSION', 'DIGESTION', 'IDENTITY',
|
89
89
|
'DISPERSION'],
|
90
|
-
|
90
|
+
|
91
91
|
['II','III','IV','V','VI','VII','VIII','IX','X','XI','XII','XIII','XIV','XV','XVI','XVII','XVIII','XIX']
|
92
92
|
|
93
93
|
]
|
@@ -96,11 +96,11 @@ class TheyFightCrime < Plugin
|
|
96
96
|
def help(plugin, topic="")
|
97
97
|
"movieplot => generate a random movie scenario. movietitle => generate a random movie title."
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
def get_random_things(thing_array)
|
101
101
|
thing_array.map { |things| things.pick_one }
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
def movieplot(m, params)
|
105
105
|
he_things = get_random_things(HE)
|
106
106
|
she_things = get_random_things(SHE)
|