Sha256: 8573f6004c8e554b34797b7f4ec3c6067445e7613e09558a89e90a848706e85b

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

class SlackSmartBot
  # helpadmin: ----------------------------------------------
  # helpadmin: `pause routine NAME`
  # helpadmin:    It will pause the specified 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:      _pause routine example_
  # helpadmin:
  def pause_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 pause 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] = :paused
        @routines[@channel_id][name][:next_run] = ""
        update_routines()
        respond "The routine *`#{name}`* has been paused.", 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

10 entries across 10 versions & 1 rubygems

Version Path
slack-smart-bot-1.4.3 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.4.2 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.4.1 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.4.0 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.3.1 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.3.0 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.2.0 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.1.2 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.1.1 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.1.0 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb