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 ⇒ InviteChannel
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 ⇒ InviteServer
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.
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.
-
#url ⇒ Object
Creates an invite URL.
Instance Attribute Details
#channel ⇒ InviteChannel (readonly)
Returns the channel this invite references.
937 938 939 |
# File 'lib/discordrb/data.rb', line 937 def channel @channel end |
#code ⇒ String (readonly)
Returns this invite's code.
959 960 961 |
# File 'lib/discordrb/data.rb', line 959 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.
947 948 949 |
# File 'lib/discordrb/data.rb', line 947 def inviter @inviter end |
#revoked ⇒ true, false (readonly) Also known as: revoked?
Returns whether this invite is still valid.
955 956 957 |
# File 'lib/discordrb/data.rb', line 955 def revoked @revoked end |
#server ⇒ InviteServer (readonly)
Returns the server this invite references.
940 941 942 |
# File 'lib/discordrb/data.rb', line 940 def server @server end |
#temporary ⇒ true, false (readonly) Also known as: temporary?
Returns whether or not this invite is temporary.
951 952 953 |
# File 'lib/discordrb/data.rb', line 951 def temporary @temporary end |
#uses ⇒ Integer (readonly) Also known as: max_uses
Returns the amount of uses left on this invite.
943 944 945 |
# File 'lib/discordrb/data.rb', line 943 def uses @uses end |
Instance Method Details
#==(other) ⇒ Object
Code based comparison
976 977 978 |
# File 'lib/discordrb/data.rb', line 976 def ==(other) other.respond_to?(:code) ? (@code == other.code) : (@code == other) end |
#delete ⇒ Object Also known as: revoke
Deletes this invite
981 982 983 |
# File 'lib/discordrb/data.rb', line 981 def delete API::Invite.delete(@bot.token, @code) end |
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
988 989 990 |
# File 'lib/discordrb/data.rb', line 988 def inspect "<Invite code=#{@code} channel=#{@channel} uses=#{@uses} temporary=#{@temporary} revoked=#{@revoked}>" end |
#url ⇒ Object
Creates an invite URL.
993 994 995 |
# File 'lib/discordrb/data.rb', line 993 def url "https://discord.gg/#{@code}" end |