endpoints.go 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 = "6"
  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. EndpointGuildEmbed = func(gID string) string { return EndpointGuilds + gID + "/embed" }
  80. EndpointGuildPrune = func(gID string) string { return EndpointGuilds + gID + "/prune" }
  81. EndpointGuildIcon = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".png" }
  82. EndpointGuildIconAnimated = func(gID, hash string) string { return EndpointCDNIcons + gID + "/" + hash + ".gif" }
  83. EndpointGuildSplash = func(gID, hash string) string { return EndpointCDNSplashes + gID + "/" + hash + ".png" }
  84. EndpointGuildWebhooks = func(gID string) string { return EndpointGuilds + gID + "/webhooks" }
  85. EndpointGuildAuditLogs = func(gID string) string { return EndpointGuilds + gID + "/audit-logs" }
  86. EndpointGuildEmojis = func(gID string) string { return EndpointGuilds + gID + "/emojis" }
  87. EndpointGuildEmoji = func(gID, eID string) string { return EndpointGuilds + gID + "/emojis/" + eID }
  88. EndpointGuildBanner = func(gID, hash string) string { return EndpointCDNBanners + gID + "/" + hash + ".png" }
  89. EndpointChannel = func(cID string) string { return EndpointChannels + cID }
  90. EndpointChannelPermissions = func(cID string) string { return EndpointChannels + cID + "/permissions" }
  91. EndpointChannelPermission = func(cID, tID string) string { return EndpointChannels + cID + "/permissions/" + tID }
  92. EndpointChannelInvites = func(cID string) string { return EndpointChannels + cID + "/invites" }
  93. EndpointChannelTyping = func(cID string) string { return EndpointChannels + cID + "/typing" }
  94. EndpointChannelMessages = func(cID string) string { return EndpointChannels + cID + "/messages" }
  95. EndpointChannelMessage = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID }
  96. EndpointChannelMessageAck = func(cID, mID string) string { return EndpointChannels + cID + "/messages/" + mID + "/ack" }
  97. EndpointChannelMessagesBulkDelete = func(cID string) string { return EndpointChannel(cID) + "/messages/bulk-delete" }
  98. EndpointChannelMessagesPins = func(cID string) string { return EndpointChannel(cID) + "/pins" }
  99. EndpointChannelMessagePin = func(cID, mID string) string { return EndpointChannel(cID) + "/pins/" + mID }
  100. EndpointGroupIcon = func(cID, hash string) string { return EndpointCDNChannelIcons + cID + "/" + hash + ".png" }
  101. EndpointChannelWebhooks = func(cID string) string { return EndpointChannel(cID) + "/webhooks" }
  102. EndpointWebhook = func(wID string) string { return EndpointWebhooks + wID }
  103. EndpointWebhookToken = func(wID, token string) string { return EndpointWebhooks + wID + "/" + token }
  104. EndpointMessageReactionsAll = func(cID, mID string) string {
  105. return EndpointChannelMessage(cID, mID) + "/reactions"
  106. }
  107. EndpointMessageReactions = func(cID, mID, eID string) string {
  108. return EndpointChannelMessage(cID, mID) + "/reactions/" + eID
  109. }
  110. EndpointMessageReaction = func(cID, mID, eID, uID string) string {
  111. return EndpointMessageReactions(cID, mID, eID) + "/" + uID
  112. }
  113. EndpointRelationships = func() string { return EndpointUsers + "@me" + "/relationships" }
  114. EndpointRelationship = func(uID string) string { return EndpointRelationships() + "/" + uID }
  115. EndpointRelationshipsMutual = func(uID string) string { return EndpointUsers + uID + "/relationships" }
  116. EndpointGuildCreate = EndpointAPI + "guilds"
  117. EndpointInvite = func(iID string) string { return EndpointAPI + "invite/" + iID }
  118. EndpointIntegrationsJoin = func(iID string) string { return EndpointAPI + "integrations/" + iID + "/join" }
  119. EndpointEmoji = func(eID string) string { return EndpointAPI + "emojis/" + eID + ".png" }
  120. EndpointEmojiAnimated = func(eID string) string { return EndpointAPI + "emojis/" + eID + ".gif" }
  121. EndpointOauth2 = EndpointAPI + "oauth2/"
  122. EndpointApplications = EndpointOauth2 + "applications"
  123. EndpointApplication = func(aID string) string { return EndpointApplications + "/" + aID }
  124. EndpointApplicationsBot = func(aID string) string { return EndpointApplications + "/" + aID + "/bot" }
  125. EndpointApplicationAssets = func(aID string) string { return EndpointApplications + "/" + aID + "/assets" }
  126. )