class SlackBot::Channel
Public Class Methods
new(info, bot)
click to toggle source
# File lib/slack/wrappers/channel.rb, line 3 def initialize(info, bot) @data = info @bot = bot end
Public Instance Methods
[](key)
click to toggle source
# File lib/slack/wrappers/channel.rb, line 8 def [](key) @data[key] end
archived?()
click to toggle source
# File lib/slack/wrappers/channel.rb, line 21 def archived?; @data['is_archived'] end
channel?()
click to toggle source
# File lib/slack/wrappers/channel.rb, line 19 def channel?; @data['is_channel'] end
creator()
click to toggle source
Helpers!
# File lib/slack/wrappers/channel.rb, line 13 def creator @bot.user @data['creator'] end
id()
click to toggle source
# File lib/slack/wrappers/channel.rb, line 16 def id; @data['id'] end
members()
click to toggle source
# File lib/slack/wrappers/channel.rb, line 22 def members if user_channel? return [self.user] else return @data['members'].map { |id| @bot.user id } end end
name()
click to toggle source
# File lib/slack/wrappers/channel.rb, line 17 def name; @data['name'] end
post(message)
click to toggle source
# File lib/slack/wrappers/channel.rb, line 49 def post(message) @bot.post self, message end
purpose()
click to toggle source
# File lib/slack/wrappers/channel.rb, line 29 def purpose p = @data['purpose'] p && p['value'] end
session()
click to toggle source
# File lib/slack/wrappers/channel.rb, line 37 def session @bot.session.for_channel(self.id) end
to_s()
click to toggle source
# File lib/slack/wrappers/channel.rb, line 41 def to_s if user_channel? user.to_s else "##{name}" end end
topic()
click to toggle source
# File lib/slack/wrappers/channel.rb, line 33 def topic p = @data['topic'] p && p['value'] end
user()
click to toggle source
# File lib/slack/wrappers/channel.rb, line 18 def user; @bot.user @data['user'] end
user_channel?()
click to toggle source
# File lib/slack/wrappers/channel.rb, line 20 def user_channel?; @data['is_im'] end