Sha256: 5ee40994dc7553bc696d9c5f655b3f0bed9fd6d5e74bc5255b6d441aad4aa6b0

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 KB

Contents

# add here the general rules you will be using in all Smart Bots
def general_rules(user, command, processed, dest, files = [], rules_file = "")
    from = user.name
    display_name = user.profile.display_name
  
    begin
      case command

        # help: ----------------------------------------------
        # help: `echo SOMETHING`
        # help: `NUMBER echo SOMETHING`
        # help:     repeats SOMETHING. If NUMBER supplied then that number of times.
        # help:  Examples:
        # help:     _echo I am the Smart Bot_
        # help:     _100 echo :heart:_
        # help: command_id: :echo
        # help:        
      when /\A\s*(\d*)\s*echo\s(.+)/i
        save_stats :echo
        $1.to_s == '' ? times = 1 : times = $1.to_i
        respond ($2*times).to_s

      else
        return false
      end
      return true
    rescue => exception
      if defined?(@logger)
        @logger.fatal exception
        respond "Unexpected error!! Please contact an admin to solve it: <@#{config.admins.join(">, <@")}>"
      else
        puts exception
      end
      return false
    end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
slack-smart-bot-1.15.25 lib/slack-smart-bot_general_rules.rb
slack-smart-bot-1.15.1 lib/slack-smart-bot_general_rules.rb
slack-smart-bot-1.15.0 lib/slack-smart-bot_general_rules.rb
slack-smart-bot-1.14.2 lib/slack-smart-bot_general_rules.rb
slack-smart-bot-1.14.1 lib/slack-smart-bot_general_rules.rb
slack-smart-bot-1.14.0 lib/slack-smart-bot_general_rules.rb
slack-smart-bot-1.13.2 lib/slack-smart-bot_general_rules.rb
slack-smart-bot-1.13.1 lib/slack-smart-bot_general_rules.rb
slack-smart-bot-1.13.0 lib/slack-smart-bot_general_rules.rb