endpoints.go 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. EndpointGuildChannels = func(gID string) string { return EndpointGuilds + gID + "/channels" }
  68. EndpointGuildMembers = func(gID string) string { return EndpointGuilds + gID + "/members" }
  69. EndpointGuildMember = func(gID, uID string) string { return EndpointGuilds + gID + "/members/" + uID }
  70. EndpointGuildMemberRole = func(gID, uID, rID string) string { return EndpointGuilds + gID + "/members/" + uID + "/roles/" + rID }
  71. EndpointGuildBans = func(gID string) string { return EndpointGuilds + gID + "/bans" }
  72. EndpointGuildBan = func(gID, uID string) string { return EndpointGuilds + gID + "/bans/" + uID }
  73. EndpointGuildIntegrations = func(gID string) string { return EndpointGuilds + gID + "/integrations" }
  74. EndpointGuildIntegration = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID }
  75. EndpointGuildIntegrationSync = func(gID, iID string) string { return EndpointGuilds + gID + "/integrations/" + iID + "/sync" }
  76. EndpointGuildRoles = func(gID string) string { return EndpointGuilds + gID + "/roles" }
  77. EndpointGuildRole = func(gID, rID string) string { return EndpointGuilds + gID + "/roles/" + rID }
  78. EndpointGuildInvites = func(gID string) string { return EndpointGuilds + gID + "/invites" }
  79. EndpointGuildWidget = func(gID string) string { return EndpointGuilds + gID + "/widget" }
  80. EndpointGuildEmbed = EndpointGuildWidget
  81. EndpointGuildPrune = func(gID string) string { return EndpointGuilds + gID + "/prune" }
  82. EndpointGuildIcon = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".png" }
  83. EndpointGuildIconAnimated = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".gif" }
  84. EndpointGuildSplash = func(gID, hash string) string { return EndpointCDNSplashes + gID + "/" + hash + ".png" }
  85. EndpointGuildWebhooks = func(gID string) string { return EndpointGuilds + gID + "/webhooks" }
  86. EndpointGuildAuditLogs = func(gID string) string { return EndpointGuilds + gID + "/audit-logs" }
  87. EndpointGuildEmojis = func(gID string) string { return EndpointGuilds + gID + "/emojis" }
  88. EndpointGuildEmoji = func(gID, eID string) string { return EndpointGuilds + gID + "/emojis/" + eID }
  89. EndpointGuildBanner = func(gID, hash string) string { return EndpointCDNBanners + gID + "/" + hash + ".png" }
  90. EndpointChannel = func(cID string) string { return EndpointChannels + cID }
  91. EndpointChannelPermissions = func(cID string) string { return EndpointChannels + cID + "/permissions" }
  92. EndpointChannelPermission = func(cID, tID string) string { return EndpointChannels + cID + "/permissions/" + tID }
  93. EndpointChannelInvites = func(cID string) string { return EndpointChannels + cID + "/invites" }
  94. EndpointChannelTyping = func(cID string) string { return EndpointChannels + cID + "/typing" }
  95. EndpointChannelMessages = func(cID string) string { return EndpointChannels + cID + "/messages" }
  96. EndpointChannelMessage = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID }
  97. EndpointChannelMessageAck = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID + "/ack" }
  98. EndpointChannelMessagesBulkDelete = func(cID string) string { return EndpointChannel(cID) + "/messages/bulk-delete" }
  99. EndpointChannelMessagesPins = func(cID string) string { return EndpointChannel(cID) + "/pins" }
  100. EndpointChannelMessagePin = func(cID, mID string) string { return EndpointChannel(cID) + "/pins/" + mID }
  101. EndpointChannelMessageCrosspost = func(cID, mID string) string { return EndpointChannel(cID) + "/messages/" + mID + "/crosspost" }
  102. EndpointChannelFollow = func(cID string) string { return EndpointChannel(cID) + "/followers" }
  103. EndpointGroupIcon = func(cID, hash string) string { return EndpointCDNChannelIcons + cID + "/" + hash + ".png" }
  104. EndpointChannelWebhooks = func(cID string) string { return EndpointChannel(cID) + "/webhooks" }
  105. EndpointWebhook = func(wID string) string { return EndpointWebhooks + wID }
  106. EndpointWebhookToken = func(wID, token string) string { return EndpointWebhooks + wID + "/" + token }
  107. EndpointMessageReactionsAll = func(cID, mID string) string {
  108. return EndpointChannelMessage(cID, mID) + "/reactions"
  109. }
  110. EndpointMessageReactions = func(cID, mID, eID string) string {
  111. return EndpointChannelMessage(cID, mID) + "/reactions/" + eID
  112. }
  113. EndpointMessageReaction = func(cID, mID, eID, uID string) string {
  114. return EndpointMessageReactions(cID, mID, eID) + "/" + uID
  115. }
  116. EndpointRelationships = func() string { return EndpointUsers + "@me" + "/relationships" }
  117. EndpointRelationship = func(uID string) string { return EndpointRelationships() + "/" + uID }
  118. EndpointRelationshipsMutual = func(uID string) string { return EndpointUsers + uID + "/relationships" }
  119. EndpointGuildCreate = EndpointAPI + "guilds"
  120. EndpointInvite = func(iID string) string { return EndpointAPI + "invite/" + iID }
  121. EndpointIntegrationsJoin = func(iID string) string { return EndpointAPI + "integrations/" + iID + "/join" }
  122. EndpointEmoji = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".png" }
  123. EndpointEmojiAnimated = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".gif" }
  124. EndpointOauth2 = EndpointAPI + "oauth2/"
  125. EndpointApplications = EndpointOauth2 + "applications"
  126. EndpointApplication = func(aID string) string { return EndpointApplications + "/" + aID }
  127. EndpointApplicationsBot = func(aID string) string { return EndpointApplications + "/" + aID + "/bot" }
  128. EndpointApplicationAssets = func(aID string) string { return EndpointApplications + "/" + aID + "/assets" }
  129. )