rubycord 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/lib/rubycord/allowed_mentions.rb +34 -0
  3. data/lib/rubycord/api/application.rb +200 -0
  4. data/lib/rubycord/api/channel.rb +597 -0
  5. data/lib/rubycord/api/interaction.rb +52 -0
  6. data/lib/rubycord/api/invite.rb +42 -0
  7. data/lib/rubycord/api/server.rb +557 -0
  8. data/lib/rubycord/api/user.rb +153 -0
  9. data/lib/rubycord/api/webhook.rb +138 -0
  10. data/lib/rubycord/api.rb +356 -0
  11. data/lib/rubycord/await.rb +49 -0
  12. data/lib/rubycord/bot.rb +1757 -0
  13. data/lib/rubycord/cache.rb +259 -0
  14. data/lib/rubycord/colour_rgb.rb +41 -0
  15. data/lib/rubycord/commands/command_bot.rb +519 -0
  16. data/lib/rubycord/commands/container.rb +110 -0
  17. data/lib/rubycord/commands/events.rb +9 -0
  18. data/lib/rubycord/commands/parser.rb +325 -0
  19. data/lib/rubycord/commands/rate_limiter.rb +142 -0
  20. data/lib/rubycord/container.rb +753 -0
  21. data/lib/rubycord/data/activity.rb +269 -0
  22. data/lib/rubycord/data/application.rb +48 -0
  23. data/lib/rubycord/data/attachment.rb +109 -0
  24. data/lib/rubycord/data/audit_logs.rb +343 -0
  25. data/lib/rubycord/data/channel.rb +996 -0
  26. data/lib/rubycord/data/component.rb +227 -0
  27. data/lib/rubycord/data/embed.rb +249 -0
  28. data/lib/rubycord/data/emoji.rb +80 -0
  29. data/lib/rubycord/data/integration.rb +120 -0
  30. data/lib/rubycord/data/interaction.rb +798 -0
  31. data/lib/rubycord/data/invite.rb +135 -0
  32. data/lib/rubycord/data/member.rb +370 -0
  33. data/lib/rubycord/data/message.rb +412 -0
  34. data/lib/rubycord/data/overwrite.rb +106 -0
  35. data/lib/rubycord/data/profile.rb +89 -0
  36. data/lib/rubycord/data/reaction.rb +31 -0
  37. data/lib/rubycord/data/recipient.rb +32 -0
  38. data/lib/rubycord/data/role.rb +246 -0
  39. data/lib/rubycord/data/server.rb +1002 -0
  40. data/lib/rubycord/data/user.rb +261 -0
  41. data/lib/rubycord/data/voice_region.rb +43 -0
  42. data/lib/rubycord/data/voice_state.rb +39 -0
  43. data/lib/rubycord/data/webhook.rb +232 -0
  44. data/lib/rubycord/data.rb +40 -0
  45. data/lib/rubycord/errors.rb +737 -0
  46. data/lib/rubycord/events/await.rb +46 -0
  47. data/lib/rubycord/events/bans.rb +58 -0
  48. data/lib/rubycord/events/channels.rb +186 -0
  49. data/lib/rubycord/events/generic.rb +126 -0
  50. data/lib/rubycord/events/guilds.rb +191 -0
  51. data/lib/rubycord/events/interactions.rb +480 -0
  52. data/lib/rubycord/events/invites.rb +123 -0
  53. data/lib/rubycord/events/lifetime.rb +29 -0
  54. data/lib/rubycord/events/members.rb +91 -0
  55. data/lib/rubycord/events/message.rb +337 -0
  56. data/lib/rubycord/events/presence.rb +127 -0
  57. data/lib/rubycord/events/raw.rb +45 -0
  58. data/lib/rubycord/events/reactions.rb +156 -0
  59. data/lib/rubycord/events/roles.rb +86 -0
  60. data/lib/rubycord/events/threads.rb +94 -0
  61. data/lib/rubycord/events/typing.rb +70 -0
  62. data/lib/rubycord/events/voice_server_update.rb +45 -0
  63. data/lib/rubycord/events/voice_state_update.rb +103 -0
  64. data/lib/rubycord/events/webhooks.rb +62 -0
  65. data/lib/rubycord/gateway.rb +867 -0
  66. data/lib/rubycord/id_object.rb +37 -0
  67. data/lib/rubycord/light/data.rb +60 -0
  68. data/lib/rubycord/light/integrations.rb +71 -0
  69. data/lib/rubycord/light/light_bot.rb +56 -0
  70. data/lib/rubycord/light.rb +6 -0
  71. data/lib/rubycord/logger.rb +118 -0
  72. data/lib/rubycord/paginator.rb +55 -0
  73. data/lib/rubycord/permissions.rb +251 -0
  74. data/lib/rubycord/version.rb +5 -0
  75. data/lib/rubycord/voice/encoder.rb +113 -0
  76. data/lib/rubycord/voice/network.rb +366 -0
  77. data/lib/rubycord/voice/sodium.rb +96 -0
  78. data/lib/rubycord/voice/voice_bot.rb +408 -0
  79. data/lib/rubycord/webhooks/builder.rb +100 -0
  80. data/lib/rubycord/webhooks/client.rb +132 -0
  81. data/lib/rubycord/webhooks/embeds.rb +248 -0
  82. data/lib/rubycord/webhooks/modal.rb +78 -0
  83. data/lib/rubycord/webhooks/version.rb +7 -0
  84. data/lib/rubycord/webhooks/view.rb +192 -0
  85. data/lib/rubycord/webhooks.rb +12 -0
  86. data/lib/rubycord/websocket.rb +70 -0
  87. data/lib/rubycord.rb +140 -0
  88. metadata +231 -0
@@ -0,0 +1,737 @@
1
+ module Rubycord
2
+ # Custom errors raised in various places
3
+ module Errors
4
+ # Raised when authentication data is invalid or incorrect.
5
+ class InvalidAuthenticationError < RuntimeError
6
+ # Default message for this exception
7
+ def message
8
+ "User login failed due to an invalid email or password!"
9
+ end
10
+ end
11
+
12
+ # Raised when a message is over the character limit
13
+ class MessageTooLong < RuntimeError; end
14
+
15
+ # Raised when the bot can't do something because its permissions on the server are insufficient
16
+ class NoPermission < RuntimeError; end
17
+
18
+ # Raised when the bot gets a HTTP 502 error, which is usually caused by Cloudflare.
19
+ class CloudflareError < RuntimeError; end
20
+
21
+ # Raised when using a webhook method without an associated token.
22
+ class UnauthorizedWebhook < RuntimeError; end
23
+
24
+ # Generic class for errors denoted by API error codes
25
+ class CodeError < RuntimeError
26
+ class << self
27
+ # @return [Integer] The error code represented by this error class.
28
+ attr_reader :code
29
+ end
30
+
31
+ # Create a new error with a particular message (the code should be defined by the class instance variable)
32
+ # @param message [String] the message to use
33
+ # @param errors [Hash] API errors
34
+ def initialize(message, errors = nil)
35
+ @message = message
36
+
37
+ @errors = errors ? flatten_errors(errors) : []
38
+ end
39
+
40
+ # @return [Integer] The error code represented by this error.
41
+ def code
42
+ self.class.code
43
+ end
44
+
45
+ # @return [String] A message including the message and flattened errors.
46
+ def full_message(*)
47
+ error_list = @errors.collect { |err| "\t- #{err}" }
48
+
49
+ "#{@message}\n#{error_list.join("\n")}"
50
+ end
51
+
52
+ # @return [String] This error's represented message
53
+ attr_reader :message
54
+
55
+ # @return [Hash] More precise errors
56
+ attr_reader :errors
57
+
58
+ private
59
+
60
+ # @!visibility hidden
61
+ # Flattens errors into a more easily read format.
62
+ # @example Flattening errors of a bad field
63
+ # flatten_errors(data['errors'])
64
+ # # => ["embed.fields[0].name: This field is required", "embed.fields[0].value: This field is required"]
65
+ def flatten_errors(err, prev_key = nil)
66
+ err.collect do |key, sub_err|
67
+ if prev_key
68
+ key = /\A\d+\Z/.match?(key) ? "#{prev_key}[#{key}]" : "#{prev_key}.#{key}"
69
+ end
70
+
71
+ if (errs = sub_err["_errors"])
72
+ "#{key}: #{errs.map { |e| e["message"] }.join(" ")}"
73
+ elsif sub_err["message"] || sub_err["code"]
74
+ "#{sub_err["code"] ? "#{sub_err["code"]}: " : nil}#{err_msg}"
75
+ elsif sub_err.is_a? String
76
+ sub_err
77
+ else
78
+ flatten_errors(sub_err, key)
79
+ end
80
+ end.flatten
81
+ end
82
+ end
83
+
84
+ # Create a new code error class
85
+ def self.Code(code)
86
+ classy = Class.new(CodeError)
87
+ classy.instance_variable_set(:@code, code)
88
+
89
+ @code_classes ||= {}
90
+ @code_classes[code] = classy
91
+
92
+ classy
93
+ end
94
+
95
+ # @param code [Integer] The code to check
96
+ # @return [Class] the error class for the given code
97
+ def self.error_class_for(code)
98
+ @code_classes[code] || UnknownError
99
+ end
100
+
101
+ # List of error codes available here:
102
+ # https://discord.com/developers/docs/topics/opcodes-and-status-codes#json-json-error-codes
103
+
104
+ # Used when Discord doesn't provide a more specific code
105
+ UnknownError = Code(0)
106
+
107
+ # Unknown Account
108
+ UnknownAccount = Code(10_001)
109
+
110
+ # Unknown Application
111
+ UnknownApplication = Code(10_002)
112
+
113
+ # Unknown Channel
114
+ UnknownChannel = Code(10_003)
115
+
116
+ # Unknown Server
117
+ UnknownServer = Code(10_004)
118
+
119
+ # Unknown Integration
120
+ UnknownIntegration = Code(10_005)
121
+
122
+ # Unknown Invite
123
+ UnknownInvite = Code(10_006)
124
+
125
+ # Unknown Member
126
+ UnknownMember = Code(10_007)
127
+
128
+ # Unknown Message
129
+ UnknownMessage = Code(10_008)
130
+
131
+ # Unknown Permission Overwrite
132
+ UnknownPermissionOverwrite = Code(10_009)
133
+
134
+ # Unknown Provider
135
+ UnknownProvider = Code(10_010)
136
+
137
+ # Unknown Role
138
+ UnknownRole = Code(10_011)
139
+
140
+ # Unknown Token
141
+ UnknownToken = Code(10_012)
142
+
143
+ # Unknown User
144
+ UnknownUser = Code(10_013)
145
+
146
+ # Unknown Emoji
147
+ UnknownEmoji = Code(10_014)
148
+
149
+ # Unknown Webhook
150
+ UnknownWebhook = Code(10_015)
151
+
152
+ # Unknown Webhook Service
153
+ UnknownWebhookService = Code(10_016)
154
+
155
+ # Unknown Session
156
+ UnknownSession = Code(10_020)
157
+
158
+ # Unknown Ban
159
+ UnknownBan = Code(10_026)
160
+
161
+ # Unknown SKU
162
+ UnknownSKU = Code(10_027)
163
+
164
+ # Unknown Store Listing
165
+ UnknownStoreListing = Code(10_028)
166
+
167
+ # Unknown Entitlement
168
+ UnknownEntitlement = Code(10_029)
169
+
170
+ # Unknown Build
171
+ UnknownBuild = Code(10_030)
172
+
173
+ # Unknown Lobby
174
+ UnknownLobby = Code(10_031)
175
+
176
+ # Unknown Branch
177
+ UnknownBranch = Code(10_032)
178
+
179
+ # Unknown Store directory layout
180
+ UnknownStoreDirectoryLayout = Code(10_033)
181
+
182
+ # Unknown Redistribuable
183
+ UnknownRedistribuable = Code(10_036)
184
+
185
+ # Unknown Gift code
186
+ UnknownGiftCode = Code(10_038)
187
+
188
+ # Unknown Stream
189
+ UnknownStream = Code(10_049)
190
+
191
+ # Unknown Premium server subscribe cooldown
192
+ UnknownPremiumServerSubscribeCooldown = Code(10_050)
193
+
194
+ # Unknown Server Template
195
+ UnknownServerTemplate = Code(10_057)
196
+
197
+ # Unknown Discoverable server category
198
+ UnknownDiscoverableServerCategory = Code(10_059)
199
+
200
+ # Unknown Sticker
201
+ UnknownSticker = Code(10_060)
202
+
203
+ # Unknown Interaction
204
+ UnknownInteraction = Code(10_062)
205
+
206
+ # Unknown Application command
207
+ UnknownApplicationCommand = Code(10_063)
208
+
209
+ # Unknown Voice state
210
+ UnknownVoiceState = Code(10_065)
211
+
212
+ # Unknown Application command permissions
213
+ UnknownApplicationCommandPermissions = Code(10_066)
214
+
215
+ # Unknown Stage Instance
216
+ UnknownStageInstance = Code(10_067)
217
+
218
+ # Unknown Server member verification form
219
+ UnknownServerMemberVerificationForm = Code(10_068)
220
+
221
+ # Unknown Server welcome screen
222
+ UnknownServerWelcomeScreen = Code(10_069)
223
+
224
+ # Unknown Server scheduled event
225
+ UnknownServerScheduledEvent = Code(10_070)
226
+
227
+ # Unknown Server scheduled event user
228
+ UnknownServerScheduledEventUser = Code(10_071)
229
+
230
+ # Unknown Tag
231
+ UnknownTag = Code(10_087)
232
+
233
+ # Bots cannot use this endpoint
234
+ EndpointNotForBots = Code(20_001)
235
+
236
+ # Only bots can use this endpoint
237
+ EndpointOnlyForBots = Code(20_002)
238
+
239
+ # Explicit content cannot be sent to the desired recipient(s)
240
+ ExplicitContentCannotBeSent = Code(20_009)
241
+
242
+ # You are not authorized to perform this action on this application
243
+ ActionNotAuthorizedOnApplication = Code(20_012)
244
+
245
+ # This action cannot be performed due to slowmode rate limit
246
+ ActionNotPerformedDueToSlowmode = Code(20_016)
247
+
248
+ # Only the owner of this account can perform this action
249
+ OnlyOwnerCanPerformAction = Code(20_018)
250
+
251
+ # This message cannot be edited due to announcement rate limits
252
+ EditMessageAnnouncementRateLimited = Code(20_022)
253
+
254
+ # Under minimum age
255
+ UnderMinimumAge = Code(20_024)
256
+
257
+ # The channel you are writing has hit the write rate limit
258
+ ChannelHitWriteRateLimit = Code(20_028)
259
+
260
+ # The write action you are performing on the server has hit the write rate limit
261
+ ServerHitWriteRateLimit = Code(20_029)
262
+
263
+ # Your Stage topic, server name, server description, or channel names contain words that are not allowed
264
+ ContainWordsNotAllowed = Code(20_031)
265
+
266
+ # Guild premium subscription level too low
267
+ GuildPremiumSubscriptionLevelTooLow = Code(20_035)
268
+
269
+ # Maximum number of servers reached (100)
270
+ ServerLimitReached = Code(30_001)
271
+
272
+ # Maximum number of friends reached (1000)
273
+ FriendLimitReached = Code(30_002)
274
+
275
+ # Maximum number of pins reached (50)
276
+ PinLimitReached = Code(30_003)
277
+
278
+ # Maximum number of recipients reached (10)
279
+ RecipientLimitReached = Code(30_004)
280
+
281
+ # Maximum number of guild roles reached (250)
282
+ RoleLimitReached = Code(30_005)
283
+
284
+ # Maximum number of webhooks reached (15)
285
+ WebhookLimitReached = Code(30_007)
286
+
287
+ # Maximum number of emojis reached
288
+ EmojiLimitReached = Code(30_008)
289
+
290
+ # Maximum number of reactions reached (20)
291
+ ReactionLimitReached = Code(30_010)
292
+
293
+ # Maximum number of group DMs reached (10)
294
+ GroupChannelLimitReached = Code(30_011)
295
+
296
+ # Maximum number of guild channels reached (500)
297
+ ChannelLimitReached = Code(30_013)
298
+
299
+ # Maximum number of attachments in a message reached (10)
300
+ MessageAttachmentLimitReached = Code(30_015)
301
+
302
+ # Maximum number of invites reached (1000)
303
+ InviteLimitReached = Code(30_016)
304
+
305
+ # Maximum number of animated emojis reached
306
+ AnimatedEmojiLimitReached = Code(30_018)
307
+
308
+ # Maximum number of server members reached
309
+ ServerMemberLimitReached = Code(30_019)
310
+
311
+ # Maximum number of server categories has been reached (5)
312
+ ServerCategoryLimitReached = Code(30_030)
313
+
314
+ # Guild already has a template
315
+ ServerAlreadyHasTemplate = Code(30_031)
316
+
317
+ # Maximum number of application commands reached
318
+ ApplicationCommandLimitReached = Code(30_032)
319
+
320
+ # Maximum number of thread participants has been reached (1000)
321
+ ThreadParticipantLimitReached = Code(30_033)
322
+
323
+ # Maximum number of daily application command creates has been reached (200)
324
+ ApplicationCommandCreateLimitReached = Code(30_034)
325
+
326
+ # Maximum number of bans for non-guild members have been exceeded
327
+ BanNonServerMemberLimitReached = Code(30_035)
328
+
329
+ # Maximum number of bans fetches has been reached
330
+ BanFetchLimitReached = Code(30_037)
331
+
332
+ # Maximum number of uncompleted guild scheduled events reached (100)
333
+ UncompletedServerScheduledEventLimitReached = Code(30_038)
334
+
335
+ # Maximum number of stickers reached
336
+ StickerLimitReached = Code(30_039)
337
+
338
+ # Maximum number of prune requests has been reached. Try again later
339
+ PruneRequestLimitReached = Code(30_040)
340
+
341
+ # Maximum number of guild widget settings updates has been reached. Try again later
342
+ ServerWidgetUpdateLimitReached = Code(30_042)
343
+
344
+ # Maximum number of edits to messages older than 1 hour reached. Try again later
345
+ MessageEditOlderOneHourLimitReached = Code(30_046)
346
+
347
+ # Maximum number of pinned threads in a forum channel has been reached
348
+ ForumPinnedThreadLimitReached = Code(30_047)
349
+
350
+ # Maximum number of tags in a forum channel has been reached
351
+ ForumTagLimitReached = Code(30_048)
352
+
353
+ # Bitrate is too high for channel of this type
354
+ BitrateTooHigh = Code(30_052)
355
+
356
+ # Maximum number of premium emojis reached (25)
357
+ PremiumEmojiLimitReached = Code(30_056)
358
+
359
+ # Maximum number of webhooks per guild reached (1000)
360
+ ServerWebhookLimitReached = Code(30_058)
361
+
362
+ # Maximum number of channel permission overwrites reached (1000)
363
+ ChannelPermissionOverwriteLimitReached = Code(30_060)
364
+
365
+ # The channels for this guild are too large
366
+ ServerChannelTooLarge = Code(30_061)
367
+
368
+ # Unauthorized. Provide a valid token and try again
369
+ Unauthorized = Unauthorised = Code(40_001)
370
+
371
+ # You need to verify your account in order to perform this action
372
+ NeedVerifiedAccount = Code(40_002)
373
+
374
+ # You are opening direct messages too fast
375
+ DirectMessageOpenTooFast = Code(40_003)
376
+
377
+ # Send messages has been temporarily disabled
378
+ SendMessageTemporarilyDisabled = Code(40_004)
379
+
380
+ # Request entity too large. Try sending something smaller in size
381
+ RequestEntityTooLarge = Code(40_005)
382
+
383
+ # This feature has been temporarily disabled server-side
384
+ ServerFeatureTemporarilyDisabled = Code(40_006)
385
+
386
+ # The user is banned from this guild
387
+ UserBannedFromServer = Code(40_007)
388
+
389
+ # Connection has been revoked
390
+ ConnectionRevoked = Code(40_012)
391
+
392
+ # Target user is not connected to voice
393
+ UserNotVoiceConnected = Code(40_032)
394
+
395
+ # This message has already been crossposted
396
+ MessageAlreadyCrossposted = Code(40_033)
397
+
398
+ # An application command with that name already exists
399
+ ApplicationCommandAlreadyExists = Code(40_041)
400
+
401
+ # Application interaction failed to send
402
+ ApplicationInteractionSendFailed = Code(40_043)
403
+
404
+ # Cannot send a message in a forum channel
405
+ ForumMessageCannotSend = Code(40_058)
406
+
407
+ # Interaction has already been acknowledged
408
+ InteractionAlreadyAcknowledged = Code(40_060)
409
+
410
+ # Tag names must be unique
411
+ TagNameMustBeUnique = Code(40_061)
412
+
413
+ # Service resource is being rate limited
414
+ ServiceResourceRateLimited = Code(40_062)
415
+
416
+ # There are no tags available that can be set by non-moderators
417
+ NoTagAvailableForNonModerator = Code(40_066)
418
+
419
+ # A tag is required to create a forum post in this channel
420
+ ForumPostCreateTagRequired = Code(40_067)
421
+
422
+ # An entitlement has already been granted for this resource
423
+ ResourceEntitlementAlreadyGranted = Code(40_074)
424
+
425
+ # Cloudflare is blocking your request. This can often be resolved by setting a proper User Agent
426
+ RequestBlockedByCloudflare = Code(40_333)
427
+
428
+ # Missing Access
429
+ MissingAccess = Code(50_001)
430
+
431
+ # Invalid Account Type
432
+ InvalidAccountType = Code(50_002)
433
+
434
+ # Cannot execute action on a DM channel
435
+ InvalidActionForDM = Code(50_003)
436
+
437
+ # Server widget disabled
438
+ ServerWidgetDisabled = Code(50_004)
439
+
440
+ # Cannot edit a message authored by another user
441
+ MessageAuthoredByOtherUser = Code(50_005)
442
+
443
+ # Cannot send an empty message
444
+ MessageEmpty = Code(50_006)
445
+
446
+ # Cannot send messages to this user
447
+ NoMessagesToUser = Code(50_007)
448
+
449
+ # Cannot send messages in a voice channel
450
+ NoMessagesInVoiceChannel = Code(50_008)
451
+
452
+ # Channel verification level is too high
453
+ VerificationLevelTooHigh = Code(50_009)
454
+
455
+ # OAuth2 application does not have a bot
456
+ NoBotForApplication = Code(50_010)
457
+
458
+ # OAuth2 application limit reached
459
+ ApplicationLimitReached = Code(50_011)
460
+
461
+ # Invalid OAuth State
462
+ InvalidOAuthState = Code(50_012)
463
+
464
+ # You lack permissions to perform that action
465
+ LackPermissions = Code(50_013)
466
+
467
+ # Invalid authentication token
468
+ InvalidAuthToken = Code(50_014)
469
+
470
+ # Note is too long
471
+ NoteTooLong = Code(50_015)
472
+
473
+ # Provided too few or too many messages to delete. Must provide at least 2 and fewer than 100 messages to delete
474
+ InvalidBulkDeleteCount = Code(50_016)
475
+
476
+ # Invalid MFA Level
477
+ InvalidMFALevel = Code(50_017)
478
+
479
+ # A message can only be pinned to the channel it was sent in
480
+ CannotPinInDifferentChannel = Code(50_019)
481
+
482
+ # Invite code was either invalid or taken
483
+ InvalidInviteCode = Code(50_020)
484
+
485
+ # Cannot execute action on a system message
486
+ InvalidActionForSystemMessage = Code(50_021)
487
+
488
+ # Cannot execute action on this channel type
489
+ CannotExecuteOnChannelType = Code(50_024)
490
+
491
+ # Invalid OAuth2 access token provided
492
+ InvalidOAuthAccessToken = Code(50_025)
493
+
494
+ # Missing required OAuth2 scope
495
+ MissingOAuthScope = Code(50_026)
496
+
497
+ # Invalid webhook token provided
498
+ InvalidWebhookToken = Code(50_027)
499
+
500
+ # Invalid role
501
+ InvalidRole = Code(50_028)
502
+
503
+ # Invalid Recipient(s)
504
+ InvalidRecipient = Code(50_033)
505
+
506
+ # A message provided was too old to bulk delete
507
+ MessageTooOld = Code(50_034)
508
+
509
+ # Invalid form body (returned for both application/json and multipart/form-data bodies), or invalid Content-Type provided
510
+ InvalidFormBody = Code(50_035)
511
+
512
+ # An invite was accepted to a guild the application's bot is not in
513
+ MissingBotMember = Code(50_036)
514
+
515
+ # Invalid Activity Action
516
+ InvalidActivityAction = Code(50_039)
517
+
518
+ # Invalid API version provided
519
+ InvalidAPIVersion = Code(50_041)
520
+
521
+ # File uploaded exceeds the maximum size
522
+ FileSizeUploadLimitReached = Code(50_045)
523
+
524
+ # Invalid file uploaded
525
+ InvalidFileUpload = Code(50_046)
526
+
527
+ # Cannot self-redeem this gift
528
+ CannotSelfRedeemGift = Code(50_054)
529
+
530
+ # Invalid Server
531
+ InvalidServer = Code(50_055)
532
+
533
+ # Invalid SKU
534
+ InvalidSKU = Code(50_057)
535
+
536
+ # Invalid Request origin
537
+ InvalidRequestOrigin = Code(50_067)
538
+
539
+ # Invalid Message type
540
+ InvalidMessageType = Code(50_068)
541
+
542
+ # Payment source required to redeem gift
543
+ PaymentSourceRequired = Code(50_070)
544
+
545
+ # Cannot modify a system webhook
546
+ CannotModifySystemWebhook = Code(50_073)
547
+
548
+ # Cannot delete a channel required for Community guilds
549
+ CannotDeleteCommunityServerChannelRequired = Code(50_074)
550
+
551
+ # Cannot edit stickers within a message
552
+ CannotEditMessageSticker = Code(50_080)
553
+
554
+ # Invalid sticker sent
555
+ InvalidStickerSent = Code(50_081)
556
+
557
+ # Tried to perform an operation on an archived thread, such as editing a message or adding a user to the thread
558
+ OperationOnArchivedThread = Code(50_083)
559
+
560
+ # Invalid thread notification settings
561
+ InvalidThreadNotificationSettings = Code(50_084)
562
+
563
+ # before value is earlier than the thread creation date
564
+ BeforeValueEarlierThanThread = Code(50_085)
565
+
566
+ # Community server channels must be text channels
567
+ CommunityServerChannelMustBeTextChannel = Code(50_086)
568
+
569
+ # The entity type of the event is different from the entity you are trying to start the event for
570
+ EntityTypeEventMismatch = Code(50_091)
571
+
572
+ # This server is not available in your location
573
+ ServerNotAvailableInYourLocation = Code(50_095)
574
+
575
+ # This server needs monetization enabled in order to perform this action
576
+ ServerNeedsMonetizationEnabled = Code(50_097)
577
+
578
+ # This server needs more boosts to perform this action
579
+ ServerNeedsMoreBoosts = Code(50_101)
580
+
581
+ # The request body contains invalid JSON
582
+ RequestBodyInvalidJSON = Code(50_109)
583
+
584
+ # Owner cannot be pending member
585
+ OwnerCannotBePendingMember = Code(50_131)
586
+
587
+ # Ownership cannot be transferred to a bot user
588
+ OwnershipCannotTransferedToBot = Code(50_132)
589
+
590
+ # Failed to resize asset below the maximum size: 262144
591
+ FailedResizeBelowAssetLimit = Code(50_138)
592
+
593
+ # Cannot mix subscription and non subscription roles for an emoji
594
+ EmojiCannotMixSubscriptionTypeRole = Code(50_144)
595
+
596
+ # Cannot convert between premium emoji and normal emoji
597
+ CannotConvertBetweenPremiumAndNormalEmoji = Code(50_145)
598
+
599
+ # Uploaded file not found
600
+ UploadedFileNotFound = Code(50_146)
601
+
602
+ # Voice messages do not support additional content
603
+ VoiceMessageAdditionalContentNotSupported = Code(50_159)
604
+
605
+ # Voice messages must have a single audio attachment
606
+ VoiceMessageMustHaveSingleAudio = Code(50_160)
607
+
608
+ # Voice messages must have supporting metadata
609
+ VoiceMessageMustSupportMetadata = Code(50_161)
610
+
611
+ # Voice messages cannot be edited
612
+ VoiceMessageCannotBeEdited = Code(50_162)
613
+
614
+ # Cannot delete guild subscription integration
615
+ ServerSubscriptionIntegrationCannotBeDeleted = Code(50_163)
616
+
617
+ # You cannot send voice messages in this channel
618
+ CannotSendVoiceMessage = Code(50_173)
619
+
620
+ # The user account must first be verified
621
+ UserAccountMustBeVerified = Code(50_178)
622
+
623
+ # You do not have permission to send this sticker
624
+ NeedPermissionToSendSticker = Code(50_600)
625
+
626
+ # Two factor is required for this operation
627
+ TwoFactorRequired = Code(60_003)
628
+
629
+ # No users with DiscordTag exist
630
+ UserDiscordTagNotExist = Code(80_004)
631
+
632
+ # Reaction Blocked
633
+ ReactionBlocked = Code(90_001)
634
+
635
+ # User cannot use burst reactions
636
+ UserCannotBurstReactions = Code(90_002)
637
+
638
+ # Application not yet available. Try again later
639
+ ApplicationNotYetAvailable = Code(110_001)
640
+
641
+ # API resource is currently overloaded. Try again a little later
642
+ APIResourceOverloaded = Code(130_000)
643
+
644
+ # The Stage is already open
645
+ StageAlreadyOpen = Code(150_006)
646
+
647
+ # Cannot reply without permission to read message history
648
+ CannotReplyWithoutReadMessageHistory = Code(160_002)
649
+
650
+ # A thread has already been created for this message
651
+ MessageThreadAlreadyCreated = Code(160_004)
652
+
653
+ # Thread is locked
654
+ ThreadLocked = Code(160_005)
655
+
656
+ # Maximum number of active threads reached
657
+ ActiveThreadLimitReached = Code(160_006)
658
+
659
+ # Maximum number of active announcement threads reached
660
+ ActiveAnnouncementThreadLimitReached = Code(160_007)
661
+
662
+ # Invalid JSON for uploaded Lottie file
663
+ LottieInvalidJSON = Code(170_001)
664
+
665
+ # Uploaded Lotties cannot contain rasterized images such as PNG or JPEG
666
+ LottieCannotContainRasterizedImages = Code(170_002)
667
+
668
+ # Sticker maximum framerate exceeded
669
+ StickerFramerateLimitReached = Code(170_003)
670
+
671
+ # Sticker frame count exceeds maximum of 1000 frames
672
+ StickerFrameLimitReached = Code(170_004)
673
+
674
+ # Lottie animation maximum dimensions exceeded
675
+ LottieDimensionLimitReached = Code(170_005)
676
+
677
+ # Sticker frame rate is either too small or too large
678
+ StickerFramerateInvalid = Code(170_006)
679
+
680
+ # Sticker animation duration exceeds maximum of 5 seconds
681
+ StickerDurationLimitReached = Code(170_007)
682
+
683
+ # Cannot update a finished event
684
+ CannotUpdateFinishedEvent = Code(180_000)
685
+
686
+ # Failed to create stage needed for stage event
687
+ StageCreateFailed = Code(180_002)
688
+
689
+ # Message was blocked by automatic moderation
690
+ MessageBlockedByAutoMod = Code(200_000)
691
+
692
+ # Title was blocked by automatic moderation
693
+ TitleBlockedByAutoMod = Code(200_001)
694
+
695
+ # Webhooks posted to forum channels must have a thread_name or thread_id
696
+ ForumWebhookPostMissingArgument = Code(220_001)
697
+
698
+ # Webhooks posted to forum channels cannot have both a thread_name and thread_id
699
+ ForumWebhookPostTooMuchArgument = Code(220_002)
700
+
701
+ # Webhooks can only create threads in forum channels
702
+ OnlyForumWebhookCanCreateThread = Code(220_003)
703
+
704
+ # Webhook services cannot be used in forum channels
705
+ ForumWebhookCannotUseService = Code(220_004)
706
+
707
+ # Message blocked by harmful links filter
708
+ MessageBlockedByHarmfulLinkFilter = Code(240_000)
709
+
710
+ # Cannot enable onboarding, requirements are not met
711
+ CannotEnableOnboarding = Code(350_000)
712
+
713
+ # Cannot update onboarding while below requirements
714
+ CannotUpdateOnboarding = Code(350_001)
715
+
716
+ # Failed to ban users
717
+ BanUserFailed = Code(500_000)
718
+
719
+ # Poll voting blocked
720
+ PollVotingBlocked = Code(520_000)
721
+
722
+ # Poll expired
723
+ PollExpired = Code(520_001)
724
+
725
+ # Invalid channel type for poll creation
726
+ PollInvalidTypeChannel = Code(520_002)
727
+
728
+ # Cannot edit a poll message
729
+ PollMessageCannotBeEdited = Code(520_003)
730
+
731
+ # Cannot use an emoji included with the poll
732
+ PollCannotUseEmojiIncluded = Code(520_004)
733
+
734
+ # Cannot expire a non-poll message
735
+ CannotExpireNonPollMessage = Code(520_006)
736
+ end
737
+ end