Sha256: 60b73278bc939f3e71903026e207a91134914dd3f1e6d8659be12a0fa8136898
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
class SlackSmartBot def see_access(command_id) save_stats(__method__) if Thread.current[:typem] == :on_call channel = Thread.current[:dchannel] elsif Thread.current[:using_channel].to_s == "" channel = Thread.current[:dest] else channel = Thread.current[:using_channel] end command_ids = get_command_ids() if command_ids.values.flatten.include?(command_id) if @access_channels.key?(channel) and @access_channels[channel].key?(command_id) and @access_channels[channel][command_id].size > 0 names = @access_channels[channel][command_id].map { |a| a.split('_')[1..-1].join('_') } respond "Only these users have access to `#{command_id}` in this channel: <@#{names.join(">, <@")}>" elsif @access_channels.key?(channel) and @access_channels[channel].key?(command_id) and @access_channels[channel][command_id].empty? respond "`#{command_id}` is not possible to be used in this channel. Please contact an admin if you want to use it." else respond "`#{command_id}` seems to be available in this channel." end else respond "It seems like #{command_id} is not valid. Please be sure that exists by calling `see command ids`" end end end
Version data entries
3 entries across 3 versions & 1 rubygems