Sha256: 3311da39f9ec9a8ff28227f2dd3dd828f5f49ad0703b6d9bd05a4b4af178b9bb

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

class SlackSmartBot

  # helpadmin: ----------------------------------------------
  # helpadmin: `start routine NAME`
  # helpadmin:    It will start a paused routine
  # helpadmin:    You can use this command only if you are an admin user
  # helpadmin:    NAME: one word to identify the routine
  # helpadmin:    Examples:
  # helpadmin:      _start routine example_
  # helpadmin:

  def start_routine(dest, from, name)
    if config.admins.include?(from) #admin user
      if !config.on_master_bot and dest[0] == "D"
        respond "It's only possible to start routines from MASTER channel from a direct message with the bot.", dest
      elsif @routines.key?(@channel_id) and @routines[@channel_id].key?(name)
        @routines[@channel_id][name][:status] = :on
        update_routines()
        respond "The routine *`#{name}`* has been started. The change will take effect in less than 30 secs.", dest
      else
        respond "There isn't a routine with that name: *`#{name}`*.\nCall `see routines` to see added routines", dest
      end
    else
      respond "Only admin users can use this command", dest
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slack-smart-bot-1.1.0 lib/slack/smart-bot/commands/on_bot/admin/start_routine.rb