Sha256: ca4092554ede77fcedd38ad34045414672a8536501a8ef3bee3d666e3ba2cea1

Contents?: true

Size: 1.15 KB

Versions: 17

Compression:

Stored size: 1.15 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)
    save_stats(__method__)
    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

17 entries across 17 versions & 1 rubygems

Version Path
slack-smart-bot-1.9.2 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.9.1 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.8.2 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.8.1 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.8.0 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.7.0 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.6.8 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.6.7 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.6.6 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.6.5 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.6.4 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.6.3 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.6.2 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.6.1 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.6.0 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.5.1 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.5.0 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb