--- /dev/null
+#-- vim:sw=2:et\r
+#++\r
+\r
+\r
+class BasicsModule < CoreBotModule\r
+\r
+ def listen(m)\r
+ return unless m.kind_of?(PrivMessage)\r
+ if(m.private? && m.message =~ /^\001PING\s+(.+)\001/)\r
+ @bot.notice m.sourcenick, "\001PING #$1\001"\r
+ @bot.irclog "@ #{m.sourcenick} pinged me"\r
+ return\r
+ end\r
+ end\r
+\r
+ def bot_join(m, param)\r
+ if param[:pass]\r
+ @bot.join param[:chan], param[:pass]\r
+ else\r
+ @bot.join param[:chan]\r
+ end\r
+ end\r
+\r
+ def bot_part(m, param)\r
+ if param[:chan]\r
+ @bot.part param[:chan]\r
+ else\r
+ @bot.part m.target if m.public?\r
+ end\r
+ end\r
+\r
+ def bot_quit(m, param)\r
+ @bot.quit(param[:msg] ? param[:msg].join(" ") : nil)\r
+ end\r
+\r
+ def bot_restart(m, param)\r
+ @bot.restart(param[:msg] ? param[:msg].join(" ") : nil)\r
+ end\r
+\r
+ def bot_hide(m, param)\r
+ @bot.join 0\r
+ end\r
+\r
+ def bot_say(m, param)\r
+ @bot.say param[:where], param[:what].join(" ")\r
+ end\r
+\r
+ def bot_action(m, param)\r
+ @bot.action param[:where], param[:what].join(" ")\r
+ end\r
+\r
+ def bot_mode(m, param)\r
+ @bot.mode param[:where], param[:what], param[:who].join(" ")\r
+ end\r
+\r
+ def bot_ping(m, param)\r
+ m.reply "pong"\r
+ end\r
+\r
+ def bot_quiet(m, param)\r
+ if param.has_key?(:where)\r
+ @bot.set_quiet param[:where].sub(/^here$/, m.target)\r
+ else\r
+ @bot.set_quiet\r
+ end\r
+ end\r
+\r
+ def bot_talk(m, param)\r
+ if param.has_key?(:where)\r
+ @bot.reset_quiet param[:where].sub(/^here$/, m.target)\r
+ else\r
+ @bot.reset_quiet\r
+ end\r
+ end\r
+\r
+ def bot_help(m, param)\r
+ m.reply @bot.help(param[:topic].join(" "))\r
+ end\r
+\r
+ #TODO move these to a "chatback" plugin\r
+ # when (/^(botsnack|ciggie)$/i)\r
+ # @bot.say m.replyto, @lang.get("thanks_X") % m.sourcenick if(m.public?)\r
+ # @bot.say m.replyto, @lang.get("thanks") if(m.private?)\r
+ # when (/^(hello|howdy|hola|salut|bonjour|sup|niihau|hey|hi(\W|$)|yo(\W|$)).*/i)\r
+ # @bot.say m.replyto, @lang.get("hello_X") % m.sourcenick if(m.public?)\r
+ # @bot.say m.replyto, @lang.get("hello") if(m.private?)\r
+ # when (/^\s*(hello|howdy|hola|salut|bonjour|sup|niihau|hey|hi|yo(\W|$))[\s,-.]+#{Regexp.escape(@bot.nick)}$/i)\r
+ # @bot.say m.replyto, @lang.get("hello_X") % m.sourcenick\r
+ # when (/^#{Regexp.escape(@bot.nick)}!*$/)\r
+ # @bot.say m.replyto, @lang.get("hello_X") % m.sourcenick\r
+\r
+ # handle help requests for "core" topics\r
+ def help(plugin, topic="")\r
+ case topic\r
+ when "quit"\r
+ return "quit [<message>] => quit IRC with message <message>"\r
+ when "restart"\r
+ return "restart => completely stop and restart the bot (including reconnect)"\r
+ when "join"\r
+ return "join <channel> [<key>] => join channel <channel> with secret key <key> if specified. #{myself} also responds to invites if you have the required access level"\r
+ when "part"\r
+ return "part <channel> => part channel <channel>"\r
+ when "hide"\r
+ return "hide => part all channels"\r
+ when "save"\r
+ return "save => save current dynamic data and configuration"\r
+ when "rescan"\r
+ return "rescan => reload modules and static facts"\r
+ when "nick"\r
+ return "nick <nick> => attempt to change nick to <nick>"\r
+ when "say"\r
+ return "say <channel>|<nick> <message> => say <message> to <channel> or in private message to <nick>"\r
+ when "action"\r
+ return "action <channel>|<nick> <message> => does a /me <message> to <channel> or in private message to <nick>"\r
+ when "quiet"\r
+ return "quiet [in here|<channel>] => with no arguments, stop speaking in all channels, if \"in here\", stop speaking in this channel, or stop speaking in <channel>"\r
+ when "talk"\r
+ return "talk [in here|<channel>] => with no arguments, resume speaking in all channels, if \"in here\", resume speaking in this channel, or resume speaking in <channel>"\r
+ when "version"\r
+ return "version => describes software version"\r
+ # when "botsnack"\r
+ # return "botsnack => reward #{myself} for being good"\r
+ # when "hello"\r
+ # return "hello|hi|hey|yo [#{myself}] => greet the bot"\r
+ else\r
+ return "#{name}: quit, restart, join, part, hide, save, rescan, nick, say, action, topic, quiet, talk, version"#, botsnack, hello"\r
+ end\r
+ end\r
+end\r
+\r
+basics = BasicsModule.new\r
+\r
+basics.map "quit *msg",\r
+ :action => 'bot_quit',\r
+ :defaults => { :msg => nil },\r
+ :auth_path => 'quit'\r
+basics.map "restart *msg",\r
+ :action => 'bot_restart',\r
+ :defaults => { :msg => nil },\r
+ :auth_path => 'quit'\r
+\r
+basics.map "quiet",\r
+ :action => 'bot_quiet',\r
+ :auth_path => 'talk::set'\r
+basics.map "quiet in :chan",\r
+ :action => 'bot_quiet',\r
+ :auth_path => 'talk::set'\r
+basics.map "talk",\r
+ :action => 'bot_talk',\r
+ :auth_path => 'talk::set'\r
+basics.map "quiet in :chan",\r
+ :action => 'bot_quiet',\r
+ :auth_path => 'talk::set'\r
+\r
+basics.map "say :where *what",\r
+ :action => 'bot_say',\r
+ :auth_path => 'talk::do'\r
+basics.map "action :where *what",\r
+ :action => 'bot_action',\r
+ :auth_path => 'talk::do'\r
+basics.map "mode :where :what *who",\r
+ :action => 'bot_mode',\r
+ :auth_path => 'talk::do'\r
+\r
+basics.map "join :chan :pass", \r
+ :action => 'bot_join',\r
+ :defaults => {:pass => nil},\r
+ :auth_path => 'move'\r
+basics.map "part :chan",\r
+ :action => 'bot_part',\r
+ :defaults => {:chan => nil},\r
+ :auth_path => 'move'\r
+basics.map "hide",\r
+ :action => 'bot_hide',\r
+ :auth_path => 'move'\r
+\r
+basics.map "ping",\r
+ :action => 'bot_ping',\r
+ :auth_path => '!ping!'\r
+basics.map "help *topic",\r
+ :action => 'bot_help',\r
+ :default => { :topic => [""] },\r
+ :auth_path => '!help!'\r
+\r
+basics.default_auth('*', false)\r
+\r
+++ /dev/null
-#-- vim:sw=2:et\r
-#++\r
-\r
-\r
-class BasicsModule < CoreBotModule\r
-\r
- def listen(m)\r
- return unless m.kind_of?(PrivMessage)\r
- if(m.private? && m.message =~ /^\001PING\s+(.+)\001/)\r
- @bot.notice m.sourcenick, "\001PING #$1\001"\r
- @bot.irclog "@ #{m.sourcenick} pinged me"\r
- return\r
- end\r
- end\r
-\r
- def bot_join(m, param)\r
- if param[:pass]\r
- @bot.join param[:chan], param[:pass]\r
- else\r
- @bot.join param[:chan]\r
- end\r
- end\r
-\r
- def bot_part(m, param)\r
- if param[:chan]\r
- @bot.part param[:chan]\r
- else\r
- @bot.part m.target if m.public?\r
- end\r
- end\r
-\r
- def bot_quit(m, param)\r
- @bot.quit(param[:msg] ? param[:msg].join(" ") : nil)\r
- end\r
-\r
- def bot_restart(m, param)\r
- @bot.restart(param[:msg] ? param[:msg].join(" ") : nil)\r
- end\r
-\r
- def bot_hide(m, param)\r
- @bot.join 0\r
- end\r
-\r
- def bot_say(m, param)\r
- @bot.say param[:where], param[:what].join(" ")\r
- end\r
-\r
- def bot_action(m, param)\r
- @bot.action param[:where], param[:what].join(" ")\r
- end\r
-\r
- def bot_mode(m, param)\r
- @bot.mode param[:where], param[:what], param[:who].join(" ")\r
- end\r
-\r
- def bot_ping(m, param)\r
- m.reply "pong"\r
- end\r
-\r
- def bot_quiet(m, param)\r
- if param.has_key?(:where)\r
- @bot.set_quiet param[:where].sub(/^here$/, m.target)\r
- else\r
- @bot.set_quiet\r
- end\r
- end\r
-\r
- def bot_talk(m, param)\r
- if param.has_key?(:where)\r
- @bot.reset_quiet param[:where].sub(/^here$/, m.target)\r
- else\r
- @bot.reset_quiet\r
- end\r
- end\r
-\r
- def bot_help(m, param)\r
- m.reply @bot.help(param[:topic].join(" "))\r
- end\r
-\r
- #TODO move these to a "chatback" plugin\r
- # when (/^(botsnack|ciggie)$/i)\r
- # @bot.say m.replyto, @lang.get("thanks_X") % m.sourcenick if(m.public?)\r
- # @bot.say m.replyto, @lang.get("thanks") if(m.private?)\r
- # when (/^(hello|howdy|hola|salut|bonjour|sup|niihau|hey|hi(\W|$)|yo(\W|$)).*/i)\r
- # @bot.say m.replyto, @lang.get("hello_X") % m.sourcenick if(m.public?)\r
- # @bot.say m.replyto, @lang.get("hello") if(m.private?)\r
- # when (/^\s*(hello|howdy|hola|salut|bonjour|sup|niihau|hey|hi|yo(\W|$))[\s,-.]+#{Regexp.escape(@bot.nick)}$/i)\r
- # @bot.say m.replyto, @lang.get("hello_X") % m.sourcenick\r
- # when (/^#{Regexp.escape(@bot.nick)}!*$/)\r
- # @bot.say m.replyto, @lang.get("hello_X") % m.sourcenick\r
-\r
- # handle help requests for "core" topics\r
- def help(plugin, topic="")\r
- case topic\r
- when "quit"\r
- return "quit [<message>] => quit IRC with message <message>"\r
- when "restart"\r
- return "restart => completely stop and restart the bot (including reconnect)"\r
- when "join"\r
- return "join <channel> [<key>] => join channel <channel> with secret key <key> if specified. #{myself} also responds to invites if you have the required access level"\r
- when "part"\r
- return "part <channel> => part channel <channel>"\r
- when "hide"\r
- return "hide => part all channels"\r
- when "save"\r
- return "save => save current dynamic data and configuration"\r
- when "rescan"\r
- return "rescan => reload modules and static facts"\r
- when "nick"\r
- return "nick <nick> => attempt to change nick to <nick>"\r
- when "say"\r
- return "say <channel>|<nick> <message> => say <message> to <channel> or in private message to <nick>"\r
- when "action"\r
- return "action <channel>|<nick> <message> => does a /me <message> to <channel> or in private message to <nick>"\r
- when "quiet"\r
- return "quiet [in here|<channel>] => with no arguments, stop speaking in all channels, if \"in here\", stop speaking in this channel, or stop speaking in <channel>"\r
- when "talk"\r
- return "talk [in here|<channel>] => with no arguments, resume speaking in all channels, if \"in here\", resume speaking in this channel, or resume speaking in <channel>"\r
- when "version"\r
- return "version => describes software version"\r
- # when "botsnack"\r
- # return "botsnack => reward #{myself} for being good"\r
- # when "hello"\r
- # return "hello|hi|hey|yo [#{myself}] => greet the bot"\r
- else\r
- return "#{name}: quit, restart, join, part, hide, save, rescan, nick, say, action, topic, quiet, talk, version"#, botsnack, hello"\r
- end\r
- end\r
-end\r
-\r
-basics = BasicsModule.new\r
-\r
-basics.map "quit *msg",\r
- :action => 'bot_quit',\r
- :defaults => { :msg => nil },\r
- :auth_path => 'quit'\r
-basics.map "restart *msg",\r
- :action => 'bot_restart',\r
- :defaults => { :msg => nil },\r
- :auth_path => 'quit'\r
-\r
-basics.map "quiet",\r
- :action => 'bot_quiet',\r
- :auth_path => 'talk::set'\r
-basics.map "quiet in :chan",\r
- :action => 'bot_quiet',\r
- :auth_path => 'talk::set'\r
-basics.map "talk",\r
- :action => 'bot_talk',\r
- :auth_path => 'talk::set'\r
-basics.map "quiet in :chan",\r
- :action => 'bot_quiet',\r
- :auth_path => 'talk::set'\r
-\r
-basics.map "say :where *what",\r
- :action => 'bot_say',\r
- :auth_path => 'talk::do'\r
-basics.map "action :where *what",\r
- :action => 'bot_action',\r
- :auth_path => 'talk::do'\r
-basics.map "mode :where :what *who",\r
- :action => 'bot_mode',\r
- :auth_path => 'talk::do'\r
-\r
-basics.map "join :chan :pass", \r
- :action => 'bot_join',\r
- :defaults => {:pass => nil},\r
- :auth_path => 'move'\r
-basics.map "part :chan",\r
- :action => 'bot_part',\r
- :defaults => {:chan => nil},\r
- :auth_path => 'move'\r
-basics.map "hide",\r
- :action => 'bot_hide',\r
- :auth_path => 'move'\r
-\r
-basics.map "ping",\r
- :action => 'bot_ping',\r
- :auth_path => '!ping!'\r
-basics.map "help *topic",\r
- :action => 'bot_help',\r
- :default => { :topic => [""] },\r
- :auth_path => '!help!'\r
-\r
-basics.default_auth('*', false)\r
-\r