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 ⇒ Channel
readonly
The channel this invite references.
-
#code ⇒ String
readonly
This invite's code.
-
#inviter ⇒ User?
(also: #user)
readonly
The user that made this invite.
-
#revoked ⇒ true, false
(also: #revoked?)
readonly
Whether this invite is still valid.
-
#server ⇒ Server
readonly
The server this invite references.
-
#temporary ⇒ true, false
(also: #temporary?)
readonly
Whether or not this invite is temporary.
-
#uses ⇒ Integer
(also: #max_uses)
readonly
The amount of uses left on this invite.
-
#xkcd ⇒ true, false
(also: #xkcd?)
readonly
Whether this invite is in xkcd format (i. e. "Human readable" in the invite settings).
Instance Method Summary collapse
-
#==(other) ⇒ Object
Code based comparison.
-
#delete ⇒ Object
(also: #revoke)
Deletes this invite.
-
#inspect ⇒ Object
The inspect method is overwritten to give more useful output.
Instance Attribute Details
#channel ⇒ Channel (readonly)
Returns the channel this invite references.
624 625 626 |
# File 'lib/discordrb/data.rb', line 624 def channel @channel end |
#code ⇒ String (readonly)
Returns this invite's code.
645 646 647 |
# File 'lib/discordrb/data.rb', line 645 def code @code end |
#inviter ⇒ User? (readonly) Also known as: user
Returns the user that made this invite. May also be nil if the user can't be determined.
633 634 635 |
# File 'lib/discordrb/data.rb', line 633 def inviter @inviter end |
#revoked ⇒ true, false (readonly) Also known as: revoked?
Returns whether this invite is still valid.
639 640 641 |
# File 'lib/discordrb/data.rb', line 639 def revoked @revoked end |
#server ⇒ Server (readonly)
Returns the server this invite references.
627 628 629 |
# File 'lib/discordrb/data.rb', line 627 def server @server end |
#temporary ⇒ true, false (readonly) Also known as: temporary?
Returns whether or not this invite is temporary.
636 637 638 |
# File 'lib/discordrb/data.rb', line 636 def temporary @temporary end |
#uses ⇒ Integer (readonly) Also known as: max_uses
Returns the amount of uses left on this invite.
630 631 632 |
# File 'lib/discordrb/data.rb', line 630 def uses @uses end |
#xkcd ⇒ true, false (readonly) Also known as: xkcd?
Returns whether this invite is in xkcd format (i. e. "Human readable" in the invite settings).
642 643 644 |
# File 'lib/discordrb/data.rb', line 642 def xkcd @xkcd end |
Instance Method Details
#==(other) ⇒ Object
Code based comparison
670 671 672 |
# File 'lib/discordrb/data.rb', line 670 def ==(other) other.respond_to?(:code) ? (@code == other.code) : (@code == other) end |
#delete ⇒ Object Also known as: revoke
Deletes this invite
675 676 677 |
# File 'lib/discordrb/data.rb', line 675 def delete API.delete_invite(@bot.token, @code) end |
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
682 683 684 |
# File 'lib/discordrb/data.rb', line 682 def inspect "<Invite code=#{@code} channel=#{@channel} uses=#{@uses} temporary=#{@temporary} revoked=#{@revoked} xkcd=#{@xkcd}>" end |