Sha256: 9c84e5e5c887e8e896d5e45d9dd13e224fb61413c0d389d0823b83718f1432f6

Contents?: true

Size: 1.54 KB

Versions: 10

Compression:

Stored size: 1.54 KB

Contents

class SlackSmartBot
  # helpmaster: ----------------------------------------------
  # helpmaster: `notify MESSAGE`
  # helpmaster: `notify all MESSAGE`
  # helpmaster: `notify #CHANNEL_NAME MESSAGE`
  # helpmaster:    It will send a notification message to all bot channels
  # helpmaster:    It will send a notification message to all channels the bot joined and private conversations with the bot
  # helpmaster:    It will send a notification message to the specified channel and to its extended channels
  # helpmaster:    Only works if you are on Master channel and you are a master admin user
  # helpmaster:
  def notify_message(dest, from, where, message)
    if config.on_master_bot
      if config.admins.include?(from) #admin user
        if where.nil? #not all and not channel
          @bots_created.each do |k, v|
            respond message, k
          end
          respond "Bot channels have been notified", dest
        elsif where == "all" #all
          myconv = client.web_client.users_conversations(exclude_archived: true, limit: 100, types: "im, public_channel,private_channel").channels
          myconv.each do |c|
            respond message, c.id unless c.name == config.master_channel
          end
          respond "Channels and users have been notified", dest
        else #channel
          respond message, where
          @bots_created[where][:extended].each do |ch|
            respond message, @channels_id[ch]
          end
          respond "Bot channel and extended channels have been notified", dest
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
slack-smart-bot-1.4.3 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.4.2 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.4.1 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.4.0 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.3.1 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.3.0 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.2.0 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.1.2 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.1.1 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.1.0 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb