Class: Discorb::Invite
- Inherits:
-
DiscordModel
- Object
- DiscordModel
- Discorb::Invite
- Defined in:
- lib/discorb/invite.rb
Overview
Represents invite of discord.
Instance Attribute Summary collapse
-
#approximate_member_count -> Integer
readonly
The approximate number of members of invite.
-
#approximate_presence_count -> Integer
readonly
The approximate number of online users of invite.
-
#code -> String
readonly
The code of invite.
- #created_at -> Time? readonly
- #expires_at -> Time? readonly
- #max_age -> Integer? readonly
- #max_uses -> Integer? readonly
-
#target_type -> :voice, ...
readonly
The type of invite.
-
#target_user -> User
readonly
The user of invite.
- #uses -> Integer? readonly
Instance Method Summary collapse
- #channel -> Object
-
#delete!(reason: nil) -> Object
Delete the invite.
- #guild -> Object
- #remain_uses -> Object
- #temporary? -> Boolean
- #url -> Object
Methods inherited from DiscordModel
Instance Attribute Details
#approximate_member_count -> Integer (readonly)
Returns The approximate number of members of invite.
21 22 23 |
# File 'lib/discorb/invite.rb', line 21 def approximate_member_count @approximate_member_count end |
#approximate_presence_count -> Integer (readonly)
Returns The approximate number of online users of invite.
18 19 20 |
# File 'lib/discorb/invite.rb', line 18 def approximate_presence_count @approximate_presence_count end |
#code -> String (readonly)
Returns The code of invite.
9 10 11 |
# File 'lib/discorb/invite.rb', line 9 def code @code end |
#created_at -> Time? (readonly)
43 44 45 |
# File 'lib/discorb/invite.rb', line 43 def created_at @created_at end |
#expires_at -> Time? (readonly)
27 28 29 |
# File 'lib/discorb/invite.rb', line 27 def expires_at @expires_at end |
#max_age -> Integer? (readonly)
39 40 41 |
# File 'lib/discorb/invite.rb', line 39 def max_age @max_age end |
#max_uses -> Integer? (readonly)
35 36 37 |
# File 'lib/discorb/invite.rb', line 35 def max_uses @max_uses end |
#target_type -> :voice, ... (readonly)
Returns The type of invite.
12 13 14 |
# File 'lib/discorb/invite.rb', line 12 def target_type @target_type end |
#target_user -> User (readonly)
Returns The user of invite.
15 16 17 |
# File 'lib/discorb/invite.rb', line 15 def target_user @target_user end |
#uses -> Integer? (readonly)
31 32 33 |
# File 'lib/discorb/invite.rb', line 31 def uses @uses end |
Instance Method Details
#channel -> Object
82 83 84 |
# File 'lib/discorb/invite.rb', line 82 def channel @client.channels[@channel_data[:id]] end |
#delete!(reason: nil) -> Object
Note:
This is an asynchronous method, it will return a Async::Task
object. Use Async::Task#wait
to get the result.
Note:
This method calls HTTP request.
Delete the invite.
105 106 107 108 109 |
# File 'lib/discorb/invite.rb', line 105 def delete!(reason: nil) Async do @client.http.delete("/invites/#{@code}", audit_log_reason: reason) end end |
#guild -> Object
86 87 88 |
# File 'lib/discorb/invite.rb', line 86 def guild @client.guilds[@guild_data[:id]] end |
#remain_uses -> Object
94 95 96 |
# File 'lib/discorb/invite.rb', line 94 def remain_uses @max_uses && @max_uses - @uses end |
#temporary? -> Boolean
98 99 100 |
# File 'lib/discorb/invite.rb', line 98 def temporary? @temporary end |
#url -> Object
90 91 92 |
# File 'lib/discorb/invite.rb', line 90 def url "https://discord.gg/#{@code}" end |