Class: Rancour::ApplicationCommand
- Inherits:
-
Object
- Object
- Rancour::ApplicationCommand
- Defined in:
- lib/rancour/application_command.rb
Constant Summary collapse
- SUB_COMMAND =
1- SUB_COMMAND_GROUP =
2- STRING =
3- INTEGER =
4- BOOLEAN =
5- USER =
6- CHANNEL =
7- ROLE =
8- MENTIONABLE =
9- NUMBER =
10- ATTACHMENT =
11
Instance Attribute Summary collapse
-
#guild_id ⇒ Object
Returns the value of attribute guild_id.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, guild_id:, name:, value:, options:) ⇒ ApplicationCommand
constructor
A new instance of ApplicationCommand.
Constructor Details
#initialize(id:, guild_id:, name:, value:, options:) ⇒ ApplicationCommand
Returns a new instance of ApplicationCommand.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rancour/application_command.rb', line 29 def initialize(id:, guild_id:, name:, value:, options:) self.id = id self.guild_id = guild_id self.name = name self.value = value self. = [] return if .nil? self. = .map { |option| Interaction::Data.from_payload(option) } end |
Instance Attribute Details
#guild_id ⇒ Object
Returns the value of attribute guild_id.
17 18 19 |
# File 'lib/rancour/application_command.rb', line 17 def guild_id @guild_id end |
#id ⇒ Object
Returns the value of attribute id.
17 18 19 |
# File 'lib/rancour/application_command.rb', line 17 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
17 18 19 |
# File 'lib/rancour/application_command.rb', line 17 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
17 18 19 |
# File 'lib/rancour/application_command.rb', line 17 def end |
#value ⇒ Object
Returns the value of attribute value.
17 18 19 |
# File 'lib/rancour/application_command.rb', line 17 def value @value end |
Class Method Details
.from_payload(payload) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/rancour/application_command.rb', line 19 def self.from_payload(payload) new( id: payload['id'], guild_id: payload['guild_id'], name: payload['name'], value: payload['value'], options: payload['options'] ) end |