github.com/meowstercatel/discordgo@v0.0.0-20250615204139-29b43d676735/endpoints.go (about) 1 // Discordgo - Discord bindings for Go 2 // Available at https://github.com/bwmarrin/discordgo 3 4 // Copyright 2015-2016 Bruce Marriner <bruce@sqls.net>. All rights reserved. 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file. 7 8 // This file contains variables for all known Discord end points. All functions 9 // throughout the Discordgo package use these variables for all connections 10 // to Discord. These are all exported and you may modify them if needed. 11 12 package discordgo 13 14 import "strconv" 15 16 // APIVersion is the Discord API version used for the REST and Websocket API. 17 var APIVersion = "9" 18 19 // Known Discord API Endpoints. 20 var ( 21 EndpointStatus = "https://status.discord.com/api/v2/" 22 EndpointSm = EndpointStatus + "scheduled-maintenances/" 23 EndpointSmActive = EndpointSm + "active.json" 24 EndpointSmUpcoming = EndpointSm + "upcoming.json" 25 26 EndpointDiscord = "https://discord.com/" 27 EndpointAPI = EndpointDiscord + "api/v" + APIVersion + "/" 28 EndpointGuilds = EndpointAPI + "guilds/" 29 EndpointChannels = EndpointAPI + "channels/" 30 EndpointUsers = EndpointAPI + "users/" 31 EndpointGateway = EndpointAPI + "gateway" 32 EndpointGatewayBot = EndpointGateway + "/bot" 33 EndpointWebhooks = EndpointAPI + "webhooks/" 34 EndpointStickers = EndpointAPI + "stickers/" 35 EndpointStageInstances = EndpointAPI + "stage-instances" 36 EndpointSKUs = EndpointAPI + "skus" 37 38 EndpointCDN = "https://cdn.discordapp.com/" 39 EndpointCDNAttachments = EndpointCDN + "attachments/" 40 EndpointCDNAvatars = EndpointCDN + "avatars/" 41 EndpointCDNIcons = EndpointCDN + "icons/" 42 EndpointCDNSplashes = EndpointCDN + "splashes/" 43 EndpointCDNChannelIcons = EndpointCDN + "channel-icons/" 44 EndpointCDNBanners = EndpointCDN + "banners/" 45 EndpointCDNGuilds = EndpointCDN + "guilds/" 46 EndpointCDNRoleIcons = EndpointCDN + "role-icons/" 47 48 EndpointVoice = EndpointAPI + "/voice/" 49 EndpointVoiceRegions = EndpointVoice + "regions" 50 51 EndpointUser = func(uID string) string { return EndpointUsers + uID } 52 EndpointUserAvatar = func(uID, aID string) string { return EndpointCDNAvatars + uID + "/" + aID + ".png" } 53 EndpointUserAvatarAnimated = func(uID, aID string) string { return EndpointCDNAvatars + uID + "/" + aID + ".gif" } 54 EndpointDefaultUserAvatar = func(idx int) string { 55 return EndpointCDN + "embed/avatars/" + strconv.Itoa(idx) + ".png" 56 } 57 EndpointUserBanner = func(uID, cID string) string { 58 return EndpointCDNBanners + uID + "/" + cID + ".png" 59 } 60 EndpointUserBannerAnimated = func(uID, cID string) string { 61 return EndpointCDNBanners + uID + "/" + cID + ".gif" 62 } 63 64 EndpointUserGuilds = func(uID string) string { return EndpointUsers + uID + "/guilds" } 65 EndpointUserGuild = func(uID, gID string) string { return EndpointUsers + uID + "/guilds/" + gID } 66 EndpointUserGuildMember = func(uID, gID string) string { return EndpointUserGuild(uID, gID) + "/member" } 67 EndpointUserChannels = func(uID string) string { return EndpointUsers + uID + "/channels" } 68 EndpointUserApplicationRoleConnection = func(aID string) string { return EndpointUsers + "@me/applications/" + aID + "/role-connection" } 69 EndpointUserConnections = func(uID string) string { return EndpointUsers + uID + "/connections" } 70 71 EndpointGuild = func(gID string) string { return EndpointGuilds + gID } 72 EndpointGuildAutoModeration = func(gID string) string { return EndpointGuild(gID) + "/auto-moderation" } 73 EndpointGuildAutoModerationRules = func(gID string) string { return EndpointGuildAutoModeration(gID) + "/rules" } 74 EndpointGuildAutoModerationRule = func(gID, rID string) string { return EndpointGuildAutoModerationRules(gID) + "/" + rID } 75 EndpointGuildThreads = func(gID string) string { return EndpointGuild(gID) + "/threads" } 76 EndpointGuildActiveThreads = func(gID string) string { return EndpointGuildThreads(gID) + "/active" } 77 EndpointGuildPreview = func(gID string) string { return EndpointGuilds + gID + "/preview" } 78 EndpointGuildChannels = func(gID string) string { return EndpointGuilds + gID + "/channels" } 79 EndpointGuildMembers = func(gID string) string { return EndpointGuilds + gID + "/members" } 80 EndpointGuildMembersSearch = func(gID string) string { return EndpointGuildMembers(gID) + "/search" } 81 EndpointGuildMember = func(gID, uID string) string { return EndpointGuilds + gID + "/members/" + uID } 82 EndpointGuildMemberRole = func(gID, uID, rID string) string { return EndpointGuilds + gID + "/members/" + uID + "/roles/" + rID } 83 EndpointGuildBans = func(gID string) string { return EndpointGuilds + gID + "/bans" } 84 EndpointGuildBan = func(gID, uID string) string { return EndpointGuilds + gID + "/bans/" + uID } 85 EndpointGuildIntegrations = func(gID string) string { return EndpointGuilds + gID + "/integrations" } 86 EndpointGuildIntegration = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID } 87 EndpointGuildRoles = func(gID string) string { return EndpointGuilds + gID + "/roles" } 88 EndpointGuildRole = func(gID, rID string) string { return EndpointGuilds + gID + "/roles/" + rID } 89 EndpointGuildInvites = func(gID string) string { return EndpointGuilds + gID + "/invites" } 90 EndpointGuildWidget = func(gID string) string { return EndpointGuilds + gID + "/widget" } 91 EndpointGuildEmbed = EndpointGuildWidget 92 EndpointGuildPrune = func(gID string) string { return EndpointGuilds + gID + "/prune" } 93 EndpointGuildIcon = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".png" } 94 EndpointGuildIconAnimated = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".gif" } 95 EndpointGuildSplash = func(gID, hash string) string { return EndpointCDNSplashes + gID + "/" + hash + ".png" } 96 EndpointGuildWebhooks = func(gID string) string { return EndpointGuilds + gID + "/webhooks" } 97 EndpointGuildAuditLogs = func(gID string) string { return EndpointGuilds + gID + "/audit-logs" } 98 EndpointGuildEmojis = func(gID string) string { return EndpointGuilds + gID + "/emojis" } 99 EndpointGuildEmoji = func(gID, eID string) string { return EndpointGuilds + gID + "/emojis/" + eID } 100 EndpointGuildBanner = func(gID, hash string) string { return EndpointCDNBanners + gID + "/" + hash + ".png" } 101 EndpointGuildBannerAnimated = func(gID, hash string) string { return EndpointCDNBanners + gID + "/" + hash + ".gif" } 102 EndpointGuildStickers = func(gID string) string { return EndpointGuilds + gID + "/stickers" } 103 EndpointGuildSticker = func(gID, sID string) string { return EndpointGuilds + gID + "/stickers/" + sID } 104 EndpointStageInstance = func(cID string) string { return EndpointStageInstances + "/" + cID } 105 EndpointGuildScheduledEvents = func(gID string) string { return EndpointGuilds + gID + "/scheduled-events" } 106 EndpointGuildScheduledEvent = func(gID, eID string) string { return EndpointGuilds + gID + "/scheduled-events/" + eID } 107 EndpointGuildScheduledEventUsers = func(gID, eID string) string { return EndpointGuildScheduledEvent(gID, eID) + "/users" } 108 EndpointGuildOnboarding = func(gID string) string { return EndpointGuilds + gID + "/onboarding" } 109 EndpointGuildTemplate = func(tID string) string { return EndpointGuilds + "templates/" + tID } 110 EndpointGuildTemplates = func(gID string) string { return EndpointGuilds + gID + "/templates" } 111 EndpointGuildTemplateSync = func(gID, tID string) string { return EndpointGuilds + gID + "/templates/" + tID } 112 EndpointGuildMemberAvatar = func(gId, uID, aID string) string { 113 return EndpointCDNGuilds + gId + "/users/" + uID + "/avatars/" + aID + ".png" 114 } 115 EndpointGuildMemberAvatarAnimated = func(gId, uID, aID string) string { 116 return EndpointCDNGuilds + gId + "/users/" + uID + "/avatars/" + aID + ".gif" 117 } 118 EndpointGuildMemberBanner = func(gId, uID, hash string) string { 119 return EndpointCDNGuilds + gId + "/users/" + uID + "/banners/" + hash + ".png" 120 } 121 EndpointGuildMemberBannerAnimated = func(gId, uID, hash string) string { 122 return EndpointCDNGuilds + gId + "/users/" + uID + "/banners/" + hash + ".gif" 123 } 124 125 EndpointRoleIcon = func(rID, hash string) string { 126 return EndpointCDNRoleIcons + rID + "/" + hash + ".png" 127 } 128 129 EndpointChannel = func(cID string) string { return EndpointChannels + cID } 130 EndpointChannelThreads = func(cID string) string { return EndpointChannel(cID) + "/threads" } 131 EndpointChannelActiveThreads = func(cID string) string { return EndpointChannelThreads(cID) + "/active" } 132 EndpointChannelPublicArchivedThreads = func(cID string) string { return EndpointChannelThreads(cID) + "/archived/public" } 133 EndpointChannelPrivateArchivedThreads = func(cID string) string { return EndpointChannelThreads(cID) + "/archived/private" } 134 EndpointChannelJoinedPrivateArchivedThreads = func(cID string) string { return EndpointChannel(cID) + "/users/@me/threads/archived/private" } 135 EndpointChannelPermissions = func(cID string) string { return EndpointChannels + cID + "/permissions" } 136 EndpointChannelPermission = func(cID, tID string) string { return EndpointChannels + cID + "/permissions/" + tID } 137 EndpointChannelInvites = func(cID string) string { return EndpointChannels + cID + "/invites" } 138 EndpointChannelTyping = func(cID string) string { return EndpointChannels + cID + "/typing" } 139 EndpointChannelMessages = func(cID string) string { return EndpointChannels + cID + "/messages" } 140 EndpointChannelMessage = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID } 141 EndpointChannelMessageThread = func(cID, mID string) string { return EndpointChannelMessage(cID, mID) + "/threads" } 142 EndpointChannelMessagesBulkDelete = func(cID string) string { return EndpointChannel(cID) + "/messages/bulk-delete" } 143 EndpointChannelMessagesPins = func(cID string) string { return EndpointChannel(cID) + "/pins" } 144 EndpointChannelMessagePin = func(cID, mID string) string { return EndpointChannel(cID) + "/pins/" + mID } 145 EndpointChannelMessageCrosspost = func(cID, mID string) string { return EndpointChannel(cID) + "/messages/" + mID + "/crosspost" } 146 EndpointChannelFollow = func(cID string) string { return EndpointChannel(cID) + "/followers" } 147 EndpointThreadMembers = func(tID string) string { return EndpointChannel(tID) + "/thread-members" } 148 EndpointThreadMember = func(tID, mID string) string { return EndpointThreadMembers(tID) + "/" + mID } 149 150 EndpointGroupIcon = func(cID, hash string) string { return EndpointCDNChannelIcons + cID + "/" + hash + ".png" } 151 152 EndpointSticker = func(sID string) string { return EndpointStickers + sID } 153 EndpointNitroStickersPacks = EndpointAPI + "/sticker-packs" 154 155 EndpointChannelWebhooks = func(cID string) string { return EndpointChannel(cID) + "/webhooks" } 156 EndpointWebhook = func(wID string) string { return EndpointWebhooks + wID } 157 EndpointWebhookToken = func(wID, token string) string { return EndpointWebhooks + wID + "/" + token } 158 EndpointWebhookMessage = func(wID, token, messageID string) string { 159 return EndpointWebhookToken(wID, token) + "/messages/" + messageID 160 } 161 162 EndpointMessageReactionsAll = func(cID, mID string) string { 163 return EndpointChannelMessage(cID, mID) + "/reactions" 164 } 165 EndpointMessageReactions = func(cID, mID, eID string) string { 166 return EndpointChannelMessage(cID, mID) + "/reactions/" + eID 167 } 168 EndpointMessageReaction = func(cID, mID, eID, uID string) string { 169 return EndpointMessageReactions(cID, mID, eID) + "/" + uID 170 } 171 172 EndpointPoll = func(cID, mID string) string { 173 return EndpointChannel(cID) + "/polls/" + mID 174 } 175 EndpointPollAnswerVoters = func(cID, mID string, aID int) string { 176 return EndpointPoll(cID, mID) + "/answers/" + strconv.Itoa(aID) 177 } 178 EndpointPollExpire = func(cID, mID string) string { 179 return EndpointPoll(cID, mID) + "/expire" 180 } 181 182 EndpointApplicationSKUs = func(aID string) string { 183 return EndpointApplication(aID) + "/skus" 184 } 185 186 EndpointEntitlements = func(aID string) string { 187 return EndpointApplication(aID) + "/entitlements" 188 } 189 EndpointEntitlement = func(aID, eID string) string { 190 return EndpointEntitlements(aID) + "/" + eID 191 } 192 EndpointEntitlementConsume = func(aID, eID string) string { 193 return EndpointEntitlement(aID, eID) + "/consume" 194 } 195 196 EndpointSubscriptions = func(skuID string) string { 197 return EndpointSKUs + "/" + skuID + "/subscriptions" 198 } 199 EndpointSubscription = func(skuID, subID string) string { 200 return EndpointSubscriptions(skuID) + "/" + subID 201 } 202 203 EndpointApplicationGlobalCommands = func(aID string) string { 204 return EndpointApplication(aID) + "/commands" 205 } 206 EndpointApplicationGlobalCommand = func(aID, cID string) string { 207 return EndpointApplicationGlobalCommands(aID) + "/" + cID 208 } 209 210 EndpointApplicationGuildCommands = func(aID, gID string) string { 211 return EndpointApplication(aID) + "/guilds/" + gID + "/commands" 212 } 213 EndpointApplicationGuildCommand = func(aID, gID, cID string) string { 214 return EndpointApplicationGuildCommands(aID, gID) + "/" + cID 215 } 216 EndpointApplicationCommandPermissions = func(aID, gID, cID string) string { 217 return EndpointApplicationGuildCommand(aID, gID, cID) + "/permissions" 218 } 219 EndpointApplicationCommandsGuildPermissions = func(aID, gID string) string { 220 return EndpointApplicationGuildCommands(aID, gID) + "/permissions" 221 } 222 EndpointInteraction = func(aID, iToken string) string { 223 return EndpointAPI + "interactions/" + aID + "/" + iToken 224 } 225 EndpointInteractionResponse = func(iID, iToken string) string { 226 return EndpointInteraction(iID, iToken) + "/callback" 227 } 228 EndpointInteractionResponseActions = func(aID, iToken string) string { 229 return EndpointWebhookMessage(aID, iToken, "@original") 230 } 231 EndpointFollowupMessage = func(aID, iToken string) string { 232 return EndpointWebhookToken(aID, iToken) 233 } 234 EndpointFollowupMessageActions = func(aID, iToken, mID string) string { 235 return EndpointWebhookMessage(aID, iToken, mID) 236 } 237 238 EndpointGuildCreate = EndpointAPI + "guilds" 239 240 EndpointInvite = func(iID string) string { return EndpointAPI + "invites/" + iID } 241 242 EndpointEmoji = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".png" } 243 EndpointEmojiAnimated = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".gif" } 244 245 EndpointApplications = EndpointAPI + "applications" 246 EndpointApplication = func(aID string) string { return EndpointApplications + "/" + aID } 247 EndpointApplicationRoleConnectionMetadata = func(aID string) string { return EndpointApplication(aID) + "/role-connections/metadata" } 248 249 EndpointApplicationEmojis = func(aID string) string { return EndpointApplication(aID) + "/emojis" } 250 EndpointApplicationEmoji = func(aID, eID string) string { return EndpointApplication(aID) + "/emojis/" + eID } 251 252 EndpointOAuth2 = EndpointAPI + "oauth2/" 253 EndpointOAuth2Applications = EndpointOAuth2 + "applications" 254 EndpointOAuth2Application = func(aID string) string { return EndpointOAuth2Applications + "/" + aID } 255 EndpointOAuth2ApplicationsBot = func(aID string) string { return EndpointOAuth2Applications + "/" + aID + "/bot" } 256 EndpointOAuth2ApplicationAssets = func(aID string) string { return EndpointOAuth2Applications + "/" + aID + "/assets" } 257 258 // TODO: Deprecated, remove in the next release 259 EndpointOauth2 = EndpointOAuth2 260 EndpointOauth2Applications = EndpointOAuth2Applications 261 EndpointOauth2Application = EndpointOAuth2Application 262 EndpointOauth2ApplicationsBot = EndpointOAuth2ApplicationsBot 263 EndpointOauth2ApplicationAssets = EndpointOAuth2ApplicationAssets 264 )