Sha256: 603264a8b304d62bbeea508d691cdfc1a3ccaf58c8f8f6dbe02ad5eef1b62145

Contents?: true

Size: 1.87 KB

Versions: 3

Compression:

Stored size: 1.87 KB

Contents

class SlackSmartBot
  # helpmaster: ----------------------------------------------
  # helpmaster: `set general message MESSAGE`
  # helpmaster: `set general message off`
  # helpmaster:    The SmartBot will display the specified message after treating every command
  # helpmaster:    Only works if you are on Master channel and you are a master admin user
  # helpmaster:    You can add interpolation to the message you are adding
  # helpmaster:    Examples:
  # helpmaster:      _set general message We will be on maintenance at 12:00_
  # helpmaster:      _set general message We will be on maintenance in #{((Time.new(2021,6,18,13,30,0)-Time.now)/60).to_i} minutes_
  # helpmaster:      _set general message `We will be on *maintenance* at *12:00*`_
  # helpmaster:      _set general messageĀ `:information_source: Pay attention: We will be on *maintenance* in *#{((Time.new(2021,6,18,13,30,0)-Time.now)/60).to_i} minutes*`_
  # helpmaster:    <https://github.com/MarioRuiz/slack-smart-bot#bot-management|more info>
  # helpmaster: command_id: :set_general_message
  # helpmaster:
  def set_general_message(user, status, message)
    save_stats(__method__)
    if config.on_master_bot
      if config.team_id_masters.include?("#{user.team_id}_#{user.name}") #master admin user
        if status == 'on'
          config.general_message = message
          respond "General message has been set."
        else
          config.general_message = ''
          respond "General message won't be displayed anymore."
        end
        @config_log.general_message = config.general_message
        file = File.open("#{config.path}/config_tmp.status", "w")
        file.write @config_log.inspect
        file.close

      else
        respond 'Only master admins on master channel can use this command.'
      end
    else
      respond 'Only master admins on master channel can use this command.'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-smart-bot-1.15.25 lib/slack/smart-bot/commands/on_master/admin_master/set_general_message.rb
slack-smart-bot-1.15.1 lib/slack/smart-bot/commands/on_master/admin_master/set_general_message.rb
slack-smart-bot-1.15.0 lib/slack/smart-bot/commands/on_master/admin_master/set_general_message.rb