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 applications 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
Constructor Details
#initialize(data, bot) ⇒ Application
Returns a new instance of Application.
251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/discordrb/data.rb', line 251 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.
238 239 240 |
# File 'lib/discordrb/data.rb', line 238 def description @description end |
#flags ⇒ Integer (readonly)
244 245 246 |
# File 'lib/discordrb/data.rb', line 244 def flags @flags end |
#name ⇒ String (readonly)
Returns the application name.
235 236 237 |
# File 'lib/discordrb/data.rb', line 235 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.
249 250 251 |
# File 'lib/discordrb/data.rb', line 249 def owner @owner end |
#rpc_origins ⇒ Array<String> (readonly)
Returns the applications origins permitted to use RPC.
241 242 243 |
# File 'lib/discordrb/data.rb', line 241 def rpc_origins @rpc_origins end |
Instance Method Details
#icon_url ⇒ String?
Utility function to get a application's icon URL.
265 266 267 268 |
# File 'lib/discordrb/data.rb', line 265 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
271 272 273 |
# File 'lib/discordrb/data.rb', line 271 def inspect "<Application name=#{@name} id=#{@id}>" end |