X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Frbot%2Fcore%2Fbasics.rb;h=0473028aceff3899813b029ea60bbd2370367e30;hb=2fc67aef47db1eb38a4a4251f7550633cc387674;hp=d5ff5fb93e3b7feb20993c544c879bd8e8dbf18a;hpb=4ff73e4ef177a4bc07e90fd3133874e326448640;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/core/basics.rb b/lib/rbot/core/basics.rb index d5ff5fb9..0473028a 100644 --- a/lib/rbot/core/basics.rb +++ b/lib/rbot/core/basics.rb @@ -69,6 +69,20 @@ class BasicsModule < CoreBotModule end end + def bot_channel_list(m, param) + ret = _('I am in: ') + # sort the channels by the base name and then map with prefixes for the + # mode and display. + ret << @bot.channels.compact.sort { |a,b| + a.name.downcase <=> b.name.downcase + }.map { |c| + c.modes_of(@bot.myself).map{ |mo| + m.server.prefix_for_mode(mo) + }.to_s + c.name + }.join(', ') + m.reply ret + end + def bot_quit(m, param) @bot.quit param[:msg].to_s end @@ -89,6 +103,10 @@ class BasicsModule < CoreBotModule @bot.say param[:where], param[:what].to_s end + def bot_notify(m, param) + @bot.notice param[:where], param[:what].to_s + end + def bot_action(m, param) @bot.action param[:where], param[:what].to_s end @@ -197,6 +215,9 @@ basics.map "talk [in] [:where]", basics.map "say :where *what", :action => 'bot_say', :auth_path => 'talk::do' +basics.map "notify :where *what", + :action => 'bot_notify', + :auth_path => 'talk::do' basics.map "action :where *what", :action => 'bot_action', :auth_path => 'talk::do' @@ -212,6 +233,9 @@ basics.map "part :chan", :action => 'bot_part', :defaults => {:chan => nil}, :auth_path => 'move' +basics.map "channels", + :action => 'bot_channel_list', + :auth_path => 'move' basics.map "hide", :action => 'bot_hide', :auth_path => 'move'