Class: Discordrb::Application

Inherits:
Object
  • Object
show all
Includes:
IDObject
Defined in:
lib/discordrb/data.rb

Overview

OAuth Application information

Instance Attribute Summary collapse

Attributes included from IDObject

#id

Instance Method Summary collapse

Methods included from IDObject

#==, #creation_time, synthesise

Constructor Details

#initialize(data, bot) ⇒ Application



301
302
303
304
305
306
307
308
309
310
311
# File 'lib/discordrb/data.rb', line 301

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

#descriptionString (readonly)



288
289
290
# File 'lib/discordrb/data.rb', line 288

def description
  @description
end

#flagsInteger (readonly)



294
295
296
# File 'lib/discordrb/data.rb', line 294

def flags
  @flags
end

#nameString (readonly)



285
286
287
# File 'lib/discordrb/data.rb', line 285

def name
  @name
end

#ownerUser (readonly)

Gets the user object of the owner. May be limited to username, discriminator, ID, and avatar if the bot cannot reach the owner.



299
300
301
# File 'lib/discordrb/data.rb', line 299

def owner
  @owner
end

#rpc_originsArray<String> (readonly)



291
292
293
# File 'lib/discordrb/data.rb', line 291

def rpc_origins
  @rpc_origins
end

Instance Method Details

#icon_urlString?

Utility function to get a application's icon URL.



315
316
317
318
319
# File 'lib/discordrb/data.rb', line 315

def icon_url
  return nil if @icon_id.nil?

  API.app_icon_url(@id, @icon_id)
end

#inspectObject

The inspect method is overwritten to give more useful output



322
323
324
# File 'lib/discordrb/data.rb', line 322

def inspect
  "<Application name=#{@name} id=#{@id}>"
end