-
Notifications
You must be signed in to change notification settings - Fork 910
/
endpoints.go
369 lines (311 loc) · 17.9 KB
/
endpoints.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
// Discordgo - Discord bindings for Go
// Available at https://github.com/bwmarrin/discordgo
// Copyright 2015-2016 Bruce Marriner <bruce@sqls.net>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file contains variables for all known Discord end points. All functions
// throughout the Discordgo package use these variables for all connections
// to Discord. These are all exported and you may modify them if needed.
package discordgo
import "strconv"
// APIVersion is the Discord API version used for the REST and Websocket API.
var APIVersion = "10"
// Known Discord API Endpoints.
var (
EndpointStatus string
EndpointSm string
EndpointSmActive string
EndpointSmUpcoming string
EndpointDiscord string
EndpointAPI string
EndpointGuilds string
EndpointChannels string
EndpointUsers string
EndpointGateway string
EndpointGatewayBot string
EndpointWebhooks string
EndpointCDN string
EndpointCDNAttachments string
EndpointCDNAvatars string
EndpointCDNGuilds string
EndpointCDNIcons string
EndpointCDNSplashes string
EndpointCDNChannelIcons string
EndpointAuth string
EndpointLogin string
EndpointLogout string
EndpointVerify string
EndpointVerifyResend string
EndpointForgotPassword string
EndpointResetPassword string
EndpointRegister string
EndpointVoice string
EndpointVoiceRegions string
EndpointVoiceIce string
EndpointTutorial string
EndpointTutorialIndicators string
EndpointTrack string
EndpointSso string
EndpointReport string
EndpointIntegrations string
EndpointUser = func(uID string) string { return "" }
EndpointUserAvatar = func(uID int64, aID string) string { return "" }
EndpointUserAvatarAnimated = func(uID int64, aID string) string { return "" }
EndpointUserSettings = func(uID string) string { return "" }
EndpointUserGuilds = func(uID string) string { return "" }
EndpointUserGuild = func(uID string, gID int64) string { return "" }
EndpointUserGuildSettings = func(uID string, gID int64) string { return "" }
EndpointUserChannels = func(uID string) string { return "" }
EndpointUserDevices = func(uID string) string { return "" }
EndpointUserConnections = func(uID string) string { return "" }
EndpointUserNotes = func(uID int64) string { return "" }
EndpointGuild = func(gID int64) string { return "" }
EndpointGuildChannels = func(gID int64) string { return "" }
EndpointGuildMembers = func(gID int64) string { return "" }
EndpointGuildMember = func(gID int64, uID int64) string { return "" }
EndpointGuildMemberAvatar = func(gID, uID int64, aID string) string { return "" }
EndpointGuildMemberAvatarAnimated = func(gID, uID int64, aID string) string { return "" }
EndpointGuildMemberMe = func(gID int64) string { return "" }
EndpointGuildMemberRole = func(gID, uID, rID int64) string {
return ""
}
EndpointGuildBans = func(gID int64) string { return "" }
EndpointGuildBan = func(gID, uID int64) string { return "" }
EndpointGuildIntegrations = func(gID int64) string { return "" }
EndpointGuildIntegration = func(gID, iID int64) string { return "" }
EndpointGuildIntegrationSync = func(gID, iID int64) string {
return ""
}
EndpointGuildRoles = func(gID int64) string { return "" }
EndpointGuildRole = func(gID, rID int64) string { return "" }
EndpointGuildInvites = func(gID int64) string { return "" }
EndpointGuildEmbed = func(gID int64) string { return "" }
EndpointGuildPrune = func(gID int64) string { return "" }
EndpointGuildIcon = func(gID int64, hash string) string { return "" }
EndpointGuildSplash = func(gID int64, hash string) string { return "" }
EndpointGuildWebhooks = func(gID int64) string { return "" }
EndpointGuildAuditLogs = func(gID int64) string { return "" }
EndpointGuildEmojis = func(gID int64) string { return "" }
EndpointGuildEmoji = func(gID, eID int64) string { return "" }
EndpointChannel = func(cID int64) string { return "" }
EndpointChannelPermissions = func(cID int64) string { return "" }
EndpointChannelPermission = func(cID, tID int64) string { return "" }
EndpointChannelInvites = func(cID int64) string { return "" }
EndpointChannelTyping = func(cID int64) string { return "" }
EndpointChannelMessages = func(cID int64) string { return "" }
EndpointChannelMessage = func(cID, mID int64) string { return "" }
EndpointChannelMessageAck = func(cID, mID int64) string { return "" }
EndpointChannelMessagesBulkDelete = func(cID int64) string { return "" }
EndpointChannelMessagesPins = func(cID int64) string { return "" }
EndpointChannelMessagePin = func(cID, mID int64) string { return "" }
EndpointGroupIcon = func(cID int64, hash string) string { return "" }
EndpointChannelWebhooks = func(cID int64) string { return "" }
EndpointWebhook = func(wID int64) string { return "" }
EndpointWebhookToken = func(wID int64, token string) string { return "" }
EndpointDefaultUserAvatar = func(uDiscriminator string) string { return "" }
EndpointMessageReactionsAll = func(cID, mID int64) string { return "" }
EndpointMessageReactions = func(cID, mID int64, emoji EmojiName) string {
return ""
}
EndpointMessageReaction = func(cID, mID int64, emoji EmojiName, uID string) string {
return ""
}
EndpointRelationships = func() string { return "" }
EndpointRelationship = func(uID int64) string { return "" }
EndpointRelationshipsMutual = func(uID int64) string { return "" }
EndpointGuildCreate = ""
EndpointInvite = func(iID string) string { return "" }
EndpointIntegrationsJoin = func(iID string) string { return "" }
EndpointEmoji = func(eID int64) string { return "" }
EndpointEmojiAnimated = func(eID int64) string { return "" }
EndpointOauth2 = ""
EndpointApplications = ""
EndpointApplication = func(aID int64) string { return "" }
EndpointApplicationMe = ""
EndpointApplicationsBot = func(aID int64) string { return "" }
EndpointApplicationNonOauth2 = func(aID int64) string { return "" }
EndpointApplicationCommands = func(aID int64) string { return "" }
EndpointApplicationCommand = func(aID int64, cmdID int64) string {
return ""
}
EndpointApplicationGuildCommands = func(aID int64, gID int64) string {
return ""
}
EndpointApplicationGuildCommand = func(aID int64, gID int64, cmdID int64) string {
return ""
}
EndpointApplicationGuildCommandsPermissions = func(aID int64, gID int64) string {
return ""
}
EndpointApplicationGuildCommandPermissions = func(aID int64, gID int64, cmdID int64) string {
return ""
}
EndpointInteractions = ""
EndpointInteractionCallback = func(interactionID int64, token string) string {
return ""
}
EndpointWebhookInteraction = func(applicationID int64, token string) string {
return ""
}
EndpointInteractionOriginalMessage = func(applicationID int64, token string) string {
return ""
}
EndpointInteractionFollowupMessage = func(applicationID int64, token string, messageID int64) string {
return ""
}
)
func CreateEndpoints(base string) {
EndpointStatus = "https://status.discord.com/api/v2/"
EndpointSm = EndpointStatus + "scheduled-maintenances/"
EndpointSmActive = EndpointSm + "active.json"
EndpointSmUpcoming = EndpointSm + "upcoming.json"
EndpointDiscord = base
EndpointAPI = EndpointDiscord + "api/v" + APIVersion + "/"
EndpointGuilds = EndpointAPI + "guilds/"
EndpointChannels = EndpointAPI + "channels/"
EndpointUsers = EndpointAPI + "users/"
EndpointGateway = EndpointAPI + "gateway"
EndpointGatewayBot = EndpointGateway + "/bot"
EndpointWebhooks = EndpointAPI + "webhooks/"
EndpointCDN = "https://cdn.discordapp.com/"
EndpointCDNAttachments = EndpointCDN + "attachments/"
EndpointCDNAvatars = EndpointCDN + "avatars/"
EndpointCDNGuilds = EndpointCDN + "guilds/"
EndpointCDNIcons = EndpointCDN + "icons/"
EndpointCDNSplashes = EndpointCDN + "splashes/"
EndpointCDNChannelIcons = EndpointCDN + "channel-icons/"
EndpointAuth = EndpointAPI + "auth/"
EndpointLogin = EndpointAuth + "login"
EndpointLogout = EndpointAuth + "logout"
EndpointVerify = EndpointAuth + "verify"
EndpointVerifyResend = EndpointAuth + "verify/resend"
EndpointForgotPassword = EndpointAuth + "forgot"
EndpointResetPassword = EndpointAuth + "reset"
EndpointRegister = EndpointAuth + "register"
EndpointVoice = EndpointAPI + "/voice/"
EndpointVoiceRegions = EndpointVoice + "regions"
EndpointVoiceIce = EndpointVoice + "ice"
EndpointTutorial = EndpointAPI + "tutorial/"
EndpointTutorialIndicators = EndpointTutorial + "indicators"
EndpointTrack = EndpointAPI + "track"
EndpointSso = EndpointAPI + "sso"
EndpointReport = EndpointAPI + "report"
EndpointIntegrations = EndpointAPI + "integrations"
EndpointUser = func(uID string) string { return EndpointUsers + uID }
EndpointUserAvatar = func(uID int64, aID string) string { return EndpointCDNAvatars + StrID(uID) + "/" + aID + ".png" }
EndpointUserAvatarAnimated = func(uID int64, aID string) string { return EndpointCDNAvatars + StrID(uID) + "/" + aID + ".gif" }
EndpointUserSettings = func(uID string) string { return EndpointUsers + uID + "/settings" }
EndpointUserGuilds = func(uID string) string { return EndpointUsers + uID + "/guilds" }
EndpointUserGuild = func(uID string, gID int64) string { return EndpointUsers + uID + "/guilds/" + StrID(gID) }
EndpointUserGuildSettings = func(uID string, gID int64) string { return EndpointUsers + uID + "/guilds/" + StrID(gID) + "/settings" }
EndpointUserChannels = func(uID string) string { return EndpointUsers + uID + "/channels" }
EndpointUserDevices = func(uID string) string { return EndpointUsers + uID + "/devices" }
EndpointUserConnections = func(uID string) string { return EndpointUsers + uID + "/connections" }
EndpointUserNotes = func(uID int64) string { return EndpointUsers + "@me/notes/" + StrID(uID) }
EndpointGuild = func(gID int64) string { return EndpointGuilds + StrID(gID) }
EndpointGuildChannels = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/channels" }
EndpointGuildMembers = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/members" }
EndpointGuildMember = func(gID int64, uID int64) string { return EndpointGuilds + StrID(gID) + "/members/" + StrID(uID) }
EndpointGuildMemberAvatar = func(gID int64, uID int64, aID string) string {
return EndpointCDNGuilds + StrID(gID) + "/users/" + StrID(uID) + "/avatars/" + aID + ".png"
}
EndpointGuildMemberAvatarAnimated = func(gID int64, uID int64, aID string) string {
return EndpointCDNGuilds + StrID(gID) + "/users/" + StrID(uID) + "/avatars/" + aID + ".gif"
}
EndpointGuildMemberMe = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/members/@me" }
EndpointGuildMemberRole = func(gID, uID, rID int64) string {
return EndpointGuilds + StrID(gID) + "/members/" + StrID(uID) + "/roles/" + StrID(rID)
}
EndpointGuildBans = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/bans" }
EndpointGuildBan = func(gID, uID int64) string { return EndpointGuilds + StrID(gID) + "/bans/" + StrID(uID) }
EndpointGuildIntegrations = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/integrations" }
EndpointGuildIntegration = func(gID, iID int64) string { return EndpointGuilds + StrID(gID) + "/integrations/" + StrID(iID) }
EndpointGuildIntegrationSync = func(gID, iID int64) string {
return EndpointGuilds + StrID(gID) + "/integrations/" + StrID(iID) + "/sync"
}
EndpointGuildRoles = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/roles" }
EndpointGuildRole = func(gID, rID int64) string { return EndpointGuilds + StrID(gID) + "/roles/" + StrID(rID) }
EndpointGuildInvites = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/invites" }
EndpointGuildEmbed = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/embed" }
EndpointGuildPrune = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/prune" }
EndpointGuildIcon = func(gID int64, hash string) string { return EndpointCDNIcons + StrID(gID) + "/" + hash + ".png" }
EndpointGuildSplash = func(gID int64, hash string) string { return EndpointCDNSplashes + StrID(gID) + "/" + hash + ".png" }
EndpointGuildWebhooks = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/webhooks" }
EndpointGuildAuditLogs = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/audit-logs" }
EndpointGuildEmojis = func(gID int64) string { return EndpointGuilds + StrID(gID) + "/emojis" }
EndpointGuildEmoji = func(gID, eID int64) string { return EndpointGuilds + StrID(gID) + "/emojis/" + StrID(eID) }
EndpointChannel = func(cID int64) string { return EndpointChannels + StrID(cID) }
EndpointChannelPermissions = func(cID int64) string { return EndpointChannels + StrID(cID) + "/permissions" }
EndpointChannelPermission = func(cID, tID int64) string { return EndpointChannels + StrID(cID) + "/permissions/" + StrID(tID) }
EndpointChannelInvites = func(cID int64) string { return EndpointChannels + StrID(cID) + "/invites" }
EndpointChannelTyping = func(cID int64) string { return EndpointChannels + StrID(cID) + "/typing" }
EndpointChannelMessages = func(cID int64) string { return EndpointChannels + StrID(cID) + "/messages" }
EndpointChannelMessage = func(cID, mID int64) string { return EndpointChannels + StrID(cID) + "/messages/" + StrID(mID) }
EndpointChannelMessageAck = func(cID, mID int64) string { return EndpointChannels + StrID(cID) + "/messages/" + StrID(mID) + "/ack" }
EndpointChannelMessagesBulkDelete = func(cID int64) string { return EndpointChannel(cID) + "/messages/bulk-delete" }
EndpointChannelMessagesPins = func(cID int64) string { return EndpointChannel(cID) + "/pins" }
EndpointChannelMessagePin = func(cID, mID int64) string { return EndpointChannel(cID) + "/pins/" + StrID(mID) }
EndpointGroupIcon = func(cID int64, hash string) string { return EndpointCDNChannelIcons + StrID(cID) + "/" + hash + ".png" }
EndpointChannelWebhooks = func(cID int64) string { return EndpointChannel(cID) + "/webhooks" }
EndpointWebhook = func(wID int64) string { return EndpointWebhooks + StrID(wID) }
EndpointWebhookToken = func(wID int64, token string) string { return EndpointWebhooks + StrID(wID) + "/" + token }
EndpointDefaultUserAvatar = func(uDiscriminator string) string {
uDiscriminatorInt, _ := strconv.Atoi(uDiscriminator)
return EndpointCDN + "embed/avatars/" + strconv.Itoa(uDiscriminatorInt%5) + ".png"
}
EndpointMessageReactionsAll = func(cID, mID int64) string {
return EndpointChannelMessage(cID, mID) + "/reactions"
}
EndpointMessageReactions = func(cID, mID int64, emoji EmojiName) string {
return EndpointChannelMessage(cID, mID) + "/reactions/" + emoji.String()
}
EndpointMessageReaction = func(cID, mID int64, emoji EmojiName, uID string) string {
return EndpointMessageReactions(cID, mID, emoji) + "/" + uID
}
EndpointRelationships = func() string { return EndpointUsers + "@me" + "/relationships" }
EndpointRelationship = func(uID int64) string { return EndpointRelationships() + "/" + StrID(uID) }
EndpointRelationshipsMutual = func(uID int64) string { return EndpointUsers + StrID(uID) + "/relationships" }
EndpointGuildCreate = EndpointAPI + "guilds"
EndpointInvite = func(iID string) string { return EndpointAPI + "invites/" + iID }
EndpointIntegrationsJoin = func(iID string) string { return EndpointAPI + "integrations/" + iID + "/join" }
EndpointEmoji = func(eID int64) string { return EndpointAPI + "emojis/" + StrID(eID) + ".png" }
EndpointEmojiAnimated = func(eID int64) string { return EndpointAPI + "emojis/" + StrID(eID) + ".gif" }
EndpointOauth2 = EndpointAPI + "oauth2/"
EndpointApplications = EndpointOauth2 + "applications"
EndpointApplication = func(aID int64) string { return EndpointApplications + "/" + StrID(aID) }
EndpointApplicationMe = EndpointApplications + "/@me"
EndpointApplicationsBot = func(aID int64) string { return EndpointApplications + "/" + StrID(aID) + "/bot" }
EndpointApplicationNonOauth2 = func(aID int64) string { return EndpointAPI + "applications/" + StrID(aID) }
EndpointApplicationCommands = func(aID int64) string { return EndpointApplicationNonOauth2(aID) + "/commands" }
EndpointApplicationCommand = func(aID int64, cmdID int64) string {
return EndpointApplicationNonOauth2(aID) + "/commands/" + StrID(cmdID)
}
EndpointApplicationGuildCommands = func(aID int64, gID int64) string {
return EndpointApplicationNonOauth2(aID) + "/guilds/" + StrID(gID) + "/commands"
}
EndpointApplicationGuildCommand = func(aID int64, gID int64, cmdID int64) string {
return EndpointApplicationGuildCommands(aID, gID) + "/" + StrID(cmdID)
}
EndpointApplicationGuildCommandsPermissions = func(aID int64, gID int64) string {
return EndpointApplicationGuildCommands(aID, gID) + "/permissions"
}
EndpointApplicationGuildCommandPermissions = func(aID int64, gID int64, cmdID int64) string {
return EndpointApplicationGuildCommand(aID, gID, cmdID) + "/permissions"
}
EndpointInteractions = EndpointAPI + "interactions"
EndpointInteractionCallback = func(interactionID int64, token string) string {
return EndpointInteractions + "/" + StrID(interactionID) + "/" + token + "/callback"
}
EndpointWebhookInteraction = func(applicationID int64, token string) string {
return EndpointWebhooks + "/" + StrID(applicationID) + "/" + token
}
EndpointInteractionOriginalMessage = func(applicationID int64, token string) string {
return EndpointWebhookInteraction(applicationID, token) + "/messages/@original"
}
EndpointInteractionFollowupMessage = func(applicationID int64, token string, messageID int64) string {
return EndpointWebhookInteraction(applicationID, token) + "/messages/" + StrID(messageID)
}
}
func init() {
CreateEndpoints("https://discord.com/")
}