Class: Tkellem::TkellemBot::UserCommand

Inherits:
CRUDCommand show all
Defined in:
lib/tkellem/tkellem_bot.rb

Instance Attribute Summary

Attributes inherited from Command

#args, #bouncer, #conn, #options, #opts

Instance Method Summary collapse

Methods inherited from CRUDCommand

#execute, #list, #modify, register_crud, #remove

Methods inherited from Command

admin_only?, admin_option, admin_user?, build_options, #initialize, option, register, resources, #respond, run, #show_help, #user

Constructor Details

This class inherits a constructor from Tkellem::TkellemBot::Command

Instance Method Details

#attributesObject



244
245
246
247
248
249
# File 'lib/tkellem/tkellem_bot.rb', line 244

def attributes
  find_attributes.tap { |attrs|
    role = opts['role'].try(:downcase)
    attrs['role'] = role if %w(user admin).include?(role)
  }
end

#find_attributesObject



240
241
242
# File 'lib/tkellem/tkellem_bot.rb', line 240

def find_attributes
  { :username => args.first.downcase }
end

#show(user) ⇒ Object



236
237
238
# File 'lib/tkellem/tkellem_bot.rb', line 236

def show(user)
  "#{user.username}:#{user.role}"
end