Class: Discordrb::Invite

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

Overview

A Discord invite to a channel

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, bot) ⇒ Invite

Returns a new instance of Invite.



269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/discordrb/data.rb', line 269

def initialize(data, bot)
  @bot = bot

  @channel = Channel.new(data['channel'], bot)
  @uses = data['uses']
  @inviter = @bot.user(data['inviter']['id'].to_i) || User.new(data['inviter'], bot)
  @temporary = data['temporary']
  @revoked = data['revoked']
  @xkcd = data['xkcdpass']

  @code = data['code']
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



259
260
261
# File 'lib/discordrb/data.rb', line 259

def channel
  @channel
end

#codeObject (readonly)

Returns the value of attribute code.



259
260
261
# File 'lib/discordrb/data.rb', line 259

def code
  @code
end

#inviterObject (readonly) Also known as: user

Returns the value of attribute inviter.



259
260
261
# File 'lib/discordrb/data.rb', line 259

def inviter
  @inviter
end

#revokedObject (readonly) Also known as: revoked?

Returns the value of attribute revoked.



259
260
261
# File 'lib/discordrb/data.rb', line 259

def revoked
  @revoked
end

#temporaryObject (readonly) Also known as: temporary?

Returns the value of attribute temporary.



259
260
261
# File 'lib/discordrb/data.rb', line 259

def temporary
  @temporary
end

#usesObject (readonly) Also known as: max_uses

Returns the value of attribute uses.



259
260
261
# File 'lib/discordrb/data.rb', line 259

def uses
  @uses
end

#xkcdObject (readonly) Also known as: xkcd?

Returns the value of attribute xkcd.



259
260
261
# File 'lib/discordrb/data.rb', line 259

def xkcd
  @xkcd
end

Instance Method Details

#deleteObject



282
283
284
# File 'lib/discordrb/data.rb', line 282

def delete
  API.delete_invite(@bot.token, @code)
end