summaryrefslogtreecommitdiff
path: root/lib/rbot
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbot')
-rw-r--r--lib/rbot/core/basics.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/rbot/core/basics.rb b/lib/rbot/core/basics.rb
index d5ff5fb9..24d45419 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
@@ -212,6 +226,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'