Module: Discordrb::API::Invite
- Defined in:
- lib/discordrb/api/invite.rb
Overview
API calls for Invite object
Class Method Summary collapse
-
.accept(token, invite_code) ⇒ Object
Join a server using an invite https://discordapp.com/developers/docs/resources/invite#accept-invite.
-
.delete(token, code, reason = nil) ⇒ Object
Delete an invite by code https://discordapp.com/developers/docs/resources/invite#delete-invite.
-
.resolve(token, invite_code, counts = true) ⇒ Object
Resolve an invite https://discordapp.com/developers/docs/resources/invite#get-invite.
Class Method Details
.accept(token, invite_code) ⇒ Object
Join a server using an invite https://discordapp.com/developers/docs/resources/invite#accept-invite
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/discordrb/api/invite.rb', line 34 def accept(token, invite_code) Discordrb::API.request( :invite_code, nil, :post, "#{Discordrb::API.api_base}/invite/#{invite_code}", nil, Authorization: token ) end |
.delete(token, code, reason = nil) ⇒ Object
Delete an invite by code https://discordapp.com/developers/docs/resources/invite#delete-invite
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/discordrb/api/invite.rb', line 21 def delete(token, code, reason = nil) Discordrb::API.request( :invites_code, nil, :delete, "#{Discordrb::API.api_base}/invites/#{code}", Authorization: token, 'X-Audit-Log-Reason': reason ) end |
.resolve(token, invite_code, counts = true) ⇒ Object
Resolve an invite https://discordapp.com/developers/docs/resources/invite#get-invite
9 10 11 12 13 14 15 16 17 |
# File 'lib/discordrb/api/invite.rb', line 9 def resolve(token, invite_code, counts = true) Discordrb::API.request( :invite_code, nil, :get, "#{Discordrb::API.api_base}/invite/#{invite_code}#{counts ? '?with_counts=true' : ''}", Authorization: token ) end |