-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathexports.lua
1582 lines (1442 loc) · 78.1 KB
/
exports.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
--- Discord REST API export functions
local discordRest = DiscordRest:new(Config.botToken)
--- Channel
-- @section channel
--- Adds another member to a thread.
-- @function addThreadMember
-- @param channelId The ID of the thread channel.
-- @param userId The ID of the user to add to the thread.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:addThreadMember("[channel ID]", "[user ID]")
-- @see https://discord.com/developers/docs/resources/channel#add-thread-member
exports("addThreadMember", function(channelId, userId, botToken)
return discordRest:addThreadMember(channelId, userId, botToken)
end)
--- Delete multiple messages in a single request.
-- @function bulkDeleteMessages
-- @param channelId The ID of the channel containing the messages.
-- @param messages A list of message IDs to delete (2-100).
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:bulkDeleteMessages("[channel ID]", {"[message ID 1]", "[message ID 2]", ...}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#bulk-delete-messages
exports("bulkDeleteMessages", function(channelId, messages, botToken)
return discordRest:bulkDeleteMessages(channelId, messages, botToken)
end)
--- Create a new invite for a channel.
-- @function createChannelInvite
-- @param channelId The ID of the channel to create an invite for.
-- @param invite The invite settings.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise that resolves with the newly created invite.
-- @usage exports.discord_rest:createChannelInvite("[channel ID]", {max_age = 3600, max_uses = 1})
-- @see https://discord.com/developers/docs/resources/channel#create-channel-invite
exports("createChannelInvite", function(channelId, invite, botToken)
return discordRest:createChannelInvite(channelId, invite, botToken)
end)
--- Post a message.
-- @function createMessage
-- @param channelId The ID of the channel to post in.
-- @param message The message parameters.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved when the message is posted.
-- @usage exports.discord_rest:createMessage("[channel ID]", {content = "Hello, world!"}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#create-message
exports("createMessage", function(channelId, message, botToken)
return discordRest:createMessage(channelId, message, botToken)
end)
--- Create a reaction for a message.
-- @function createReaction
-- @param channelId The ID of the channel containing the message.
-- @param messageId The ID of the message to add a reaction to.
-- @param emoji The name of the emoji to react with.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved when the reaction is added to the message.
-- @usage exports.discord_rest:createReaction("[channel ID]", "[message ID]", "💗", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#create-reaction
exports("createReaction", function(channelId, messageId, emoji, botToken)
return discordRest:createReaction(channelId, messageId, emoji, botToken)
end)
--- Crosspost a message in a News Channel to following channels.
-- @function crosspostMessage
-- @param channelId The ID of the channel containing the message.
-- @param messageId The ID of the message to crosspost.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the crossposted message.
-- @usage exports.discord_rest:crosspostMessage("[channel ID]", "[message ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#crosspost-message
exports("crosspostMessage", function(channelId, messageId, botToken)
return discordRest:crosspostMessage(channelId, messageId, botToken)
end)
--- Deletes all reactions on a message.
-- @function deleteAllReactions
-- @param channelId The ID of the channel containing the message.
-- @param messageId The ID of the message whose reactions will be deleted.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:deleteAllReactions("[channel ID]", "[message ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#delete-all-reactions
exports("deleteAllReactions", function(channelId, messageId, botToken)
return discordRest:deleteAllReactions(channelId, messageId, botToken)
end)
--- Deletes all the reactions for a given emoji on a message.
-- @function deleteAllReactionsForEmoji
-- @param channelId The ID of the channel containing the message.
-- @param messageId The ID of the message to delete reactions from.
-- @param emoji The emoji of the reaction to delete.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:deleteAllReactionsForEmoji("[channel ID]", "[message ID]", "💗", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#delete-all-reactions-for-emoji
exports("deleteAllReactionsForEmoji", function(channelId, messageId, emoji, botToken)
return discordRest:deleteAllReactionsForEmoji(channelId, messageId, emoji, botToken)
end)
--- Delete a channel.
-- @function deleteChannel
-- @param channelId The ID of the channel.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:deleteChannel("[channel ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#deleteclose-channel
exports("deleteChannel", function(channelId, botToken)
return discordRest:deleteChannel(channelId, botToken)
end)
--- Delete a channel permission overwrite for a user or role in a channel.
-- @function deleteChannelPermission
-- @param channelId The ID of the channel.
-- @param overwriteId The ID of the user or role to remove permissions for.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:deleteChannelPermission("[channel ID]", "[overwrite ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#delete-channel-permission
exports("deleteChannelPermission", function(channelId, overwriteId, botToken)
return discordRest:deleteChannelPermission(channelId, overwriteId, botToken)
end)
--- Delete a message from a channel.
-- @function deleteMessage
-- @param channelId The ID of the channel.
-- @param messageId The ID of the message.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:deleteMessage("[channel ID]", "[message ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#delete-message
exports("deleteMessage", function(channelId, messageId, botToken)
return discordRest:deleteMessage(channelId, messageId, botToken)
end)
--- Remove own reaction from a message.
-- @function deleteOwnReaction
-- @param channelId The ID of the channel containing the message.
-- @param messageId The ID of the message to remove the reaction from.
-- @param emoji The emoji of the reaction to remove.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:deleteOwnReaction("[channel ID]", "[message ID]", "💗", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#delete-own-reaction
exports("deleteOwnReaction", function(channelId, messageId, emoji, botToken)
return discordRest:deleteOwnReaction(channelId, messageId, emoji, botToken)
end)
--- Remove a user's reaction from a message.
-- @function deleteUserReaction
-- @param channelId The ID of the channel containing the message.
-- @param messageId The ID of the message to remove the reaction from.
-- @param emoji The emoji of the reaction to remove.
-- @param userId The ID of the user whose reaction will be removed.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:deleteOwnReaction("[channel ID]", "[message ID]", "💗", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#delete-user-reaction
exports("deleteUserReaction", function(channelId, messageId, emoji, userId, botToken)
return discordRest:deleteUserReaction(channelId, messageId, emoji, userId, botToken)
end)
--- Edit the channel permission overwrites for a user or role in a channel.
-- @function editChannelPermissions
-- @param channelId The ID of the channel to edit the permissions of.
-- @param overwriteId The ID of the user or role to edit permissions for.
-- @param permissions The permissions to set.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:editChannelPermissions("[channel ID]", "[overwrite ID]", {allow = 6, deny = 8, type = 0})
-- @see https://discord.com/developers/docs/resources/channel#edit-channel-permissions
exports("editChannelPermissions", function(channelId, overwriteId, permissions, botToken)
return discordRest:editChannelPermissions(channelId, overwriteId, permissions, botToken)
end)
--- Edit a previously sent message.
-- @function editMessage
-- @param channelId The ID of the channel containing the message.
-- @param messageId The ID of the message to edit.
-- @param message The edited message.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise, which resolves with the edited message when the request is completed.
-- @usage exports.discord_rest:editMessage("[channel ID]", "[message ID]", {content = "I edited this message!"}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#edit-message
exports("editMessage", function(channelId, messageId, message, botToken)
return discordRest:editMessage(channelId, messageId, message, botToken)
end)
--- Follow a News Channel to send messages to a target channel.
-- @function followNewsChannel
-- @param channelId The ID of the news channel.
-- @param targetChannelId The ID of the target channel.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise that resolves with a followed channel object.
-- @usage exports.discord_rest:followNewsChannel("[channel ID]", "[target channel ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#follow-news-channel
exports("followNewsChannel", function(channelId, targetChannelId, botToken)
return discordRest:followNewsChannel(channelId, targetChannelId, botToken)
end)
--- Get channel information.
-- @function getChannel
-- @param channelId The ID of the channel.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:getChannel("[channel ID]", "[bot token]"):next(function(channel) ... end)
-- @see https://discord.com/developers/docs/resources/channel#get-channel
exports("getChannel", function(channelId, botToken)
return discordRest:getChannel(channelId, botToken)
end)
--- Get a list of invites for a channel.
-- @function getChannelInvites
-- @param channelId The ID of the channel to get invites for.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise that resolves with the list of invites.
-- @usage exports.discord_rest:getChannelInvites("[channel ID]", "[bot token]"):next(function(invites) ... end)
-- @see https://discord.com/developers/docs/resources/channel#get-channel-invites
exports("getChannelInvites", function(channelId, botToken)
return discordRest:getChannelInvites(channelId, botToken)
end)
--- Get a specific message from a channel.
-- @function getChannelMessage
-- @param channelId The ID of the channel.
-- @param messageId The ID of the message.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:getChannelMessage("[channel ID]", "[messageId]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#get-channel-message
exports("getChannelMessage", function(channelId, messageId, botToken)
return discordRest:getChannelMessage(channelId, messageId, botToken)
end)
--- Get messages from a channel.
-- @function getChannelMessages
-- @param channelId The ID of the channel.
-- @param options Options to tailor the query.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:getChannelMessages("[channel ID]", {limit = 1}, "[bot token]"):next(function(messages) ... end)
-- @see https://discord.com/developers/docs/resources/channel#get-channel-messages
exports("getChannelMessages", function(channelId, options, botToken)
return discordRest:getChannelMessages(channelId, options, botToken)
end)
--- Returns all pinned messages in the channel.
-- @function getPinnedMessages
-- @param channelId The ID of the channel to get pinned messages from.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which resolves with a list of pinned messages.
-- @usage exports.discord_rest:getPinnedMessages("[channel ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#get-pinned-messages
exports("getPinnedMessages", function(channelId, botToken)
return discordRest:getPinnedMessages(channelId, botToken)
end)
--- Get a list of users that reacted to a message with a specific emoji.
-- @function getReactions
-- @param channelId The ID of the channel containing the message.
-- @param messageId The ID of the message to get reactions from.
-- @param emoji The emoji of the reaction.
-- @param options Options to tailor the query.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:getReactions("[channel ID]", "[message ID]", "💗", nil, "[bot token]"):next(function(users) ... end)
-- @see https://discord.com/developers/docs/resources/channel#get-reactions
exports("getReactions", function(channelId, messageId, emoji, options, botToken)
return discordRest:getReactions(channelId, messageId, emoji, options, botToken)
end)
--- Adds a recipient to a Group DM using their access token.
-- @function groupDmAddRecipient
-- @param channelId The ID of the group DM channel.
-- @param userId The ID of the user to add.
-- @param params Parameters for adding the user.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:groupDmAddRecipient("[channel ID]", "[user ID]", {access_token = "..."}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#group-dm-add-recipient
exports("groupDmAddRecipient", function(channelId, userId, params, botToken)
return discordRest:groupDmAddRecipient(channelId, userId, params, botToken)
end)
--- Removes a recipient from a Group DM.
-- @function groupDmRemoveRecipient
-- @param channelId The ID of the group DM channel.
-- @param userId The ID of the user to remove.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:groupDmRemoveRecipient("[channel ID]", "[user ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#group-dm-remove-recipient
exports("groupDmRemoveRecipient", function(channelId, userId, botToken)
return discordRest:groupDmRemoveRecipient(channelId, userId, botToken)
end)
--- Adds the current user to a thread.
-- @function joinThread
-- @param channelId The ID of the thread channel to join.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:joinThread("[channel ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#join-thread
exports("joinThread", function(channelId, botToken)
return discordRest:joinThread(channelId, botToken)
end)
--- Removes the current user from a thread.
-- @function leaveThread
-- @param channelId The ID of the thread channel to leave.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:leaveThread("[channel ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#leave-thread
exports("leaveThread", function(channelId, botToken)
return discordRest:leaveThread(channelId, botToken)
end)
--- Returns all active threads in the channel, including public and private threads.
-- @function listActiveThreads
-- @param channelId The ID of the channel to get a list of active threads for.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with a list of information on active threads.
-- @usage exports.discord_rest:listActiveThreads("[channel ID]"):next(function(data) ... end)
-- @see https://discord.com/developers/docs/resources/channel#list-active-threads
exports("listActiveThreads", function(channelId, botToken)
return discordRest:listActiveThreads(channelId, botToken)
end)
--- Returns archived threads in the channel that are private, and the user has joined.
-- @function listJoinedPrivateArchivedThreads
-- @param channelId The ID of the channel to get a list of private archived threads from.
-- @param options Options for the query.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with a table of information on private archived threads.
-- @usage exports.discord_rest:listJoinedPrivateArchivedThreads("[channel ID]", {limit = 5}, "[bot token]"):next(function(data) ... end)
-- @see https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads
exports("listJoinedPrivateArchivedThreads", function(channelId, options, botToken)
return discordRest:listJoinedPrivateArchivedThreads(channelId, options, botToken)
end)
--- Returns archived threads in the channel that are private.
-- @function listPrivateArchivedThreads
-- @param channelId The ID of the channel to get a list of private archived threads from.
-- @param options Options for the query.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with a table of information on private archived threads.
-- @usage exports.discord_rest:listPrivateArchivedThreads("[channel ID]", {limit = 5}, "[bot token]"):next(function(data) ... end)
-- @see https://discord.com/developers/docs/resources/channel#list-private-archived-threads
exports("listPrivateArchivedThreads", function(channelId, options, botToken)
return discordRest:listPrivateArchivedThreads(channelId, options, botToken)
end)
--- Returns archived threads in the channel that are public.
-- @function listPublicArchivedThreads
-- @param channelId The ID of the channel to get a list of public archived threads for.
-- @param options Options for the query.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with a table of information on public archived threads.
-- @usage exports.discord_rest:listPublicArchivedThreads("[channel ID]", {limit = 5}, "[bot token]"):next(function(data) ... end)
-- @see https://discord.com/developers/docs/resources/channel#list-public-archived-threads
exports("listPublicArchivedThreads", function(channelId, options, botToken)
return discordRest:listPublicArchivedThreads(channelId, options, botToken)
end)
--- Get a list of members of a thread.
-- @function listThreadMembers
-- @param channelId The ID of the thread channel.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with a list of members of the thread.
-- @usage exports.discord_rest:listThreadMembers("[channel ID]", "[bot token]"):next(function(members) ... end)
-- @see https://discord.com/developers/docs/resources/channel#list-thread-members
exports("listThreadMembers", function(channelId, botToken)
return discordRest:listThreadMembers(channelId, botToken)
end)
--- Update a channel's settings.
-- @function modifyChannel
-- @param channelId The ID of the channel.
-- @param channel The new channel settings.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:modifyChannel("[channel ID]", {name = "new-name"}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#modify-channel
exports("modifyChannel", function(channelId, channel, botToken)
return discordRest:modifyChannel(channelId, channel, botToken)
end)
--- Pin a message in a channel.
-- @function pinMessage
-- @param channelId The ID of the channel containing the message.
-- @param messageId The ID of the message to pin.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:pinMessage("[channel ID]", "[message ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#pin-message
exports("pinMessage", function(channelId, messageId, botToken)
return discordRest:pinMessage(channelId, messageId, botToken)
end)
--- Removes another member from a thread.
-- @function removeThreadMember
-- @param channelId The ID of the thread channel.
-- @param userId The ID of the user to remove from the thread.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:removeThreadMember("[channel ID]", "[user ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#remove-thread-member
exports("removeThreadMember", function(channelId, userId, botToken)
return discordRest:removeThreadMember(channelId, userId, botToken)
end)
--- Creates a new thread from an existing message.
-- @function startThreadWithMessage
-- @param channelId The ID of the channel containing the message.
-- @param messageId The ID of the message to start the thread from.
-- @param params Parameters for the thread.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise that resolves with the new thread channel.
-- @usage exports.discord_rest:startThreadWithMessage("[channel ID]", "[message ID]", {name = "New thread"}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#start-thread-with-message
exports("startThreadWithMessage", function(channelId, messageId, params, botToken)
return discordRest:startThreadWithMessage(channelId, messageId, params, botToken)
end)
--- Creates a new thread that is not connected to an existing message.
-- @function startThreadWithoutMessage
-- @param channelId The ID of the channel to create the thread in.
-- @param params Parameters for the thread.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise that resolves with the new thread channel.
-- @usage exports.discord_rest:startThreadWithoutMessage("[channel ID]", {name = "New thread"}, "[bot token]"):next(function(channel) ... end)
-- @see https://discord.com/developers/docs/resources/channel#start-thread-without-message
exports("startThreadWithoutMessage", function(channelId, params, botToken)
return discordRest:startThreadWithoutMessage(channelId, params, botToken)
end)
--- Post a typing indicator for the specified channel.
-- @function triggerTypingIndicator
-- @param channelId The ID of the channel to show the typing indicator in.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:triggerTypingIndicator("[channel ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#trigger-typing-indicator
exports("triggerTypingIndicator", function(channelId, botToken)
return discordRest:triggerTypingIndicator(channelId, botToken)
end)
--- Unpin a message in a channel.
-- @function unpinMessage
-- @param channelId The ID of the channel containing the message.
-- @param messageId The ID of the message to unpin.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:unpinMessage("[channel ID]", "[message ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/channel#unpin-message
exports("unpinMessage", function(channelId, messageId, botToken)
return discordRest:unpinMessage(channelId, messageId, botToken)
end)
--- Emoji
-- @section emoji
--- Create a new emoji for the guild.
-- @function createGuildEmoji
-- @param guildId The ID of the guild to create the emoji for.
-- @param params Parameters for the new emoji.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise whih is resolved with the new emoji.
-- @usage exports.discord_rest:createGuildEmoji("[guild ID]", {name = "emojiname", image = "data:image/jpeg;base64,..."}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/emoji#create-guild-emoji
exports("createGuildEmoji", function(guildId, params, botToken)
return discordRest:createGuildEmoji(guildId, params, botToken)
end)
--- Delete the given emoji.
-- @function deleteGuildEmoji
-- @param guildId The ID of the guild to delete the emoji from.
-- @param emojiId The ID of the emoji to delete.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:deleteGuildEmoji("[guild ID]", "[emoji ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/emoji#delete-guild-emoji
exports("deleteGuildEmoji", function(guildId, emojiId, botToken)
return discordRest:deleteGuildEmoji(guildId, emojiId, botToken)
end)
--- Get information on a guild emoji.
-- @function getGuildEmoji
-- @param guildId The ID of the guild where the emoji is from.
-- @param emojiId The ID of the emoji to get information about.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the information about the emoji.
-- @usage exports.discord_rest:getGuildEmoji("[guild ID]", "[emoji ID]"):next(function(emoji) ... end)
-- @see https://discord.com/developers/docs/resources/emoji#get-guild-emoji
exports("getGuildEmoji", function(guildId, emojiId, botToken)
return discordRest:getGuildEmoji(guildId, emojiId, botToken)
end)
--- Return a list of emoji for the given guild.
-- @function listGuildEmojis
-- @param guildId The ID of the guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the list of emoji.
-- @usage exports.discord_rest:listGuildEmojis("[guild ID]", "[bot token]"):next(function(emojis) ... end)
-- @see https://discord.com/developers/docs/resources/emoji#list-guild-emojis
exports("listGuildEmojis", function(guildId, botToken)
return discordRest:listGuildEmojis(guildId, botToken)
end)
--- Modify the given emoji.
-- @function modifyGuildEmoji
-- @param guildId The ID of the guild where the emoji is from.
-- @param emojiId The ID of the emoji to modify.
-- @param params Modified parameters for the emoji.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the updated emoji.
-- @usage exports.discord_rest:modifyGuildEmoji("[guild ID]", "[emoji ID]", {name = "newemojiname"}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/emoji#modify-guild-emoji
exports("modifyGuildEmoji", function(guildId, emojiId, params, botToken)
return discordRest:modifyGuildEmoji(guildId, emojiId, params, botToken)
end)
--- Guild
-- @section guild
--- Adds a user to the guild.
-- @function addGuildMember
-- @param guildId The ID of the guild to add the user to.
-- @param userId The ID of the user to add to the guild.
-- @param param Parameters for adding the user.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:addGuildMember("[guild ID]", "[user ID]", {access_token = "..."}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#add-guild-member
exports("addGuildMember", function(guildId, userId, params, botToken)
return discordRest:addGuildMember(guildId, userId, params, botToken)
end)
--- Adds a role to a guild member.
-- @function addGuildMemberRole
-- @param guildId The ID of the guild.
-- @param userId The ID of the user to add the role to.
-- @param roleId The ID of the role to add to the member.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:addGuildMemberRole("[guild ID]", "[user ID]", "[role ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#add-guild-member-role
exports("addGuildMemberRole", function(guildId, userId, roleId, botToken)
return discordRest:addGuildMemberRole(guildId, userId, roleId, botToken)
end)
--- Begin a prune operation.
-- @function beginGuildPrune
-- @param guildId The ID of the guild to prune.
-- @param params Parameters for pruning.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the number of members that were pruned.
-- @usage exports.discord_rest:beginGuildPrune("[guild ID]", nil, "[bot token]"):next(function(pruned) ... end)
-- @see https://discord.com/developers/docs/resources/guild#begin-guild-prune
exports("beginGuildPrune", function(guildId, params, botToken)
return discordRest:beginGuildPrune(guildId, params, botToken)
end)
--- Create a new guild.
-- @function createGuild
-- @param params Parameters for the new guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the new guild.
-- @usage exports.discord_rest:createGuild({name = "My Guild"})
-- @see https://discord.com/developers/docs/resources/guild#create-guild
exports("createGuild", function(params, botToken)
return discordRest:createGuild(params, botToken)
end)
--- Create a guild ban, and optionally delete previous messages sent by the banned user.
-- @function createGuildBan
-- @param guildId The ID of the guild to create the ban for.
-- @param userId The ID of the user to ban.
-- @param params Parameters for the ban.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:createGuildBan("[guild ID]", "[user ID]", {reason = "Not following the rules"}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#create-guild-ban
exports("createGuildBan", function(guildId, userId, params, botToken)
return discordRest:createGuildBan(guildId, userId, params, botToken)
end)
--- Create a new guild channel.
-- @function createGuildChannel
-- @param guildId The ID of the guild to create the channel in.
-- @param params Parameters for the new channel.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the new channel.
-- @usage exports.discord_rest:createGuildChannel(["guild ID"], {name = "new-channel"}, "[bot token]"):next(function(channel) ... end)
-- @see https://discord.com/developers/docs/resources/guild#create-guild-channel
exports("createGuildChannel", function(guildId, params, botToken)
return discordRest:createGuildChannel(guildId, params, botToken)
end)
--- Create a new role for the guild.
-- @function createGuildRole
-- @param guildId The ID of the guild.
-- @param params Parameters for the new role.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the new role.
-- @usage exports.discord_rest:createGuildRole("[guild ID]", {name = "Moderator", ...}, "[bot token]"):next(function(role) ... end)
-- @see https://discord.com/developers/docs/resources/guild#create-guild-role
exports("createGuildRole", function(guildId, params, botToken)
return discordRest:createGuildRole(guildId, params, botToken)
end)
--- Delete a guild permanently.
-- @function deleteGuild
-- @param guildId The ID of the guild to delete.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:deleteGuild("[guild ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#delete-guild
exports("deleteGuild", function(guildId, botToken)
return discordRest:deleteGuild(guildId, botToken)
end)
--- Delete an integration for a guild.
-- @function deleteGuildIntegration
-- @param guildId The ID of the guild
-- @param integrationId The ID of the integration to delete.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:deleteGuildIntegration("[guild ID]", "[integration ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#delete-guild-integration
exports("deleteGuildIntegration", function(guildId, integrationId, botToken)
return discordRest:deleteGuildIntegration(guildId, integrationId, botToken)
end)
--- Delete a guild role.
-- @function deleteGuildRole
-- @param guildId The ID of the guild.
-- @param roleId The ID of the role that will be deleted.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:deleteGuildRole("[guild ID]", "[role ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#delete-guild-role
exports("deleteGuildRole", function(guildId, roleId, botToken)
return discordRest:deleteGuildRole(guildId, roleId, botToken)
end)
--- Get info for a given guild.
-- @function getGuild
-- @param guildId The ID of the guild.
-- @param withCounts Whether to include approximate member and presence counts in the returned info.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the guild info.
-- @usage exports.discord_rest:getGuild("[guild ID]"):next(function(guild) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild
exports("getGuild", function(guildId, withCounts, botToken)
return discordRest:getGuild(guildId, withCounts, botTokens)
end)
--- Return info on a ban for a specific user in a guild.
-- @function getGuildBan
-- @param guildId The ID of the guild.
-- @param userId The ID of the banned user.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the ban info.
-- @usage exports.discord_rest:getGuildBan("[guild ID]", "[user ID]", "[bot token]"):next(function(ban) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-ban
exports("getGuildBan", function(guildId, userId, botToken)
return discordRest:getGuildBan(guildId, userId, botToken)
end)
--- Get a list of bans for a guild.
-- @function getGuildBans
-- @param guildId The ID of the guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with a list of bans.
-- @usage exports.discord_get:getGuildBans("[guild ID]", "[bot token]"):next(function(bans) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-bans
exports("getGuildBans", function(guildId, botToken)
return discordRest:getGuildBans(guildId, botToken)
end)
--- Get a list of guild channels.
-- @function getGuildChannels
-- @param guildId The ID of the guild to get a list of channels for.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the list of channels.
-- @usage exports.discord_rest:getGuildChannels("[guild ID]", "[bot token]"):next(function(channels) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-channels
exports("getGuildChannels", function(guildId, botToken)
return discordRest:getGuildChannels(guildId, botToken)
end)
--- Get a list of integrations for a guild.
-- @function getGuildIntegrations
-- @param guildId The ID of the guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the list of integrations.
-- @usage exports.discord_rest:getGuildIntegrations("[guild ID]", "[bot token]"):next(function(integrations) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-integrations
exports("getGuildIntegrations", function(guildId, botToken)
return discordRest:getGuildIntegrations(guildId, botToken)
end)
--- Get a list of invites for a guild.
-- @function getGuildInvites
-- @param guildId The ID of the guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the list of invites.
-- @usage exports.discord_rest:getGuildInvites("[guild ID]", "[bot token]"):next(function(invites) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-invites
exports("getGuildInvites", function(guildId, botToken)
return discordRest:getGuildInvites(guildId, botToken)
end)
--- Get info for a member of a guild.
-- @function getGuildMember
-- @param guildId The ID of the guild.
-- @param userId The ID of the user.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise that resolves with the info of the member if they are in the guild.
-- @usage exports.discord_rest:getGuildMember("[guild ID]", "[user ID]", "[bot token]"):next(function(member) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-member
exports("getGuildMember", function(guildId, userId, botToken)
return discordRest:getGuildMember(guildId, userId, botToken)
end)
--- Get preview information for a guild.
-- @function getGuildPreview
-- @param guildId The ID of the guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the preview info for the guild.
-- @usage exports.discord_rest:getGuildPreview("[guild ID]", "[bot token]"):next(function(preview) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-preview
exports("getGuildPreview", function(guildId, botToken)
return discordRest:getGuildPreview(guildId, botToken)
end)
--- Get the number of members that would be removed in a prune operation.
-- @function getGuildPruneCount
-- @param guildId The ID of the guild that would be pruned.
-- @param options Options for the query.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the number of users that would be pruned.
-- @usage exports.discord_rest:getGuildPruneCount("[guild ID]", nil, "[bot token]"):next(function(pruned) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-prune-count
exports("getGuildPruneCount", function(guildId, options, botToken)
return discordRest:getGuildPruneCount(guildId, options, botToken)
end)
--- Get a list of roles for a guild.
-- @function getGuildRoles
-- @param guildId The ID of the guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the list of roles.
-- @usage exports.discord_rest:getGuildRoles("[guild ID]"):next(function(roles) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-roles
exports("getGuildRoles", function(guildId, botToken)
return discordRest:getGuildRoles(guildId, botToken)
end)
--- Get the vanity URL for a guild.
-- @function getGuildVanityUrl
-- @param guildId The ID of the guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the vanity URL.
-- @usage exports.discord_rest:getGuildVanityUrl("[guild ID]", "[bot token]"):next(function(vanityUrl) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-vanity-url
exports("getGuildVanityUrl", function(guildId, botToken)
return discordRest:getGuildVanityUrl(guildId, botToken)
end)
--- Get a list of voice regions for a guild.
-- @function getGuildVoiceRegions
-- @param guildId The ID of the guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the list of voice regions.
-- @usage exports.discord_rest:getGuildVoiceRegions("[guild ID]", "[bot token]"):next(function(regions) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-voice-regions
exports("getGuildVoiceRegions", function(guildId, botToken)
return discordRest:getGuildVoiceRegions(guildId, botToken)
end)
--- Get the welcome screen for a guild.
-- @function getGuildWelcomeScreen
-- @param guildId The ID of the guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the welcome screen.
-- @usage exports.discord_rest:getGuildWelcomeScreen("[guild ID]", "[bot token]"):next(function(welcomeScreen) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen
exports("getGuildWelcomeScreen", function(guildId, botToken)
return discordRest:getGuildWelcomeScreen(guildId, botToken)
end)
--- Get the widget for a guild.
-- @function getGuildWidget
-- @param guildId The ID of the guild.
-- @return A new promise which is resolved with the widget.
-- @usage exports.discord_rest:getGuildWidget("[guild ID]"):next(function(widget) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-widget
exports("getGuildWidget", function(guildId)
return discordRest:getGuildWidget(guildId)
end)
--[[
This method can't be implemented as PerformHttpRequest does not work with binary data.
--- Get the widget image for a guild.
-- @function getGuildWidgetImage
-- @param guildId The ID of the guild.
-- @param style Style of the widget image returned.
-- @return A new promise which is resolved with the widget image.
-- @usage exports.discord_rest:getGuildWidgetImage("[guild ID]", "shield"):next(function(image) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-widget-image
exports("getGuildWidgetImage", function(guildId, style)
return discordRest:getGuildWidgetImage(guildId, style)
end)
]]
--- Get guild widget settings.
-- @function getGuildWidgetSettings
-- @param guildId The ID of the guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the widget settings.
-- @usage exports.discord_rest:getGuildWidgetSettings("[guild ID]", "[bot token]"):next(function(settings) ... end)
-- @see https://discord.com/developers/docs/resources/guild#get-guild-widget-settings
exports("getGuildWidgetSettings", function(guildId, botToken)
return discordRest:getGuildWidgetSettings(guildId, botToken)
end)
--- Returns all active threads in the guild, including public and private threads.
-- @function listActiveGuildThreads
-- @param guildId The ID of the guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the lists of threads and thread members.
-- @usage exports.discord_rest:listActiveGuildThreads("[guild ID]", "[bot token]"):next(function(data) ... end)
-- @see https://discord.com/developers/docs/resources/guild#list-active-threads
exports("listActiveGuildThreads", function(guildId, botToken)
return discordRest:listActiveGuildThreads(guildId, botToken)
end)
--- Get a list of members in a guild.
-- @function listGuildMembers
-- @param guildId The ID of the guild to get a list of members for.
-- @param options Options for the query.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with a list of guild members.
-- @usage exports.discord_rest:listGuildMembers("[guild ID]", {limit = 5}, "[bot token]"):next(function(members) ... end)
-- @see https://discord.com/developers/docs/resources/guild#list-guild-members
exports("listGuildMembers", function(guildId, options, botToken)
return discordRest:listGuildMembers(guildId, options, botToken)
end)
--- Modifies the nickname of the current user in a guild.
-- @function modifyCurrentUserNick
-- @param guildId The ID of the guild.
-- @param nick The value to set the user's nickname to.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:modifyCurrentUserNick("[guild ID]", "New nickname")
-- @see https://discord.com/developers/docs/resources/guild#modify-current-user-nick
exports("modifyCurrentUserNick", function(guildId, nick, botToken)
return discordRest:modifyCurrentUserNick(guildId, nick, botToken)
end)
--- Updates the current user's voice state.
-- @function modifyCurrentUserVoiceState
-- @param guildId The ID of the guild to modify voice state in.
-- @param params Parameters for modifying the voice state.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:modifyCurrentUserVoiceState("[guild ID]", {...}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state
exports("modifyCurrentUserVoiceState", function(guildId, params, botToken)
return discordRest:modifyCurrentUserVoiceState(guildId, params, botToken)
end)
--- Modify a guild's settings.
-- @function modifyGuild
-- @param guildId The ID of the guild to modify.
-- @param settings The modified settings for the guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the updated guild.
-- @usage exports.discord_rest:modifyGuild("[guild ID]", {name = "New guild name"}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#modify-guild
exports("modifyGuild", function(guildId, settings, botToken)
return discordRest:modifyGuild(guildId, settings, botToken)
end)
--- Modify the positions of a set of channels.
-- @function modifyGuildChannelPositions
-- @param guildId The ID of the guild containing the channels.
-- @param channelPositions A set of channel position parameters.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:modifyGuildChannelPositions("[guild ID]", {{id = "[channel 1 ID]", position = 2}, {"[channel 2 ID]", position = 1}}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#modify-guild-channel-positions
exports("modifyGuildChannelPositions", function(guildId, channelPositions, botToken)
return discordRest:modifyGuildChannelPositions(guildId, channelPositions, botToken)
end)
--- Modify attributes of a guild member.
-- @function modifyGuildMember
-- @param guildId The ID of the guild.
-- @param userId The ID of the member to modify.
-- @param params The parameters to modify.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the modified guild member.
-- @usage exports.discord_rest:modifyGuildMember("[guild ID]", "[user ID]", {nick = "New nickname"}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#modify-guild-member
exports("modifyGuildMember", function(guildId, userId, params, botToken)
return discordRest:modifyGuildMember(guildId, userId, params, botToken)
end)
--- Modify a guild role.
-- @function modifyGuildRole
-- @param guildId The ID of the guild.
-- @param roleId The ID of the role to modify.
-- @param params Parameters for modifications to the role.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the modified role.
-- @usage exports.discord_rest:modifyGuildRole("[guild ID]", "[role ID]", {name = "New role name"}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#modify-guild-role
exports("modifyGuildRole", function(guildId, roleId, params, botToken)
return discordRest:modifyGuildRole(guildId, roleId, params, botToken)
end)
--- Modify the positions of a set of roles for a guild.
-- @function modifyGuildRolePositions
-- @param guildId The ID of the guild.
-- @param params A list of roles and their new positions.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with a list of all guild roles.
-- @usage exports.discord_rest:modifyGuildRolePositions("[guild ID]", {{"[role ID 1]", 2}, {"[role ID 2]", 3}, ...}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#modify-guild-role-positions
exports("modifyGuildRolePositions", function(guildId, params, botToken)
return discordRest:modifyGuildRolePositions(guildId, params, botToken)
end)
--- Modify a guild's welcome screen.
-- @function modifyGuildWelcomeScreen
-- @param guildId The ID of the guild.
-- @param params Parameters for modifying the welcome screen.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the updated welcome screen.
-- @usage exports.discord_rest:modifyGuildWelcomeScreen("[guild ID]", {enabled = true}, "[bot token]"):next(function(welcomeScreen) ... end)
-- @see https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen
exports("modifyGuildWelcomeScreen", function(guildId, params, botToken)
return discordRest:modifyGuildWelcomeScreen(guildId, params, botToken)
end)
--- Modify a guild widget.
-- @function modifyGuildWidget
-- @param guildId The ID of the guild.
-- @param widget The modified widget attributes.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise which is resolved with the updated widget.
-- @usage exports.discord_rest:modifyGuildWidget("[guild ID]", {...}, "[bot token]"):next(function(widget) ... end)
-- @see https://discord.com/developers/docs/resources/guild#modify-guild-widget
exports("modifyGuildWidget", function(guildId, widget, botToken)
return discordRest:modifyGuildWidget(guildId, widget, botToken)
end)
--- Updates another user's voice state.
-- @function modifyUserVoiceState
-- @param guildId The ID of the guild.
-- @param userId The ID of the user.
-- @param params Parameters for modifying the voice state.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:modifyUserVoiceState("[guild ID]", "[user ID]", {...}, "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#modify-user-voice-state
exports("modifyUserVoiceState", function(guildId, userId, params, botToken)
return discordRest:modifyUserVoiceState(guildId, userId, params, botToken)
end)
--- Remove the ban for a user.
-- @function removeGuildBan
-- @param guildId The ID of the guild to remove the ban for the user from.
-- @param userId The ID of the user to unban.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:removeGuildBan("[guild ID]", "[user ID]", "[bot token]")
-- @see https://discord.com/developers/docs/resources/guild#remove-guild-ban
exports("removeGuildBan", function(guildId, userId, botToken)
return discordRest:removeGuildBan(guildId, userId, botToken)
end)
--- Remove a member from a guild.
-- @function removeGuildMember
-- @param guildId The ID of the guild to remove the member from.
-- @param userId The ID of the member to remove from the guild.
-- @param botToken Optional bot token to use for authorization.
-- @return A new promise.
-- @usage exports.discord_rest:removeGuildMember("[guild ID]", "[user ID]", "[bot token]")