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.
974 975 976 |
# File 'lib/discordrb/data.rb', line 974 def channel @channel end |
#code ⇒ String (readonly)
Returns this invite's code.
996 997 998 |
# File 'lib/discordrb/data.rb', line 996 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.
984 985 986 |
# File 'lib/discordrb/data.rb', line 984 def inviter @inviter end |
#revoked ⇒ true, false (readonly) Also known as: revoked?
Returns whether this invite is still valid.
992 993 994 |
# File 'lib/discordrb/data.rb', line 992 def revoked @revoked end |
#server ⇒ InviteServer (readonly)
Returns the server this invite references.
977 978 979 |
# File 'lib/discordrb/data.rb', line 977 def server @server end |
#temporary ⇒ true, false (readonly) Also known as: temporary?
Returns whether or not this invite is temporary.
988 989 990 |
# File 'lib/discordrb/data.rb', line 988 def temporary @temporary end |
#uses ⇒ Integer (readonly) Also known as: max_uses
Returns the amount of uses left on this invite.
980 981 982 |
# File 'lib/discordrb/data.rb', line 980 def uses @uses end |
Instance Method Details
#==(other) ⇒ Object
Code based comparison
1013 1014 1015 |
# File 'lib/discordrb/data.rb', line 1013 def ==(other) other.respond_to?(:code) ? (@code == other.code) : (@code == other) end |
#delete ⇒ Object Also known as: revoke
Deletes this invite
1018 1019 1020 |
# File 'lib/discordrb/data.rb', line 1018 def delete API::Invite.delete(@bot.token, @code) end |
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
1025 1026 1027 |
# File 'lib/discordrb/data.rb', line 1025 def inspect "<Invite code=#{@code} channel=#{@channel} uses=#{@uses} temporary=#{@temporary} revoked=#{@revoked}>" end |
#url ⇒ Object
Creates an invite URL.
1030 1031 1032 |
# File 'lib/discordrb/data.rb', line 1030 def url "https://discord.gg/#{@code}" end |