class Ruboty::Niftycloud::Actions::AccountUse

Public Instance Methods

call() click to toggle source
# File lib/ruboty/niftycloud/actions/account_use.rb, line 5
def call
  target = message[:target]

  if target.match(/^\d+$/)
    account = accounts[target.to_i]
  else
    account = accounts.find {|account| account[:name] == target }
  end

  if !account
    return message.reply("Error: account not found")
  end 

  current_account(account[:name])
  message.reply("using: #{account[:name]}")
end