endpoints.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. // Discordgo - Discord bindings for Go
  2. // Available at https://github.com/bwmarrin/discordgo
  3. // Copyright 2015-2016 Bruce Marriner <bruce@sqls.net>. All rights reserved.
  4. // Use of this source code is governed by a BSD-style
  5. // license that can be found in the LICENSE file.
  6. // This file contains variables for all known Discord end points. All functions
  7. // throughout the Discordgo package use these variables for all connections
  8. // to Discord. These are all exported and you may modify them if needed.
  9. package discordgo
  10. import "strconv"
  11. // APIVersion is the Discord API version used for the REST and Websocket API.
  12. var APIVersion = "8"
  13. // Known Discord API Endpoints.
  14. var (
  15. EndpointStatus = "https://status.discord.com/api/v2/"
  16. EndpointSm = EndpointStatus + "scheduled-maintenances/"
  17. EndpointSmActive = EndpointSm + "active.json"
  18. EndpointSmUpcoming = EndpointSm + "upcoming.json"
  19. EndpointDiscord = "https://discord.com/"
  20. EndpointAPI = EndpointDiscord + "api/v" + APIVersion + "/"
  21. EndpointGuilds = EndpointAPI + "guilds/"
  22. EndpointChannels = EndpointAPI + "channels/"
  23. EndpointUsers = EndpointAPI + "users/"
  24. EndpointGateway = EndpointAPI + "gateway"
  25. EndpointGatewayBot = EndpointGateway + "/bot"
  26. EndpointWebhooks = EndpointAPI + "webhooks/"
  27. EndpointCDN = "https://cdn.discordapp.com/"
  28. EndpointCDNAttachments = EndpointCDN + "attachments/"
  29. EndpointCDNAvatars = EndpointCDN + "avatars/"
  30. EndpointCDNIcons = EndpointCDN + "icons/"
  31. EndpointCDNSplashes = EndpointCDN + "splashes/"
  32. EndpointCDNChannelIcons = EndpointCDN + "channel-icons/"
  33. EndpointCDNBanners = EndpointCDN + "banners/"
  34. EndpointAuth = EndpointAPI + "auth/"
  35. EndpointLogin = EndpointAuth + "login"
  36. EndpointLogout = EndpointAuth + "logout"
  37. EndpointVerify = EndpointAuth + "verify"
  38. EndpointVerifyResend = EndpointAuth + "verify/resend"
  39. EndpointForgotPassword = EndpointAuth + "forgot"
  40. EndpointResetPassword = EndpointAuth + "reset"
  41. EndpointRegister = EndpointAuth + "register"
  42. EndpointVoice = EndpointAPI + "/voice/"
  43. EndpointVoiceRegions = EndpointVoice + "regions"
  44. EndpointVoiceIce = EndpointVoice + "ice"
  45. EndpointTutorial = EndpointAPI + "tutorial/"
  46. EndpointTutorialIndicators = EndpointTutorial + "indicators"
  47. EndpointTrack = EndpointAPI + "track"
  48. EndpointSso = EndpointAPI + "sso"
  49. EndpointReport = EndpointAPI + "report"
  50. EndpointIntegrations = EndpointAPI + "integrations"
  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(uDiscriminator string) string {
  55. uDiscriminatorInt, _ := strconv.Atoi(uDiscriminator)
  56. return EndpointCDN + "embed/avatars/" + strconv.Itoa(uDiscriminatorInt%5) + ".png"
  57. }
  58. EndpointUserSettings = func(uID string) string { return EndpointUsers + uID + "/settings" }
  59. EndpointUserGuilds = func(uID string) string { return EndpointUsers + uID + "/guilds" }
  60. EndpointUserGuild = func(uID, gID string) string { return EndpointUsers + uID + "/guilds/" + gID }
  61. EndpointUserGuildSettings = func(uID, gID string) string { return EndpointUsers + uID + "/guilds/" + gID + "/settings" }
  62. EndpointUserChannels = func(uID string) string { return EndpointUsers + uID + "/channels" }
  63. EndpointUserDevices = func(uID string) string { return EndpointUsers + uID + "/devices" }
  64. EndpointUserConnections = func(uID string) string { return EndpointUsers + uID + "/connections" }
  65. EndpointUserNotes = func(uID string) string { return EndpointUsers + "@me/notes/" + uID }
  66. EndpointGuild = func(gID string) string { return EndpointGuilds + gID }
  67. EndpointGuildPreview = func(gID string) string { return EndpointGuilds + gID + "/preview" }
  68. EndpointGuildChannels = func(gID string) string { return EndpointGuilds + gID + "/channels" }
  69. EndpointGuildMembers = func(gID string) string { return EndpointGuilds + gID + "/members" }
  70. EndpointGuildMember = func(gID, uID string) string { return EndpointGuilds + gID + "/members/" + uID }
  71. EndpointGuildMemberRole = func(gID, uID, rID string) string { return EndpointGuilds + gID + "/members/" + uID + "/roles/" + rID }
  72. EndpointGuildBans = func(gID string) string { return EndpointGuilds + gID + "/bans" }
  73. EndpointGuildBan = func(gID, uID string) string { return EndpointGuilds + gID + "/bans/" + uID }
  74. EndpointGuildIntegrations = func(gID string) string { return EndpointGuilds + gID + "/integrations" }
  75. EndpointGuildIntegration = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID }
  76. EndpointGuildIntegrationSync = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID + "/sync" }
  77. EndpointGuildRoles = func(gID string) string { return EndpointGuilds + gID + "/roles" }
  78. EndpointGuildRole = func(gID, rID string) string { return EndpointGuilds + gID + "/roles/" + rID }
  79. EndpointGuildInvites = func(gID string) string { return EndpointGuilds + gID + "/invites" }
  80. EndpointGuildWidget = func(gID string) string { return EndpointGuilds + gID + "/widget" }
  81. EndpointGuildEmbed = EndpointGuildWidget
  82. EndpointGuildPrune = func(gID string) string { return EndpointGuilds + gID + "/prune" }
  83. EndpointGuildIcon = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".png" }
  84. EndpointGuildIconAnimated = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".gif" }
  85. EndpointGuildSplash = func(gID, hash string) string { return EndpointCDNSplashes + gID + "/" + hash + ".png" }
  86. EndpointGuildWebhooks = func(gID string) string { return EndpointGuilds + gID + "/webhooks" }
  87. EndpointGuildAuditLogs = func(gID string) string { return EndpointGuilds + gID + "/audit-logs" }
  88. EndpointGuildEmojis = func(gID string) string { return EndpointGuilds + gID + "/emojis" }
  89. EndpointGuildEmoji = func(gID, eID string) string { return EndpointGuilds + gID + "/emojis/" + eID }
  90. EndpointGuildBanner = func(gID, hash string) string { return EndpointCDNBanners + gID + "/" + hash + ".png" }
  91. EndpointChannel = func(cID string) string { return EndpointChannels + cID }
  92. EndpointChannelPermissions = func(cID string) string { return EndpointChannels + cID + "/permissions" }
  93. EndpointChannelPermission = func(cID, tID string) string { return EndpointChannels + cID + "/permissions/" + tID }
  94. EndpointChannelInvites = func(cID string) string { return EndpointChannels + cID + "/invites" }
  95. EndpointChannelTyping = func(cID string) string { return EndpointChannels + cID + "/typing" }
  96. EndpointChannelMessages = func(cID string) string { return EndpointChannels + cID + "/messages" }
  97. EndpointChannelMessage = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID }
  98. EndpointChannelMessageAck = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID + "/ack" }
  99. EndpointChannelMessagesBulkDelete = func(cID string) string { return EndpointChannel(cID) + "/messages/bulk-delete" }
  100. EndpointChannelMessagesPins = func(cID string) string { return EndpointChannel(cID) + "/pins" }
  101. EndpointChannelMessagePin = func(cID, mID string) string { return EndpointChannel(cID) + "/pins/" + mID }
  102. EndpointChannelMessageCrosspost = func(cID, mID string) string { return EndpointChannel(cID) + "/messages/" + mID + "/crosspost" }
  103. EndpointChannelFollow = func(cID string) string { return EndpointChannel(cID) + "/followers" }
  104. EndpointGroupIcon = func(cID, hash string) string { return EndpointCDNChannelIcons + cID + "/" + hash + ".png" }
  105. EndpointChannelWebhooks = func(cID string) string { return EndpointChannel(cID) + "/webhooks" }
  106. EndpointWebhook = func(wID string) string { return EndpointWebhooks + wID }
  107. EndpointWebhookToken = func(wID, token string) string { return EndpointWebhooks + wID + "/" + token }
  108. EndpointWebhookMessage = func(wID, token, messageID string) string {
  109. return EndpointWebhookToken(wID, token) + "/messages/" + messageID
  110. }
  111. EndpointMessageReactionsAll = func(cID, mID string) string {
  112. return EndpointChannelMessage(cID, mID) + "/reactions"
  113. }
  114. EndpointMessageReactions = func(cID, mID, eID string) string {
  115. return EndpointChannelMessage(cID, mID) + "/reactions/" + eID
  116. }
  117. EndpointMessageReaction = func(cID, mID, eID, uID string) string {
  118. return EndpointMessageReactions(cID, mID, eID) + "/" + uID
  119. }
  120. EndpointApplicationGlobalCommands = func(aID string) string {
  121. return EndpointApplication(aID) + "/commands"
  122. }
  123. EndpointApplicationGlobalCommand = func(aID, cID string) string {
  124. return EndpointApplicationGlobalCommands(aID) + "/" + cID
  125. }
  126. EndpointApplicationGuildCommands = func(aID, gID string) string {
  127. return EndpointApplication(aID) + "/guilds/" + gID + "/commands"
  128. }
  129. EndpointApplicationGuildCommand = func(aID, gID, cID string) string {
  130. return EndpointApplicationGuildCommands(aID, gID) + "/" + cID
  131. }
  132. EndpointInteraction = func(aID, iToken string) string {
  133. return EndpointAPI + "interactions/" + aID + "/" + iToken
  134. }
  135. EndpointInteractionResponse = func(iID, iToken string) string {
  136. return EndpointInteraction(iID, iToken) + "/callback"
  137. }
  138. EndpointInteractionResponseActions = func(aID, iToken string) string {
  139. return EndpointWebhookMessage(aID, iToken, "@original")
  140. }
  141. EndpointFollowupMessage = func(aID, iToken string) string {
  142. return EndpointWebhookToken(aID, iToken)
  143. }
  144. EndpointFollowupMessageActions = func(aID, iToken, mID string) string {
  145. return EndpointWebhookMessage(aID, iToken, mID)
  146. }
  147. EndpointRelationships = func() string { return EndpointUsers + "@me" + "/relationships" }
  148. EndpointRelationship = func(uID string) string { return EndpointRelationships() + "/" + uID }
  149. EndpointRelationshipsMutual = func(uID string) string { return EndpointUsers + uID + "/relationships" }
  150. EndpointGuildCreate = EndpointAPI + "guilds"
  151. EndpointInvite = func(iID string) string { return EndpointAPI + "invites/" + iID }
  152. EndpointIntegrationsJoin = func(iID string) string { return EndpointAPI + "integrations/" + iID + "/join" }
  153. EndpointEmoji = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".png" }
  154. EndpointEmojiAnimated = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".gif" }
  155. EndpointApplications = EndpointAPI + "applications"
  156. EndpointApplication = func(aID string) string { return EndpointApplications + "/" + aID }
  157. EndpointOAuth2 = EndpointAPI + "oauth2/"
  158. EndpointOAuth2Applications = EndpointOAuth2 + "applications"
  159. EndpointOAuth2Application = func(aID string) string { return EndpointOAuth2Applications + "/" + aID }
  160. EndpointOAuth2ApplicationsBot = func(aID string) string { return EndpointOAuth2Applications + "/" + aID + "/bot" }
  161. EndpointOAuth2ApplicationAssets = func(aID string) string { return EndpointOAuth2Applications + "/" + aID + "/assets" }
  162. // TODO: Deprecated, remove in the next release
  163. EndpointOauth2 = EndpointOAuth2
  164. EndpointOauth2Applications = EndpointOAuth2Applications
  165. EndpointOauth2Application = EndpointOAuth2Application
  166. EndpointOauth2ApplicationsBot = EndpointOAuth2ApplicationsBot
  167. EndpointOauth2ApplicationAssets = EndpointOAuth2ApplicationAssets
  168. )