Class: Discordrb::Invite
- Inherits:
-
Object
- Object
- Discordrb::Invite
- Defined in:
- lib/discordrb/data.rb
Overview
A Discord invite to a channel
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#inviter ⇒ Object
(also: #user)
readonly
Returns the value of attribute inviter.
-
#revoked ⇒ Object
(also: #revoked?)
readonly
Returns the value of attribute revoked.
-
#temporary ⇒ Object
(also: #temporary?)
readonly
Returns the value of attribute temporary.
-
#uses ⇒ Object
(also: #max_uses)
readonly
Returns the value of attribute uses.
-
#xkcd ⇒ Object
(also: #xkcd?)
readonly
Returns the value of attribute xkcd.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #delete ⇒ Object
-
#initialize(data, bot) ⇒ Invite
constructor
A new instance of Invite.
Constructor Details
#initialize(data, bot) ⇒ Invite
Returns a new instance of Invite.
302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/discordrb/data.rb', line 302 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
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
292 293 294 |
# File 'lib/discordrb/data.rb', line 292 def channel @channel end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
292 293 294 |
# File 'lib/discordrb/data.rb', line 292 def code @code end |
#inviter ⇒ Object (readonly) Also known as: user
Returns the value of attribute inviter.
292 293 294 |
# File 'lib/discordrb/data.rb', line 292 def inviter @inviter end |
#revoked ⇒ Object (readonly) Also known as: revoked?
Returns the value of attribute revoked.
292 293 294 |
# File 'lib/discordrb/data.rb', line 292 def revoked @revoked end |
#temporary ⇒ Object (readonly) Also known as: temporary?
Returns the value of attribute temporary.
292 293 294 |
# File 'lib/discordrb/data.rb', line 292 def temporary @temporary end |
#uses ⇒ Object (readonly) Also known as: max_uses
Returns the value of attribute uses.
292 293 294 |
# File 'lib/discordrb/data.rb', line 292 def uses @uses end |
#xkcd ⇒ Object (readonly) Also known as: xkcd?
Returns the value of attribute xkcd.
292 293 294 |
# File 'lib/discordrb/data.rb', line 292 def xkcd @xkcd end |
Instance Method Details
#==(other) ⇒ Object
315 316 317 |
# File 'lib/discordrb/data.rb', line 315 def ==(other) other.respond_to?(:code) ? (@code == other.code) : (@code == other) end |
#delete ⇒ Object
319 320 321 |
# File 'lib/discordrb/data.rb', line 319 def delete API.delete_invite(@bot.token, @code) end |