This repository has been archived by the owner on May 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiscordiaTypes.lua
2970 lines (2847 loc) · 157 KB
/
discordiaTypes.lua
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
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- Do not touch, automatically generated!
-- Generated on Wed Feb 9 20:06:00 2022
---Used to measure an elapsed period of time. If a truthy value is passed as an argument, then the stopwatch will initialize in an idle state; otherwise, it will initialize in an active state. Although nanosecond precision is available, Lua can only reliably provide microsecond accuracy due to the lack of native 64-bit integer support. Generally, milliseconds should be sufficient here.
---@class Stopwatch
---@field public milliseconds number The total number of elapsed milliseconds. If the stopwatch is running, this will naturally be different each time that it is accessed.
---@overload fun():Stopwatch
---@type fun():Stopwatch
local Stopwatch = {}
---Defines the behavior of the `tostring` function. Returns a string that represents the elapsed milliseconds for convenience of introspection.
---@return string
function Stopwatch:__tostring() end
---Effectively stops the stopwatch.
---@return nil
function Stopwatch:stop() end
---Effectively starts the stopwatch.
---@return nil
function Stopwatch:start() end
---Effectively resets the stopwatch.
---@return nil
function Stopwatch:reset() end
---Returns a new Time object that represents the currently elapsed time. This is useful for "catching" the current time and comparing its many forms as required.
---@return Time
function Stopwatch:getTime() end
---Create a new Stopwatch
---@return Stopwatch
function Stopwatch:__init() end
---Represents a voice channel in a Discord guild, where guild members can connect and communicate via voice chat.
---@class GuildVoiceChannel: GuildChannel
---@field public bitrate number The channel's bitrate in bits per second (bps). This should be between 8000 and 96000 (or 128000 for partnered servers).
---@field public userLimit number The amount of users allowed to be in this channel. Users with `moveMembers` permission ignore this limit.
---@field public connectedMembers TableIterable An iterable of all users connected to the channel.
---@field public connection VoiceConnection | nil The VoiceConnection for this channel if one exists.
---@overload fun():GuildVoiceChannel
---@type fun():GuildVoiceChannel
local GuildVoiceChannel = {}
---Sets the channel's audio bitrate in bits per second (bps). This must be between 8000 and 96000 (or 128000 for partnered servers). If `nil` is passed, the default is set, which is 64000.
---@param bitrate number
---@return boolean
---@async
function GuildVoiceChannel:setBitrate(bitrate) end
---Sets the channel's user limit. This must be between 0 and 99 (where 0 is unlimited). If `nil` is passed, the default is set, which is 0.
---@param user_limit number
---@return boolean
---@async
function GuildVoiceChannel:setUserLimit(user_limit) end
---Join this channel and form a connection to the Voice Gateway.
---@return VoiceConnection
function GuildVoiceChannel:join() end
---Leave this channel if there is an existing voice connection to it. Equivalent to GuildVoiceChannel.connection:close()
---@return boolean
---@async
function GuildVoiceChannel:leave() end
---Create a new GuildVoiceChannel
---@return GuildVoiceChannel
function GuildVoiceChannel:__init() end
---Represents a single moment in time and provides utilities for converting to and from different date and time formats. Although microsecond precision is available, most formats are implemented with only second precision.
---@class Date
---@overload fun(seconds?: number, microseconds?: number):Date
---@type fun(seconds?: number, microseconds?: number):Date
local Date = {}
---Returns a string from this Date object via Lua's `os.date`. If no format string is provided, the default is '%a %b %d %Y %T GMT%z (%Z)'.
---@param fmt? string
---@return string
function Date:toString(fmt) end
---Returns an ISO 8601 string that represents the stored date and time. If `sep` and `tz` are both provided, then they are used as a custom separator and timezone; otherwise, `T` is used for the separator and `+00:00` is used for the timezone, plus microseconds if available.
---@param sep? string
---@param tz? string
---@return string
function Date:toISO(sep, tz) end
---Returns an RFC 2822 string that represents the stored date and time.
---@return string
function Date:toHeader() end
---Returns a synthetic Discord Snowflake ID based on the stored date and time. Due to the lack of native 64-bit support, the result may lack precision. In other words, `Date.fromSnowflake(id):toSnowflake() == id` may be `false`.
---@return string
function Date:toSnowflake() end
---Returns a Lua date table that represents the stored date and time as a local time. Equivalent to `os.date('*t', s)` where `s` is the Unix time in seconds.
---@return table
function Date:toTable() end
---Returns a Lua date table that represents the stored date and time as a UTC time. Equivalent to `os.date('!*t', s)` where `s` is the Unix time in seconds.
---@return table
function Date:toTableUTC() end
---Returns a Unix time in seconds that represents the stored date and time.
---@return number
function Date:toSeconds() end
---Returns a Unix time in milliseconds that represents the stored date and time.
---@return number
function Date:toMilliseconds() end
---Returns a Unix time in microseconds that represents the stored date and time.
---@return number
function Date:toMicroseconds() end
---Returns the seconds and microseconds that are stored in the date object.
---@return number number
function Date:toParts() end
---Converts an ISO 8601 string into a Unix time in seconds. For compatibility with Discord's timestamp format, microseconds are also provided as a second return value.
---@param str string
---@return number number
function Date.parseISO(str) end
---Converts an RFC 2822 string (an HTTP Date header) into a Unix time in seconds.
---@param str string
---@return number
function Date.parseHeader(str) end
---Converts a Discord Snowflake ID into a Unix time in seconds. Additional decimal points may be present, though only the first 3 (milliseconds) should be considered accurate.
---@param id string
---@return number
function Date.parseSnowflake(id) end
---Interprets a Lua date table as a local time and converts it to a Unix time in seconds. Equivalent to `os.time(tbl)`.
---@param tbl table
---@return number
function Date.parseTable(tbl) end
---Interprets a Lua date table as a UTC time and converts it to a Unix time in seconds. Equivalent to `os.time(tbl)` with a correction for UTC.
---@param tbl table
---@return number
function Date.parseTableUTC(tbl) end
---Constructs a new Date object from an ISO 8601 string. Equivalent to `Date(Date.parseISO(str))`.
---@param str string
---@return Date
function Date.fromISO(str) end
---Constructs a new Date object from an RFC 2822 string. Equivalent to `Date(Date.parseHeader(str))`.
---@param str string
---@return Date
function Date.fromHeader(str) end
---Constructs a new Date object from a Discord/Twitter Snowflake ID. Equivalent to `Date(Date.parseSnowflake(id))`.
---@param id string
---@return Date
function Date.fromSnowflake(id) end
---Constructs a new Date object from a Lua date table interpreted as a local time. Equivalent to `Date(Date.parseTable(tbl))`.
---@param tbl table
---@return Date
function Date.fromTable(tbl) end
---Constructs a new Date object from a Lua date table interpreted as a UTC time. Equivalent to `Date(Date.parseTableUTC(tbl))`.
---@param tbl table
---@return Date
function Date.fromTableUTC(tbl) end
---Constructs a new Date object from a Unix time in seconds.
---@param s number
---@return Date
function Date.fromSeconds(s) end
---Constructs a new Date object from a Unix time in milliseconds.
---@param ms number
---@return Date
function Date.fromMilliseconds(ms) end
---Constructs a new Date object from a Unix time in microseconds.
---@param us number
---@return Date
function Date.fromMicroseconds(us) end
---Create a new Date
---@param seconds? number
---@param microseconds? number
---@return Date
function Date:__init(seconds, microseconds) end
---The main point of entry into a Discordia application. All data relevant to Discord is accessible through a client instance or its child objects after a connection to Discord is established with the `run` method. In other words, client data should not be expected and most client methods should not be called until after the `ready` event is received. Base emitter methods may be called at any time. See [[client options]].
---@class Client: Emitter
---@field public shardCount number | nil The number of shards that this client is managing.
---@field public totalShardCount number | nil The total number of shards that the current user is on.
---@field public user User | nil User object representing the current user.
---@field public owner User | nil User object representing the current user's owner.
---@field public verified boolean | nil Whether the current user's owner's account is verified.
---@field public mfaEnabled boolean | nil Whether the current user's owner's account has multi-factor (or two-factor) authentication enabled. This is equivalent to `verified`
---@field public email string | nil The current user's owner's account's email address (user-accounts only).
---@field public guilds Cache An iterable cache of all guilds that are visible to the client. Note that the guilds present here correspond to which shards the client is managing. If all shards are managed by one client, then all guilds will be present.
---@field public users Cache An iterable cache of all users that are visible to the client. To access a user that may exist but is not cached, use `Client:getUser`.
---@field public privateChannels Cache An iterable cache of all private channels that are visible to the client. The channel must exist and must be open for it to be cached here. To access a private channel that may exist but is not cached, `User:getPrivateChannel`.
---@field public groupChannels Cache An iterable cache of all group channels that are visible to the client. Only user-accounts should have these.
---@field public relationships Cache An iterable cache of all relationships that are visible to the client. Only user-accounts should have these.
---@field on fun(self: Client, name: string, fn: async fun()): function
---@field on fun(self: Client, name: '"ready"', fn: async fun()): function
---@field on fun(self: Client, name: '"shardReady"', fn: async fun(shardId: number)): function
---@field on fun(self: Client, name: '"shardResumed"', fn: async fun(shardId: number)): function
---@field on fun(self: Client, name: '"channelCreate"', fn: async fun(channel: Channel)): function
---@field on fun(self: Client, name: '"channelUpdate"', fn: async fun(channel: Channel)): function
---@field on fun(self: Client, name: '"channelDelete"', fn: async fun(channel: Channel)): function
---@field on fun(self: Client, name: '"recipientAdd"', fn: async fun(channel: Channel, user: User)): function
---@field on fun(self: Client, name: '"recipientRemove"', fn: async fun(channel: Channel, user: User)): function
---@field on fun(self: Client, name: '"guildAvailable"', fn: async fun(guild: Guild)): function
---@field on fun(self: Client, name: '"guildCreate"', fn: async fun(guild: Guild)): function
---@field on fun(self: Client, name: '"guildUnavailable"', fn: async fun(guild: Guild)): function
---@field on fun(self: Client, name: '"guildDelete"', fn: async fun(guild: Guild)): function
---@field on fun(self: Client, name: '"userBan"', fn: async fun(user: User, guild: Guild)): function
---@field on fun(self: Client, name: '"userUnban"', fn: async fun(user: User, guild: Guild)): function
---@field on fun(self: Client, name: '"emojisUpdate"', fn: async fun(guild: Guild)): function
---@field on fun(self: Client, name: '"memberJoin"', fn: async fun(member: Member, guild: Guild)): function
---@field on fun(self: Client, name: '"memberLeave"', fn: async fun(member: Member, guild: Guild)): function
---@field on fun(self: Client, name: '"memberUpdate"', fn: async fun(member: Member, guild: Guild)): function
---@field on fun(self: Client, name: '"roleCreate"', fn: async fun(role: Role)): function
---@field on fun(self: Client, name: '"roleUpdate"', fn: async fun(role: Role)): function
---@field on fun(self: Client, name: '"roleDelete"', fn: async fun(role: Role)): function
---@field on fun(self: Client, name: '"messageCreate"', fn: async fun(message: Message)): function Emitted when a text channel message is created.
---@field on fun(self: Client, name: '"messageUpdate"', fn: async fun(message: Message)): function
---@field on fun(self: Client, name: '"messageUpdateUncached"', fn: async fun(channel: TextChannel, messageId: string)): function
---@field on fun(self: Client, name: '"reactionAdd"', fn: async fun(reaction: Reaction, userId: string)): function
---@field on fun(self: Client, name: '"reactionAddUncached"', fn: async fun(channel: TextChannel, messageId: string, hash: string, userId: string)): function
---@field on fun(self: Client, name: '"reactionRemove"', fn: async fun(reaction: Reaction, userId: string)): function
---@field on fun(self: Client, name: '"reactionRemoveUncached"', fn: async fun(channel: TextChannel, messageId: string, hash: string, userId: string)): function
---@field on fun(self: Client, name: '"pinsUpdate"', fn: async fun(channel: TextChannel)): function
---@field on fun(self: Client, name: '"presenceUpdate"', fn: async fun(member: Member)): function
---@field on fun(self: Client, name: '"relationshipUpdate"', fn: async fun(relationship: Relationship)): function
---@field on fun(self: Client, name: '"relationshipAdd"', fn: async fun(relationship: Relationship)): function
---@field on fun(self: Client, name: '"relationshipRemove"', fn: async fun(relationship: Relationship)): function
---@field on fun(self: Client, name: '"typingStart"', fn: async fun(userId: string, channelId: string, timestamp: string)): function
---@field on fun(self: Client, name: '"userUpdate"', fn: async fun(user: User)): function
---@field on fun(self: Client, name: '"voiceConnect"', fn: async fun(member: Member)): function
---@field on fun(self: Client, name: '"voiceUpdate"', fn: async fun(member: Member)): function
---@field on fun(self: Client, name: '"voiceChannelJoin"', fn: async fun(member: Member, channel: GuildVoiceChannel)): function
---@field on fun(self: Client, name: '"voiceChannelLeave"', fn: async fun(member: Member, channel: GuildVoiceChannel)): function
---@field on fun(self: Client, name: '"webhooksUpdate"', fn: async fun(channel: TextChannel)): function
---@field on fun(self: Client, name: '"debug"', fn: async fun(message: string)): function
---@field on fun(self: Client, name: '"info"', fn: async fun(message: string)): function
---@field on fun(self: Client, name: '"warning"', fn: async fun(message: string)): function
---@field on fun(self: Client, name: '"error"', fn: async fun(message: string)): function
---@field on fun(self: Client, name: '"heartbeat"', fn: async fun(shardId: number, latency: number)): function
---@field on fun(self: Client, name: '"raw"', fn: async fun(json: string)): function
---@field onSync fun(self: Client, name: string, fn: async fun()): function
---@field onSync fun(self: Client, name: '"ready"', fn: async fun()): function
---@field onSync fun(self: Client, name: '"shardReady"', fn: async fun(shardId: number)): function
---@field onSync fun(self: Client, name: '"shardResumed"', fn: async fun(shardId: number)): function
---@field onSync fun(self: Client, name: '"channelCreate"', fn: async fun(channel: Channel)): function
---@field onSync fun(self: Client, name: '"channelUpdate"', fn: async fun(channel: Channel)): function
---@field onSync fun(self: Client, name: '"channelDelete"', fn: async fun(channel: Channel)): function
---@field onSync fun(self: Client, name: '"recipientAdd"', fn: async fun(channel: Channel, user: User)): function
---@field onSync fun(self: Client, name: '"recipientRemove"', fn: async fun(channel: Channel, user: User)): function
---@field onSync fun(self: Client, name: '"guildAvailable"', fn: async fun(guild: Guild)): function
---@field onSync fun(self: Client, name: '"guildCreate"', fn: async fun(guild: Guild)): function
---@field onSync fun(self: Client, name: '"guildUnavailable"', fn: async fun(guild: Guild)): function
---@field onSync fun(self: Client, name: '"guildDelete"', fn: async fun(guild: Guild)): function
---@field onSync fun(self: Client, name: '"userBan"', fn: async fun(user: User, guild: Guild)): function
---@field onSync fun(self: Client, name: '"userUnban"', fn: async fun(user: User, guild: Guild)): function
---@field onSync fun(self: Client, name: '"emojisUpdate"', fn: async fun(guild: Guild)): function
---@field onSync fun(self: Client, name: '"memberJoin"', fn: async fun(member: Member, guild: Guild)): function
---@field onSync fun(self: Client, name: '"memberLeave"', fn: async fun(member: Member, guild: Guild)): function
---@field onSync fun(self: Client, name: '"memberUpdate"', fn: async fun(member: Member, guild: Guild)): function
---@field onSync fun(self: Client, name: '"roleCreate"', fn: async fun(role: Role)): function
---@field onSync fun(self: Client, name: '"roleUpdate"', fn: async fun(role: Role)): function
---@field onSync fun(self: Client, name: '"roleDelete"', fn: async fun(role: Role)): function
---@field onSync fun(self: Client, name: '"messageCreate"', fn: async fun(message: Message)): function Emitted when a text channel message is created.
---@field onSync fun(self: Client, name: '"messageUpdate"', fn: async fun(message: Message)): function
---@field onSync fun(self: Client, name: '"messageUpdateUncached"', fn: async fun(channel: TextChannel, messageId: string)): function
---@field onSync fun(self: Client, name: '"reactionAdd"', fn: async fun(reaction: Reaction, userId: string)): function
---@field onSync fun(self: Client, name: '"reactionAddUncached"', fn: async fun(channel: TextChannel, messageId: string, hash: string, userId: string)): function
---@field onSync fun(self: Client, name: '"reactionRemove"', fn: async fun(reaction: Reaction, userId: string)): function
---@field onSync fun(self: Client, name: '"reactionRemoveUncached"', fn: async fun(channel: TextChannel, messageId: string, hash: string, userId: string)): function
---@field onSync fun(self: Client, name: '"pinsUpdate"', fn: async fun(channel: TextChannel)): function
---@field onSync fun(self: Client, name: '"presenceUpdate"', fn: async fun(member: Member)): function
---@field onSync fun(self: Client, name: '"relationshipUpdate"', fn: async fun(relationship: Relationship)): function
---@field onSync fun(self: Client, name: '"relationshipAdd"', fn: async fun(relationship: Relationship)): function
---@field onSync fun(self: Client, name: '"relationshipRemove"', fn: async fun(relationship: Relationship)): function
---@field onSync fun(self: Client, name: '"typingStart"', fn: async fun(userId: string, channelId: string, timestamp: string)): function
---@field onSync fun(self: Client, name: '"userUpdate"', fn: async fun(user: User)): function
---@field onSync fun(self: Client, name: '"voiceConnect"', fn: async fun(member: Member)): function
---@field onSync fun(self: Client, name: '"voiceUpdate"', fn: async fun(member: Member)): function
---@field onSync fun(self: Client, name: '"voiceChannelJoin"', fn: async fun(member: Member, channel: GuildVoiceChannel)): function
---@field onSync fun(self: Client, name: '"voiceChannelLeave"', fn: async fun(member: Member, channel: GuildVoiceChannel)): function
---@field onSync fun(self: Client, name: '"webhooksUpdate"', fn: async fun(channel: TextChannel)): function
---@field onSync fun(self: Client, name: '"debug"', fn: async fun(message: string)): function
---@field onSync fun(self: Client, name: '"info"', fn: async fun(message: string)): function
---@field onSync fun(self: Client, name: '"warning"', fn: async fun(message: string)): function
---@field onSync fun(self: Client, name: '"error"', fn: async fun(message: string)): function
---@field onSync fun(self: Client, name: '"heartbeat"', fn: async fun(shardId: number, latency: number)): function
---@field onSync fun(self: Client, name: '"raw"', fn: async fun(json: string)): function
---@field once fun(self: Client, name: string, fn: async fun()): function
---@field once fun(self: Client, name: '"ready"', fn: async fun()): function
---@field once fun(self: Client, name: '"shardReady"', fn: async fun(shardId: number)): function
---@field once fun(self: Client, name: '"shardResumed"', fn: async fun(shardId: number)): function
---@field once fun(self: Client, name: '"channelCreate"', fn: async fun(channel: Channel)): function
---@field once fun(self: Client, name: '"channelUpdate"', fn: async fun(channel: Channel)): function
---@field once fun(self: Client, name: '"channelDelete"', fn: async fun(channel: Channel)): function
---@field once fun(self: Client, name: '"recipientAdd"', fn: async fun(channel: Channel, user: User)): function
---@field once fun(self: Client, name: '"recipientRemove"', fn: async fun(channel: Channel, user: User)): function
---@field once fun(self: Client, name: '"guildAvailable"', fn: async fun(guild: Guild)): function
---@field once fun(self: Client, name: '"guildCreate"', fn: async fun(guild: Guild)): function
---@field once fun(self: Client, name: '"guildUnavailable"', fn: async fun(guild: Guild)): function
---@field once fun(self: Client, name: '"guildDelete"', fn: async fun(guild: Guild)): function
---@field once fun(self: Client, name: '"userBan"', fn: async fun(user: User, guild: Guild)): function
---@field once fun(self: Client, name: '"userUnban"', fn: async fun(user: User, guild: Guild)): function
---@field once fun(self: Client, name: '"emojisUpdate"', fn: async fun(guild: Guild)): function
---@field once fun(self: Client, name: '"memberJoin"', fn: async fun(member: Member, guild: Guild)): function
---@field once fun(self: Client, name: '"memberLeave"', fn: async fun(member: Member, guild: Guild)): function
---@field once fun(self: Client, name: '"memberUpdate"', fn: async fun(member: Member, guild: Guild)): function
---@field once fun(self: Client, name: '"roleCreate"', fn: async fun(role: Role)): function
---@field once fun(self: Client, name: '"roleUpdate"', fn: async fun(role: Role)): function
---@field once fun(self: Client, name: '"roleDelete"', fn: async fun(role: Role)): function
---@field once fun(self: Client, name: '"messageCreate"', fn: async fun(message: Message)): function Emitted when a text channel message is created.
---@field once fun(self: Client, name: '"messageUpdate"', fn: async fun(message: Message)): function
---@field once fun(self: Client, name: '"messageUpdateUncached"', fn: async fun(channel: TextChannel, messageId: string)): function
---@field once fun(self: Client, name: '"reactionAdd"', fn: async fun(reaction: Reaction, userId: string)): function
---@field once fun(self: Client, name: '"reactionAddUncached"', fn: async fun(channel: TextChannel, messageId: string, hash: string, userId: string)): function
---@field once fun(self: Client, name: '"reactionRemove"', fn: async fun(reaction: Reaction, userId: string)): function
---@field once fun(self: Client, name: '"reactionRemoveUncached"', fn: async fun(channel: TextChannel, messageId: string, hash: string, userId: string)): function
---@field once fun(self: Client, name: '"pinsUpdate"', fn: async fun(channel: TextChannel)): function
---@field once fun(self: Client, name: '"presenceUpdate"', fn: async fun(member: Member)): function
---@field once fun(self: Client, name: '"relationshipUpdate"', fn: async fun(relationship: Relationship)): function
---@field once fun(self: Client, name: '"relationshipAdd"', fn: async fun(relationship: Relationship)): function
---@field once fun(self: Client, name: '"relationshipRemove"', fn: async fun(relationship: Relationship)): function
---@field once fun(self: Client, name: '"typingStart"', fn: async fun(userId: string, channelId: string, timestamp: string)): function
---@field once fun(self: Client, name: '"userUpdate"', fn: async fun(user: User)): function
---@field once fun(self: Client, name: '"voiceConnect"', fn: async fun(member: Member)): function
---@field once fun(self: Client, name: '"voiceUpdate"', fn: async fun(member: Member)): function
---@field once fun(self: Client, name: '"voiceChannelJoin"', fn: async fun(member: Member, channel: GuildVoiceChannel)): function
---@field once fun(self: Client, name: '"voiceChannelLeave"', fn: async fun(member: Member, channel: GuildVoiceChannel)): function
---@field once fun(self: Client, name: '"webhooksUpdate"', fn: async fun(channel: TextChannel)): function
---@field once fun(self: Client, name: '"debug"', fn: async fun(message: string)): function
---@field once fun(self: Client, name: '"info"', fn: async fun(message: string)): function
---@field once fun(self: Client, name: '"warning"', fn: async fun(message: string)): function
---@field once fun(self: Client, name: '"error"', fn: async fun(message: string)): function
---@field once fun(self: Client, name: '"heartbeat"', fn: async fun(shardId: number, latency: number)): function
---@field once fun(self: Client, name: '"raw"', fn: async fun(json: string)): function
---@field onceSync fun(self: Client, name: string, fn: async fun()): function
---@field onceSync fun(self: Client, name: '"ready"', fn: async fun()): function
---@field onceSync fun(self: Client, name: '"shardReady"', fn: async fun(shardId: number)): function
---@field onceSync fun(self: Client, name: '"shardResumed"', fn: async fun(shardId: number)): function
---@field onceSync fun(self: Client, name: '"channelCreate"', fn: async fun(channel: Channel)): function
---@field onceSync fun(self: Client, name: '"channelUpdate"', fn: async fun(channel: Channel)): function
---@field onceSync fun(self: Client, name: '"channelDelete"', fn: async fun(channel: Channel)): function
---@field onceSync fun(self: Client, name: '"recipientAdd"', fn: async fun(channel: Channel, user: User)): function
---@field onceSync fun(self: Client, name: '"recipientRemove"', fn: async fun(channel: Channel, user: User)): function
---@field onceSync fun(self: Client, name: '"guildAvailable"', fn: async fun(guild: Guild)): function
---@field onceSync fun(self: Client, name: '"guildCreate"', fn: async fun(guild: Guild)): function
---@field onceSync fun(self: Client, name: '"guildUnavailable"', fn: async fun(guild: Guild)): function
---@field onceSync fun(self: Client, name: '"guildDelete"', fn: async fun(guild: Guild)): function
---@field onceSync fun(self: Client, name: '"userBan"', fn: async fun(user: User, guild: Guild)): function
---@field onceSync fun(self: Client, name: '"userUnban"', fn: async fun(user: User, guild: Guild)): function
---@field onceSync fun(self: Client, name: '"emojisUpdate"', fn: async fun(guild: Guild)): function
---@field onceSync fun(self: Client, name: '"memberJoin"', fn: async fun(member: Member, guild: Guild)): function
---@field onceSync fun(self: Client, name: '"memberLeave"', fn: async fun(member: Member, guild: Guild)): function
---@field onceSync fun(self: Client, name: '"memberUpdate"', fn: async fun(member: Member, guild: Guild)): function
---@field onceSync fun(self: Client, name: '"roleCreate"', fn: async fun(role: Role)): function
---@field onceSync fun(self: Client, name: '"roleUpdate"', fn: async fun(role: Role)): function
---@field onceSync fun(self: Client, name: '"roleDelete"', fn: async fun(role: Role)): function
---@field onceSync fun(self: Client, name: '"messageCreate"', fn: async fun(message: Message)): function Emitted when a text channel message is created.
---@field onceSync fun(self: Client, name: '"messageUpdate"', fn: async fun(message: Message)): function
---@field onceSync fun(self: Client, name: '"messageUpdateUncached"', fn: async fun(channel: TextChannel, messageId: string)): function
---@field onceSync fun(self: Client, name: '"reactionAdd"', fn: async fun(reaction: Reaction, userId: string)): function
---@field onceSync fun(self: Client, name: '"reactionAddUncached"', fn: async fun(channel: TextChannel, messageId: string, hash: string, userId: string)): function
---@field onceSync fun(self: Client, name: '"reactionRemove"', fn: async fun(reaction: Reaction, userId: string)): function
---@field onceSync fun(self: Client, name: '"reactionRemoveUncached"', fn: async fun(channel: TextChannel, messageId: string, hash: string, userId: string)): function
---@field onceSync fun(self: Client, name: '"pinsUpdate"', fn: async fun(channel: TextChannel)): function
---@field onceSync fun(self: Client, name: '"presenceUpdate"', fn: async fun(member: Member)): function
---@field onceSync fun(self: Client, name: '"relationshipUpdate"', fn: async fun(relationship: Relationship)): function
---@field onceSync fun(self: Client, name: '"relationshipAdd"', fn: async fun(relationship: Relationship)): function
---@field onceSync fun(self: Client, name: '"relationshipRemove"', fn: async fun(relationship: Relationship)): function
---@field onceSync fun(self: Client, name: '"typingStart"', fn: async fun(userId: string, channelId: string, timestamp: string)): function
---@field onceSync fun(self: Client, name: '"userUpdate"', fn: async fun(user: User)): function
---@field onceSync fun(self: Client, name: '"voiceConnect"', fn: async fun(member: Member)): function
---@field onceSync fun(self: Client, name: '"voiceUpdate"', fn: async fun(member: Member)): function
---@field onceSync fun(self: Client, name: '"voiceChannelJoin"', fn: async fun(member: Member, channel: GuildVoiceChannel)): function
---@field onceSync fun(self: Client, name: '"voiceChannelLeave"', fn: async fun(member: Member, channel: GuildVoiceChannel)): function
---@field onceSync fun(self: Client, name: '"webhooksUpdate"', fn: async fun(channel: TextChannel)): function
---@field onceSync fun(self: Client, name: '"debug"', fn: async fun(message: string)): function
---@field onceSync fun(self: Client, name: '"info"', fn: async fun(message: string)): function
---@field onceSync fun(self: Client, name: '"warning"', fn: async fun(message: string)): function
---@field onceSync fun(self: Client, name: '"error"', fn: async fun(message: string)): function
---@field onceSync fun(self: Client, name: '"heartbeat"', fn: async fun(shardId: number, latency: number)): function
---@field onceSync fun(self: Client, name: '"raw"', fn: async fun(json: string)): function
---@overload fun(options?: table):Client
---@type fun(options?: table):Client
local Client = {}
---Authenticates the current user via HTTPS and launches as many WSS gateway shards as are required or requested. By using coroutines that are automatically managed by Luvit libraries and a libuv event loop, multiple clients per process and multiple shards per client can operate concurrently. This should be the last method called after all other code and event handlers have been initialized. If a presence table is provided, it will act as if the user called `setStatus` and `setGame` after `run`.
---@param token string
---@param presence? table
---@return nil
function Client:run(token, presence) end
---Disconnects all shards and effectively stops their loops. This does not empty any data that the client may have cached.
---@return nil
function Client:stop() end
---Sets the client's username. This must be between 2 and 32 characters in length. This does not change the application name.
---@param username string
---@return boolean
---@async
function Client:setUsername(username) end
---Sets the client's avatar. To remove the avatar, pass an empty string or nil. This does not change the application image.
---@param avatar string
---@return boolean
---@async
function Client:setAvatar(avatar) end
---Creates a new guild. The name must be between 2 and 100 characters in length. This method may not work if the current user is in too many guilds. Note that this does not return the created guild object; wait for the corresponding `guildCreate` event if you need the object.
---@param name string
---@return boolean
---@async
function Client:createGuild(name) end
---Creates a new group channel. This method is only available for user accounts.
---@return GroupChannel
---@async
function Client:createGroupChannel() end
---Gets a webhook object by ID. This always makes an HTTP request to obtain a static object that is not cached and is not updated by gateway events.
---@param id string
---@return Webhook
---@async
function Client:getWebhook(id) end
---Gets an invite object by code. This always makes an HTTP request to obtain a static object that is not cached and is not updated by gateway events.
---@param code string
---@param counts? boolean
---@return Invite
---@async
function Client:getInvite(code, counts) end
---Gets a user object by ID. If the object is already cached, then the cached object will be returned; otherwise, an HTTP request is made. Under circumstances which should be rare, the user object may be an old version, not updated by gateway events.
---@param id User | string
---@return User
---@async
function Client:getUser(id) end
---Gets a guild object by ID. The current user must be in the guild and the client must be running the appropriate shard that serves this guild. This method never makes an HTTP request to obtain a guild.
---@param id Guild | string
---@return Guild
function Client:getGuild(id) end
---Gets a channel object by ID. For guild channels, the current user must be in the channel's guild and the client must be running the appropriate shard that serves the channel's guild. For private channels, the channel must have been previously opened and cached. If the channel is not cached, `User:getPrivateChannel` should be used instead.
---@param id Channel | string
---@return Channel
function Client:getChannel(id) end
---Gets a role object by ID. The current user must be in the role's guild and the client must be running the appropriate shard that serves the role's guild.
---@param id Role | string
---@return Role
function Client:getRole(id) end
---Gets an emoji object by ID. The current user must be in the emoji's guild and the client must be running the appropriate shard that serves the emoji's guild.
---@param id Emoji | string
---@return Emoji
function Client:getEmoji(id) end
---Returns a raw data table that contains a list of voice regions as provided by Discord, with no formatting beyond what is provided by the Discord API.
---@return table
---@async
function Client:listVoiceRegions() end
---Returns a raw data table that contains a list of connections as provided by Discord, with no formatting beyond what is provided by the Discord API. This is unrelated to voice connections.
---@return table
---@async
function Client:getConnections() end
---Returns a raw data table that contains information about the current OAuth2 application, with no formatting beyond what is provided by the Discord API.
---@return table
---@async
function Client:getApplicationInformation() end
---Sets the current user's status on all shards that are managed by this client. See the `status` enumeration for acceptable status values.
---@param status string
---@return nil
function Client:setStatus(status) end
---Sets the current user's game on all shards that are managed by this client. If a string is passed, it is treated as the game name. If a table is passed, it must have a `name` field and may optionally have a `url` or `type` field. Pass `nil` to remove the game status.
---@param game string | table
---@return nil
function Client:setGame(game) end
---Set the current user's AFK status on all shards that are managed by this client. This generally applies to user accounts and their push notifications.
---@param afk boolean
---@return nil
function Client:setAFK(afk) end
---Create a new Client
---@param options? table
---@return Client
function Client:__init(options) end
---Represents a Discord group channel. Essentially a private channel that may have more than one and up to ten recipients. This class should only be relevant to user-accounts; bots cannot normally join group channels.
---@class GroupChannel: TextChannel
---@field public recipients SecondaryCache A secondary cache of users that are present in the channel.
---@field public name string The name of the channel.
---@field public ownerId string The Snowflake ID of the user that owns (created) the channel.
---@field public owner User | nil Equivalent to `GroupChannel.recipients:get(GroupChannel.ownerId)`.
---@field public icon string | nil The hash for the channel's custom icon, if one is set.
---@field public iconURL string | nil The URL that can be used to view the channel's icon, if one is set.
---@overload fun():GroupChannel
---@type fun():GroupChannel
local GroupChannel = {}
---Sets the channel's name. This must be between 1 and 100 characters in length.
---@param name string
---@return boolean
---@async
function GroupChannel:setName(name) end
---Sets the channel's icon. To remove the icon, pass `nil`.
---@param icon string
---@return boolean
---@async
function GroupChannel:setIcon(icon) end
---Adds a user to the channel.
---@param id User | string
---@return boolean
---@async
function GroupChannel:addRecipient(id) end
---Removes a user from the channel.
---@param id User | string
---@return boolean
---@async
function GroupChannel:removeRecipient(id) end
---Removes the client's user from the channel. If no users remain, the channel is destroyed.
---@return boolean
---@async
function GroupChannel:leave() end
---Create a new GroupChannel
---@return GroupChannel
function GroupChannel:__init() end
---Represents a channel category in a Discord guild, used to organize individual text or voice channels in that guild.
---@class GuildCategoryChannel: GuildChannel
---@field public textChannels FilteredIterable Iterable of all textChannels in the Category.
---@field public voiceChannels FilteredIterable Iterable of all voiceChannels in the Category.
---@overload fun():GuildCategoryChannel
---@type fun():GuildCategoryChannel
local GuildCategoryChannel = {}
---Creates a new GuildTextChannel with this category as it's parent. Similar to `Guild:createTextChannel(name)`
---@param name string
---@return GuildTextChannel
---@async
function GuildCategoryChannel:createTextChannel(name) end
---Creates a new GuildVoiceChannel with this category as it's parent. Similar to `Guild:createVoiceChannel(name)`
---@param name string
---@return GuildVoiceChannel
---@async
function GuildCategoryChannel:createVoiceChannel(name) end
---Create a new GuildCategoryChannel
---@return GuildCategoryChannel
function GuildCategoryChannel:__init() end
---Abstract base class that defines the base methods and properties for a general purpose data structure with features that are better suited for an object-oriented environment. Note: All sub-classes should implement their own `__init` and `iter` methods and all stored objects should have a `__hash` method.
---@class Iterable
---@overload fun():Iterable
---@type fun():Iterable
local Iterable = {}
---Defines the behavior of the `pairs` function. Returns an iterator that returns a `key, value` pair, where `key` is the result of calling `__hash` on the `value`.
---@return async fun()
function Iterable:__pairs() end
---Defines the behavior of the `#` operator. Returns the total number of objects stored in the iterable.
---@return async fun()
function Iterable:__len() end
---Returns an individual object by key, where the key should match the result of calling `__hash` on the contained objects. Operates with up to O(n) complexity.
---@param k any
---@return any
function Iterable:get(k) end
---Returns the first object that satisfies a predicate.
---@param fn async fun()
---@return any
function Iterable:find(fn) end
---Returns an iterator that returns all objects that satisfy a predicate.
---@param fn async fun()
---@return async fun()
function Iterable:findAll(fn) end
---Iterates through all objects and calls a function `fn` that takes the objects as an argument.
---@param fn async fun()
---@return nil
function Iterable:forEach(fn) end
---Returns a random object that is contained in the iterable.
---@return any
function Iterable:random() end
---If a predicate is provided, this returns the number of objects in the iterable that satisfy the predicate; otherwise, the total number of objects.
---@param fn? async fun()
---@return number
function Iterable:count(fn) end
---Returns a sequentially-indexed table that contains references to all objects. If a `sortBy` string is provided, then the table is sorted by that particular property. If a predicate is provided, then only objects that satisfy it will be included.
---@param sortBy? string
---@param fn? async fun()
---@return table
function Iterable:toArray(sortBy, fn) end
---Similarly to an SQL query, this returns a sorted Lua table of rows where each row corresponds to each object in the iterable, and each value in the row is selected from the objects according to the keys provided.
---@vararg string
---@return table
function Iterable:select(...) end
---This returns an iterator that, when called, returns the values from each encountered object, picked by the provided keys. If a key is a string, the objects are indexed with the string. If a key is a function, the function is called with the object passed as its first argument.
---@vararg string | async fun()
---@return async fun()
function Iterable:pick(...) end
---Create a new Iterable
---@return Iterable
function Iterable:__init() end
---Represents a handle used to send webhook messages to a guild text channel in a one-way fashion. This class defines methods and properties for managing the webhook, not for sending messages.
---@class Webhook: Snowflake
---@field public guildId string The ID of the guild in which this webhook exists.
---@field public channelId string The ID of the channel in which this webhook exists.
---@field public user User | nil The user that created this webhook.
---@field public token string The token that can be used to access this webhook.
---@field public name string The name of the webhook. This should be between 2 and 32 characters in length.
---@field public type number The type of the webhook. See the `webhookType` enum for a human-readable representation.
---@field public avatar string | nil The hash for the webhook's custom avatar, if one is set.
---@field public avatarURL string Equivalent to the result of calling `Webhook:getAvatarURL()`.
---@field public defaultAvatar number The default avatar for the webhook. See the `defaultAvatar` enumeration for a human-readable representation. This should always be `defaultAvatar.blurple`.
---@field public defaultAvatarURL string Equivalent to the result of calling `Webhook:getDefaultAvatarURL()`.
---@overload fun():Webhook
---@type fun():Webhook
local Webhook = {}
---Returns a URL that can be used to view the webhooks's full avatar. If provided, the size must be a power of 2 while the extension must be a valid image format. If the webhook does not have a custom avatar, the default URL is returned.
---@param size? number
---@param ext? string
---@return string
function Webhook:getAvatarURL(size, ext) end
---Returns a URL that can be used to view the webhooks's default avatar.
---@param size? number
---@return string
function Webhook:getDefaultAvatarURL(size) end
---Sets the webhook's name. This must be between 2 and 32 characters in length.
---@param name string
---@return boolean
---@async
function Webhook:setName(name) end
---Sets the webhook's avatar. If `nil` is passed, the avatar is removed.
---@param avatar string
---@return boolean
---@async
function Webhook:setAvatar(avatar) end
---Permanently deletes the webhook. This cannot be undone!
---@return boolean
---@async
function Webhook:delete() end
---Create a new Webhook
---@return Webhook
function Webhook:__init() end
---Wrapper for 24-bit colors packed as a decimal value. See the static constructors for more information.
---@class Color
---@field public value number The raw decimal value that represents the color value.
---@field public r number The value that represents the color's red-level.
---@field public g number The value that represents the color's green-level.
---@field public b number The value that represents the color's blue-level.
---@overload fun(value: number):Color
---@type fun(value: number):Color
local Color = {}
---Returns a 6-digit hexadecimal string that represents the color value.
---@return string
function Color:toHex() end
---Returns the red, green, and blue values that are packed into the color value.
---@return number number number
function Color:toRGB() end
---Returns the hue, saturation, and value that represents the color value.
---@return number number number
function Color:toHSV() end
---Returns the hue, saturation, and lightness that represents the color value.
---@return number number number
function Color:toHSL() end
---Sets the color's red-level.
---@return nil
function Color:setRed() end
---Sets the color's green-level.
---@return nil
function Color:setGreen() end
---Sets the color's blue-level.
---@return nil
function Color:setBlue() end
---Returns a new copy of the original color object.
---@return Color
function Color:copy() end
---Constructs a new Color object from a hexadecimal string. The string may or may not be prefixed by `#`; all other characters are interpreted as a hex string.
---@param hex string
---@return Color
function Color.fromHex(hex) end
---Constructs a new Color object from RGB values. Values are allowed to overflow though one component will not overflow to the next component.
---@param r number
---@param g number
---@param b number
---@return Color
function Color.fromRGB(r, g, b) end
---Constructs a new Color object from HSV values. Hue is allowed to overflow while saturation and value are clamped to [0, 1].
---@param h number
---@param s number
---@param v number
---@return Color
function Color.fromHSV(h, s, v) end
---Constructs a new Color object from HSL values. Hue is allowed to overflow while saturation and lightness are clamped to [0, 1].
---@param h number
---@param s number
---@param l number
---@return Color
function Color.fromHSL(h, s, l) end
---Create a new Color
---@param value number
---@return Color
function Color:__init(value) end
---Iterable class that wraps another iterable and serves a subset of the objects that the original iterable contains.
---@class FilteredIterable: Iterable
---@overload fun():FilteredIterable
---@type fun():FilteredIterable
local FilteredIterable = {}
---Returns an iterator that returns all contained objects. The order of the objects is not guaranteed.
---@return async fun()
function FilteredIterable:iter() end
---Create a new FilteredIterable
---@return FilteredIterable
function FilteredIterable:__init() end
---Represents an invitation to a Discord guild channel. Invites can be used to join a guild, though they are not always permanent.
---@class Invite: Container
---@field public code string The invite's code which can be used to identify the invite.
---@field public guildId string The Snowflake ID of the guild to which this invite belongs.
---@field public guildName string The name of the guild to which this invite belongs.
---@field public channelId string The Snowflake ID of the channel to which this belongs.
---@field public channelName string The name of the channel to which this invite belongs.
---@field public channelType number The type of the channel to which this invite belongs. Use the `channelType` enumeration for a human-readable representation.
---@field public guildIcon string | nil The hash for the guild's custom icon, if one is set.
---@field public guildBanner string | nil The hash for the guild's custom banner, if one is set.
---@field public guildSplash string | nil The hash for the guild's custom splash, if one is set.
---@field public guildIconURL string | nil The URL that can be used to view the guild's icon, if one is set.
---@field public guildBannerURL string | nil The URL that can be used to view the guild's banner, if one is set.
---@field public guildSplashURL string | nil The URL that can be used to view the guild's splash, if one is set.
---@field public guildDescription string | nil The guild's custom description, if one is set.
---@field public guildVerificationLevel number | nil The guild's verification level, if available.
---@field public inviter User | nil The object of the user that created the invite. This will not exist if the invite is a guild widget or a vanity invite.
---@field public uses number | nil How many times this invite has been used. This will not exist if the invite is accessed via `Client:getInvite`.
---@field public maxUses number | nil The maximum amount of times this invite can be used. This will not exist if the invite is accessed via `Client:getInvite`.
---@field public maxAge number | nil How long, in seconds, this invite lasts before it expires. This will not exist if the invite is accessed via `Client:getInvite`.
---@field public temporary boolean | nil Whether the invite grants temporary membership. This will not exist if the invite is accessed via `Client:getInvite`.
---@field public createdAt string | nil The date and time at which the invite was created, represented as an ISO 8601 string plus microseconds when available. This will not exist if the invite is accessed via `Client:getInvite`.
---@field public revoked boolean | nil Whether the invite has been revoked. This will not exist if the invite is accessed via `Client:getInvite`.
---@field public approximatePresenceCount number | nil The approximate count of online members.
---@field public approximateMemberCount number | nil The approximate count of all members.
---@overload fun():Invite
---@type fun():Invite
local Invite = {}
---Returns `Invite.code`
---@return string
function Invite:__hash() end
---Permanently deletes the invite. This cannot be undone!
---@return boolean
---@async
function Invite:delete() end
---Create a new Invite
---@return Invite
function Invite:__init() end
---Represents a single user of Discord, either a human or a bot, outside of any specific guild's context.
---@class User: Snowflake
---@field public bot boolean Whether this user is a bot.
---@field public name string Equivalent to `User.username`.
---@field public username string The name of the user. This should be between 2 and 32 characters in length.
---@field public discriminator number The discriminator of the user. This is a 4-digit string that is used to discriminate the user from other users with the same username.
---@field public tag string The user's username and discriminator concatenated by an `#`.
---@field public avatar string | nil The hash for the user's custom avatar, if one is set.
---@field public defaultAvatar number The user's default avatar. See the `defaultAvatar` enumeration for a human-readable representation.
---@field public avatarURL string Equivalent to the result of calling `User:getAvatarURL()`.
---@field public defaultAvatarURL string Equivalent to the result of calling `User:getDefaultAvatarURL()`.
---@field public mentionString string A string that, when included in a message content, may resolve as user notification in the official Discord client.
---@field public mutualGuilds FilteredIterable A iterable cache of all guilds where this user shares a membership with the current user. The guild must be cached on the current client and the user's member object must be cached in that guild in order for it to appear here.
---@overload fun():User
---@type fun():User
local User = {}
---Returns a URL that can be used to view the user's full avatar. If provided, the size must be a power of 2 while the extension must be a valid image format. If the user does not have a custom avatar, the default URL is returned.
---@param size? number
---@param ext? string
---@return string
function User:getAvatarURL(size, ext) end
---Returns a URL that can be used to view the user's default avatar.
---@param size? number
---@return string
function User:getDefaultAvatarURL(size) end
---Returns a private channel that can be used to communicate with the user. If the channel is not cached an HTTP request is made to open one.
---@return PrivateChannel
---@async
function User:getPrivateChannel() end
---Equivalent to `User:getPrivateChannel():send(content)`
---@param content string | table
---@return Message
---@async
function User:send(content) end
---Equivalent to `User:getPrivateChannel():sendf(content)`
---@param content string
---@return Message
---@async
function User:sendf(content) end
---Create a new User
---@return User
function User:__init() end
---Wrapper for a bitfield that is more specifically used to represent Discord permissions. See the `permission` enumeration for acceptable permission values.
---@class Permissions
---@field public value number The raw decimal value that represents the permissions value.
---@overload fun():Permissions
---@type fun():Permissions
local Permissions = {}
---Defines the behavior of the `tostring` function. Returns a readable list of permissions stored for convenience of introspection.
---@return string
function Permissions:__tostring() end
---Defines the behavior of the `==` operator. Allows permissions to be directly compared according to their value.
---@return boolean
function Permissions:__eq() end
---Enables a specific permission or permissions. See the `permission` enumeration for acceptable permission values.
---@vararg number
---@return nil
function Permissions:enable(...) end
---Disables a specific permission or permissions. See the `permission` enumeration for acceptable permission values.
---@vararg number
---@return nil
function Permissions:disable(...) end
---Returns whether this set has a specific permission or permissions. See the `permission` enumeration for acceptable permission values.
---@vararg number
---@return boolean
function Permissions:has(...) end
---Enables all permissions values.
---@return nil
function Permissions:enableAll() end
---Disables all permissions values.
---@return nil
function Permissions:disableAll() end
---Returns the hexadecimal string that represents the permissions value.
---@return string
function Permissions:toHex() end
---Returns a table that represents the permissions value, where the keys are the permission names and the values are `true` or `false`.
---@return table
function Permissions:toTable() end
---Returns an array of the names of the permissions that this object represents.
---@return table
function Permissions:toArray() end
---Returns a new Permissions object that contains the permissions that are in either `self` or `other` (bitwise OR).
---@param other Permissions
---@return Permissions
function Permissions:union(other) end
---Returns a new Permissions object that contains the permissions that are in both `self` and `other` (bitwise AND).
---@param other Permissions
---@return Permissions
function Permissions:intersection(other) end
---Returns a new Permissions object that contains the permissions that are not in `self` or `other` (bitwise XOR).
---@param other Permissions
---@return Permissions
function Permissions:difference(other) end
---Returns a new Permissions object that contains the permissions that are not in `self`, but are in `other` (or the set of all permissions if omitted).
---@param other Permissions
---@return Permissions
function Permissions:complement(other) end
---Returns a new copy of the original permissions object.
---@return Permissions
function Permissions:copy() end
---Returns a Permissions object with all of the defined permissions.
---@vararg number
---@return Permissions
function Permissions.fromMany(...) end
---Returns a Permissions object with all permissions.
---@return Permissions
function Permissions.all() end
---Create a new Permissions
---@return Permissions
function Permissions:__init() end
---Represents a Discord guild (or server). Guilds are a collection of members, channels, and roles that represents one community.
---@class Guild: Snowflake
---@field public shardId number The ID of the shard on which this guild is served. If only one shard is in operation, then this will always be 0.
---@field public name string The guild's name. This should be between 2 and 100 characters in length.
---@field public icon string | nil The hash for the guild's custom icon, if one is set.
---@field public iconURL string | nil The URL that can be used to view the guild's icon, if one is set.
---@field public splash string | nil The hash for the guild's custom splash image, if one is set. Only partnered guilds may have this.
---@field public splashURL string | nil The URL that can be used to view the guild's custom splash image, if one is set. Only partnered guilds may have this.
---@field public banner string | nil The hash for the guild's custom banner, if one is set.
---@field public bannerURL string | nil The URL that can be used to view the guild's banner, if one is set.
---@field public large boolean Whether the guild has an arbitrarily large amount of members. Guilds that are "large" will not initialize with all members cached.
---@field public lazy boolean Whether the guild follows rules for the lazy-loading of client data.
---@field public region string The voice region that is used for all voice connections in the guild.
---@field public vanityCode string | nil The guild's vanity invite URL code, if one exists.
---@field public description string | nil The guild's custom description, if one exists.
---@field public maxMembers number | nil The guild's maximum member count, if available.
---@field public maxPresences number | nil The guild's maximum presence count, if available.
---@field public mfaLevel number The guild's multi-factor (or two-factor) verification level setting. A value of 0 indicates that MFA is not required; a value of 1 indicates that MFA is required for administrative actions.
---@field public joinedAt string The date and time at which the current user joined the guild, represented as an ISO 8601 string plus microseconds when available.
---@field public afkTimeout number The guild's voice AFK timeout in seconds.
---@field public unavailable boolean Whether the guild is unavailable. If the guild is unavailable, then no property is guaranteed to exist except for this one and the guild's ID.
---@field public totalMemberCount number The total number of members that belong to this guild. This should always be greater than or equal to the total number of cached members.
---@field public verificationLevel number The guild's verification level setting. See the `verificationLevel` enumeration for a human-readable representation.
---@field public notificationSetting number The guild's default notification setting. See the `notficationSetting` enumeration for a human-readable representation.
---@field public explicitContentSetting number The guild's explicit content level setting. See the `explicitContentLevel` enumeration for a human-readable representation.
---@field public premiumTier number The guild's premium tier (server boost level). See the `premiumTier` enumeration for a human-readable representation.
---@field public premiumSubscriptionCount number The number of boosts the guild currently has. This may be greater than the number of users who are boosting the guild.
---@field public features table Raw table of VIP features that are enabled for the guild.
---@field public me Member | nil Equivalent to `Guild.members:get(Guild.client.user.id)`.
---@field public owner Member | nil Equivalent to `Guild.members:get(Guild.ownerId)`.
---@field public ownerId string The Snowflake ID of the guild member that owns the guild.
---@field public afkChannelId string | nil The Snowflake ID of the channel that is used for AFK members, if one is set.
---@field public afkChannel GuildVoiceChannel | nil Equivalent to `Guild.voiceChannels:get(Guild.afkChannelId)`.
---@field public systemChannelId string | nil The channel id where Discord's join messages will be displayed.
---@field public systemChannel GuildTextChannel | nil The channel where Discord's join messages will be displayed.
---@field public defaultRole Role Equivalent to `Guild.roles:get(Guild.id)`.
---@field public connection VoiceConnection | nil The VoiceConnection for this guild if one exists.
---@field public roles Cache An iterable cache of all roles that exist in this guild. This includes the default everyone role.
---@field public emojis Cache An iterable cache of all emojis that exist in this guild. Note that standard unicode emojis are not found here; only custom emojis.
---@field public members Cache An iterable cache of all members that exist in this guild and have been already loaded. If the `cacheAllMembers` client option (and the `syncGuilds` option for user-accounts) is enabled on start-up, then all members will be cached. Otherwise, offline members may not be cached. To access a member that may exist, but is not cached, use `Guild:getMember`.
---@field public textChannels Cache An iterable cache of all text channels that exist in this guild.
---@field public voiceChannels Cache An iterable cache of all voice channels that exist in this guild.
---@field public categories Cache An iterable cache of all channel categories that exist in this guild.
---@overload fun():Guild
---@type fun():Guild
local Guild = {}
---Asynchronously loads all members for this guild. You do not need to call this if the `cacheAllMembers` client option (and the `syncGuilds` option for user-accounts) is enabled on start-up.
---@return boolean
function Guild:requestMembers() end
---Asynchronously loads certain data and enables the receiving of certain events for this guild. You do not need to call this if the `syncGuilds` client option is enabled on start-up. Note: This is only for user accounts. Bot accounts never need to sync guilds!
---@return boolean
function Guild:sync() end
---Gets a member object by ID. If the object is already cached, then the cached object will be returned; otherwise, an HTTP request is made.
---@param id User | string
---@return Member
---@async
function Guild:getMember(id) end
---Gets a role object by ID.
---@param id Role | string
---@return Role
function Guild:getRole(id) end
---Gets a emoji object by ID.
---@param id Emoji | string
---@return Emoji
function Guild:getEmoji(id) end
---Gets a text, voice, or category channel object by ID.
---@param id Channel | string
---@return GuildChannel
function Guild:getChannel(id) end
---Creates a new text channel in this guild. The name must be between 2 and 100 characters in length.
---@param name string
---@return GuildTextChannel
---@async
function Guild:createTextChannel(name) end
---Creates a new voice channel in this guild. The name must be between 2 and 100 characters in length.
---@param name string
---@return GuildVoiceChannel
---@async
function Guild:createVoiceChannel(name) end
---Creates a channel category in this guild. The name must be between 2 and 100 characters in length.
---@param name string
---@return GuildCategoryChannel
---@async
function Guild:createCategory(name) end
---Creates a new role in this guild. The name must be between 1 and 100 characters in length.
---@param name string
---@return Role
---@async
function Guild:createRole(name) end
---Creates a new emoji in this guild. The name must be between 2 and 32 characters in length. The image must not be over 256kb, any higher will return a 400 Bad Request
---@param name string
---@param image string
---@return Emoji
---@async
function Guild:createEmoji(name, image) end
---Sets the guilds name. This must be between 2 and 100 characters in length.
---@param name string
---@return boolean
---@async
function Guild:setName(name) end
---Sets the guild's voice region (eg: `us-east`). See `listVoiceRegions` for a list of acceptable regions.
---@param region string
---@return boolean
---@async
function Guild:setRegion(region) end
---Sets the guild's verification level setting. See the `verificationLevel` enumeration for acceptable values.
---@param verification_level number
---@return boolean
---@async
function Guild:setVerificationLevel(verification_level) end
---Sets the guild's default notification setting. See the `notficationSetting` enumeration for acceptable values.
---@param default_message_notifications number
---@return boolean
---@async
function Guild:setNotificationSetting(default_message_notifications) end
---Sets the guild's explicit content level setting. See the `explicitContentLevel` enumeration for acceptable values.
---@param explicit_content_filter number
---@return boolean
---@async
function Guild:setExplicitContentSetting(explicit_content_filter) end
---Sets the guild's AFK timeout in seconds.
---@param afk_timeout number
---@return number
---@async
function Guild:setAFKTimeout(afk_timeout) end
---Sets the guild's AFK channel.
---@param id Channel | string
---@return boolean
---@async
function Guild:setAFKChannel(id) end
---Sets the guild's join message channel.
---@param id Channel | string
---@return boolean
---@async
function Guild:setSystemChannel(id) end
---Transfers ownership of the guild to another user. Only the current guild owner can do this.
---@param id User | string
---@return boolean
---@async
function Guild:setOwner(id) end
---Sets the guild's icon. To remove the icon, pass `nil`.
---@param icon string
---@return boolean
---@async
function Guild:setIcon(icon) end
---Sets the guild's banner. To remove the banner, pass `nil`.
---@param banner string
---@return boolean
---@async
function Guild:setBanner(banner) end
---Sets the guild's splash. To remove the splash, pass `nil`.
---@param splash string
---@return boolean
---@async
function Guild:setSplash(splash) end
---Returns the number of members that would be pruned from the guild if a prune were to be executed.
---@param days? number
---@return number
---@async
function Guild:getPruneCount(days) end
---Prunes (removes) inactive, roleless members from the guild who have not been online in the last provided days. If the `count` boolean is provided, the number of pruned members is returned; otherwise, `0` is returned.
---@param days? number
---@param count? boolean
---@return number
---@async
function Guild:pruneMembers(days, count) end
---Returns a newly constructed cache of all ban objects for the guild. The cache and its objects are not automatically updated via gateway events. You must call this method again to get the updated objects.
---@return Cache
---@async
function Guild:getBans() end
---This will return a Ban object for a giver user if that user is banned from the guild; otherwise, `nil` is returned.
---@param id User | string
---@return Ban
---@async
function Guild:getBan(id) end
---Returns a newly constructed cache of all invite objects for the guild. The cache and its objects are not automatically updated via gateway events. You must call this method again to get the updated objects.
---@return Cache