Skip to content

Commit

Permalink
integrate pr Integrated bug fixes and additions from bwmarrin#922
Browse files Browse the repository at this point in the history
  • Loading branch information
cheesycod committed Dec 9, 2021
1 parent 1a0085b commit 3f54842
Show file tree
Hide file tree
Showing 6 changed files with 305 additions and 248 deletions.
76 changes: 39 additions & 37 deletions endpoints.go
Expand Up @@ -78,34 +78,34 @@ var (
EndpointUserConnections = func(uID string) string { return EndpointUsers + uID + "/connections" }
EndpointUserNotes = func(uID string) string { return EndpointUsers + "@me/notes/" + uID }

EndpointGuild = func(gID string) string { return EndpointGuilds + gID }
EndpointGuildPreview = func(gID string) string { return EndpointGuilds + gID + "/preview" }
EndpointGuildChannels = func(gID string) string { return EndpointGuilds + gID + "/channels" }
EndpointGuildMembers = func(gID string) string { return EndpointGuilds + gID + "/members" }
EndpointGuildMember = func(gID, uID string) string { return EndpointGuilds + gID + "/members/" + uID }
EndpointGuildMemberRole = func(gID, uID, rID string) string { return EndpointGuilds + gID + "/members/" + uID + "/roles/" + rID }
EndpointGuildBans = func(gID string) string { return EndpointGuilds + gID + "/bans" }
EndpointGuildBan = func(gID, uID string) string { return EndpointGuilds + gID + "/bans/" + uID }
EndpointGuildIntegrations = func(gID string) string { return EndpointGuilds + gID + "/integrations" }
EndpointGuildIntegration = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID }
EndpointGuildIntegrationSync = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID + "/sync" }
EndpointGuildRoles = func(gID string) string { return EndpointGuilds + gID + "/roles" }
EndpointGuildRole = func(gID, rID string) string { return EndpointGuilds + gID + "/roles/" + rID }
EndpointGuildInvites = func(gID string) string { return EndpointGuilds + gID + "/invites" }
EndpointGuildWidget = func(gID string) string { return EndpointGuilds + gID + "/widget" }
EndpointGuildEmbed = EndpointGuildWidget
EndpointGuildPrune = func(gID string) string { return EndpointGuilds + gID + "/prune" }
EndpointGuildIcon = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".png" }
EndpointGuildIconAnimated = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".gif" }
EndpointGuildSplash = func(gID, hash string) string { return EndpointCDNSplashes + gID + "/" + hash + ".png" }
EndpointGuildWebhooks = func(gID string) string { return EndpointGuilds + gID + "/webhooks" }
EndpointGuildAuditLogs = func(gID string) string { return EndpointGuilds + gID + "/audit-logs" }
EndpointGuildEmojis = func(gID string) string { return EndpointGuilds + gID + "/emojis" }
EndpointGuildEmoji = func(gID, eID string) string { return EndpointGuilds + gID + "/emojis/" + eID }
EndpointGuildBanner = func(gID, hash string) string { return EndpointCDNBanners + gID + "/" + hash + ".png" }
EndpointGuildStickers = func(gID string) string { return EndpointGuilds + gID + "/stickers" }
EndpointGuildSticker = func(gID, sID string) string { return EndpointGuilds + gID + "/stickers/" + sID }

EndpointGuild = func(gID string) string { return EndpointGuilds + gID }
EndpointGuildPreview = func(gID string) string { return EndpointGuilds + gID + "/preview" }
EndpointGuildChannels = func(gID string) string { return EndpointGuilds + gID + "/channels" }
EndpointGuildMembers = func(gID string) string { return EndpointGuilds + gID + "/members" }
EndpointGuildMember = func(gID, uID string) string { return EndpointGuilds + gID + "/members/" + uID }
EndpointGuildMemberRole = func(gID, uID, rID string) string { return EndpointGuilds + gID + "/members/" + uID + "/roles/" + rID }
EndpointGuildBans = func(gID string) string { return EndpointGuilds + gID + "/bans" }
EndpointGuildBan = func(gID, uID string) string { return EndpointGuilds + gID + "/bans/" + uID }
EndpointGuildIntegrations = func(gID string) string { return EndpointGuilds + gID + "/integrations" }
EndpointGuildIntegration = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID }
EndpointGuildIntegrationSync = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID + "/sync" }
EndpointGuildRoles = func(gID string) string { return EndpointGuilds + gID + "/roles" }
EndpointGuildRole = func(gID, rID string) string { return EndpointGuilds + gID + "/roles/" + rID }
EndpointGuildInvites = func(gID string) string { return EndpointGuilds + gID + "/invites" }
EndpointGuildWidget = func(gID string) string { return EndpointGuilds + gID + "/widget" }
EndpointGuildEmbed = EndpointGuildWidget
EndpointGuildPrune = func(gID string) string { return EndpointGuilds + gID + "/prune" }
EndpointGuildIcon = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".png" }
EndpointGuildIconAnimated = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".gif" }
EndpointGuildSplash = func(gID, hash string) string { return EndpointCDNSplashes + gID + "/" + hash + ".png" }
EndpointGuildWebhooks = func(gID string) string { return EndpointGuilds + gID + "/webhooks" }
EndpointGuildAuditLogs = func(gID string) string { return EndpointGuilds + gID + "/audit-logs" }
EndpointGuildEmojis = func(gID string) string { return EndpointGuilds + gID + "/emojis" }
EndpointGuildEmoji = func(gID, eID string) string { return EndpointGuilds + gID + "/emojis/" + eID }
EndpointGuildBanner = func(gID, hash string) string { return EndpointCDNBanners + gID + "/" + hash + ".png" }
EndpointGuildStickers = func(gID string) string { return EndpointGuilds + gID + "/stickers" }
EndpointGuildSticker = func(gID, sID string) string { return EndpointGuilds + gID + "/stickers/" + sID }
EndpointGuildActiveThreads = func(gID string) string { return EndpointGuilds + gID + "/threads/active" }
EndpointChannel = func(cID string) string { return EndpointChannels + cID }
EndpointChannelPermissions = func(cID string) string { return EndpointChannels + cID + "/permissions" }
EndpointChannelPermission = func(cID, tID string) string { return EndpointChannels + cID + "/permissions/" + tID }
Expand All @@ -119,16 +119,18 @@ var (
EndpointChannelMessagePin = func(cID, mID string) string { return EndpointChannel(cID) + "/pins/" + mID }
EndpointChannelMessageCrosspost = func(cID, mID string) string { return EndpointChannel(cID) + "/messages/" + mID + "/crosspost" }
EndpointChannelFollow = func(cID string) string { return EndpointChannel(cID) + "/followers" }
EndpointChannelUsers = func(cID string) string { return EndpointChannel(cID) + "/users" }
EndpointChannelMessageThreads = func(cID, mID string) string {
return EndpointChannels + cID + "/messages/" + mID + "/threads"
}

EndpointChannelStartThreadWithMessage = func(cID string, mID string) string { return EndpointChannels + cID + "/messages/" + mID + "/threads" }
EndpointChannelStartThreadWithoutMessage = func(cID string) string { return EndpointChannels + cID + "/threads" }
EndpointChannelThread = func(cID string) string { return EndpointChannels + cID + "/thread-members/@me" }
EndpointChannelMember = func(cID string, uID string) string { return EndpointChannels + cID + "/thread-members/" + uID }
EndpointChannelListMembers = func(cID string) string { return EndpointChannels + cID + "/thread-members" }
EndpointChannelListActiveThreads = func(cID string) string { return EndpointChannels + cID + "/threads/active" }
EndpointChannelListPublicArchivedThreads = func(cID string) string { return EndpointChannels + cID + "/threads/archived/public" }
EndpointChannelListPrivateArchivedThreads = func(cID string) string { return EndpointChannels + cID + "/threads/archived/private" }
EndpointChannelListJoinedPrivateArchivedThreads = func(cID string) string { return EndpointChannels + cID + "/users/@me/threads/archived/private" }
EndpointThreads = func(cID string) string { return EndpointChannel(cID) + "/threads" }
EndpointThreadMembers = func(cID string) string { return EndpointChannel(cID) + "/thread-members" }
EndpointThreadMember = func(cID, uID string) string { return EndpointChannel(cID) + "/thread-members/" + uID }
EndpointThreadsArchived = func(cID string) string { return EndpointThreads(cID) + "/archived" }
EndpointThreadsPublicArchived = func(cID string) string { return EndpointThreadsArchived(cID) + "/public" }
EndpointThreadsPrivateArchived = func(cID string) string { return EndpointThreadsArchived(cID) + "/private" }
EndpointThreadsJoinedPrivateArchived = func(cID string) string { return EndpointChannelUsers(cID) + "/@me/threads/archived/private" }

EndpointGroupIcon = func(cID, hash string) string { return EndpointCDNChannelIcons + cID + "/" + hash + ".png" }

Expand Down
8 changes: 4 additions & 4 deletions events.go
Expand Up @@ -321,10 +321,10 @@ type ThreadMembersUpdate struct {

// ThreadListSync is the data for a ThreadListSync event
type ThreadListSync struct {
GuildID string `json:"guild_id"`
ChannelIDs []string `json:"channel_ids,omitempty"`
Threads []Channel `json:"threads"`
Members []ThreadMember `json:"members"`
GuildID string `json:"guild_id"`
ChannelIDs []string `json:"channel_ids"`
Threads []*Channel `json:"threads"`
Members []*ThreadMember `json:"members"`
}

// UnmarshalJSON is a helper function to unmarshal Interaction object.
Expand Down
5 changes: 4 additions & 1 deletion message.go
Expand Up @@ -143,7 +143,7 @@ type Message struct {
// The message's response to an Interaction.
Interaction *Interaction `json:"interaction"`

// The thread that was started from this message.
// The thread that was started from this message. Includes the thread member object.
Thread *Channel `json:"thread"`

// If the message is a response to an Interaction, the interaction's application ID
Expand Down Expand Up @@ -201,6 +201,9 @@ const (
MessageFlagsSupressEmbeds MessageFlags = 1 << 2
MessageFlagsSourceMessageDeleted MessageFlags = 1 << 3
MessageFlagsUrgent MessageFlags = 1 << 4
MessageFlagsHasThread MessageFlags = 1 << 5
MessageFlagsEphemeral MessageFlags = 1 << 6
MessageFlagsLoading MessageFlags = 1 << 7
)

// File stores info about files you e.g. send in messages.
Expand Down

0 comments on commit 3f54842

Please sign in to comment.