Sha256: 5eb94cf9afa8f8dc51694495ae0954a629a3338a1b6172ce08a624667b498c18

Contents?: true

Size: 1.24 KB

Versions: 20

Compression:

Stored size: 1.24 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:    <https://github.com/MarioRuiz/slack-smart-bot#routines|more info>
  # helpadmin: command_id: :pause_routine
  # helpadmin:
  def pause_routine(dest, from, name)
    save_stats(__method__)
    if is_admin?
      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

20 entries across 20 versions & 1 rubygems

Version Path
slack-smart-bot-1.15.25 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.15.1 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.15.0 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.14.2 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.14.1 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.14.0 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.13.2 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.13.1 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.13.0 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.12.9 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.12.8 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.12.7 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.12.6 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.12.5 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.12.4 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.12.3 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.12.2 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.12.1 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.12.0 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb
slack-smart-bot-1.11.0 lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb