Class: Discordrb::Application
- Inherits:
-
Object
- Object
- Discordrb::Application
- Includes:
- IDObject
- Defined in:
- lib/discordrb/data.rb
Overview
OAuth Application information
Instance Attribute Summary collapse
-
#description ⇒ String
readonly
The application description.
- #flags ⇒ Integer readonly
-
#name ⇒ String
readonly
The application name.
-
#owner ⇒ User
readonly
Gets the user object of the owner.
-
#rpc_origins ⇒ Array<String>
readonly
The application's origins permitted to use RPC.
Attributes included from IDObject
Instance Method Summary collapse
-
#icon_url ⇒ String?
Utility function to get a application's icon URL.
-
#initialize(data, bot) ⇒ Application
constructor
A new instance of Application.
-
#inspect ⇒ Object
The inspect method is overwritten to give more useful output.
Methods included from IDObject
#==, #creation_time, synthesise
Constructor Details
#initialize(data, bot) ⇒ Application
Returns a new instance of Application.
300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/discordrb/data.rb', line 300 def initialize(data, bot) @bot = bot @name = data['name'] @id = data['id'].to_i @description = data['description'] @icon_id = data['icon'] @rpc_origins = data['rpc_origins'] @flags = data['flags'] @owner = @bot.ensure_user(data['owner']) end |
Instance Attribute Details
#description ⇒ String (readonly)
Returns the application description.
287 288 289 |
# File 'lib/discordrb/data.rb', line 287 def description @description end |
#flags ⇒ Integer (readonly)
293 294 295 |
# File 'lib/discordrb/data.rb', line 293 def flags @flags end |
#name ⇒ String (readonly)
Returns the application name.
284 285 286 |
# File 'lib/discordrb/data.rb', line 284 def name @name end |
#owner ⇒ User (readonly)
Gets the user object of the owner. May be limited to username, discriminator, ID, and avatar if the bot cannot reach the owner.
298 299 300 |
# File 'lib/discordrb/data.rb', line 298 def owner @owner end |
#rpc_origins ⇒ Array<String> (readonly)
Returns the application's origins permitted to use RPC.
290 291 292 |
# File 'lib/discordrb/data.rb', line 290 def rpc_origins @rpc_origins end |
Instance Method Details
#icon_url ⇒ String?
Utility function to get a application's icon URL.
314 315 316 317 |
# File 'lib/discordrb/data.rb', line 314 def icon_url return nil if @icon_id.nil? API.app_icon_url(@id, @icon_id) end |
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
320 321 322 |
# File 'lib/discordrb/data.rb', line 320 def inspect "<Application name=#{@name} id=#{@id}>" end |