From 700b55102dc93250bb8d015bc20976479aed32c8 Mon Sep 17 00:00:00 2001 From: diamondburned Date: Thu, 31 Dec 2020 00:16:43 -0800 Subject: [PATCH] API: Added JoinInvite --- api/invite.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/api/invite.go b/api/invite.go index c5f488b..64c4684 100644 --- a/api/invite.go +++ b/api/invite.go @@ -91,6 +91,21 @@ func (c *Client) CreateInvite( ) } +// JoinedInvite is returned after joining an invite. +type JoinedInvite struct { + Code string `json:"code"` + NewMember bool `json:"new_member"` + Guild discord.Guild `json:"guild"` + Channel discord.Channel `json:"channel"` // id, name, type only +} + +// JoinInvite joins a guild using the given invite code. This endpoint is +// undocumented. +func (c *Client) JoinInvite(code string) (*JoinedInvite, error) { + var inv *JoinedInvite + return inv, c.RequestJSON(&inv, "POST", EndpointInvites+code) +} + // DeleteInvite deletes an invite. // // Requires the MANAGE_CHANNELS permission on the channel this invite belongs