Sha256: bef3aaae8f28d448baecabf096744229dc1ab670319200846ca441f36226c23b

Contents?: true

Size: 1.62 KB

Versions: 17

Compression:

Stored size: 1.62 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:    <https://github.com/MarioRuiz/slack-smart-bot#sending-notifications|more info>
  # helpmaster: command_id: :notify_message
  # helpmaster:
  def notify_message(dest, from, where, message)
    save_stats(__method__)
    if config.on_master_bot
      if config.masters.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 = get_channels(bot_is_in: true)
          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

17 entries across 17 versions & 1 rubygems

Version Path
slack-smart-bot-1.14.2 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.14.1 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.14.0 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.13.2 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.13.1 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.13.0 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.12.9 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.12.8 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.12.7 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.12.6 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.12.5 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.12.4 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.12.3 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.12.2 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.12.1 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.12.0 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb
slack-smart-bot-1.11.0 lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb