@discordjs/core 2.2.2 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/http-only.d.mts +379 -44
- package/dist/http-only.d.ts +379 -44
- package/dist/http-only.js +447 -261
- package/dist/http-only.js.map +1 -1
- package/dist/http-only.mjs +438 -254
- package/dist/http-only.mjs.map +1 -1
- package/dist/index.d.mts +424 -44
- package/dist/index.d.ts +424 -44
- package/dist/index.js +562 -282
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +545 -268
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -753,17 +753,91 @@ var ChannelsAPI = class {
|
|
|
753
753
|
signal
|
|
754
754
|
});
|
|
755
755
|
}
|
|
756
|
+
/**
|
|
757
|
+
* Sends a soundboard sound in a channel
|
|
758
|
+
*
|
|
759
|
+
* @see {@link https://discord.com/developers/docs/resources/soundboard#send-soundboard-sound}
|
|
760
|
+
* @param channelId - The id of the channel to send the soundboard sound in
|
|
761
|
+
* @param body - The data for sending the soundboard sound
|
|
762
|
+
* @param options - The options for sending the soundboard sound
|
|
763
|
+
*/
|
|
764
|
+
async sendSoundboardSound(channelId, body, { signal } = {}) {
|
|
765
|
+
return this.rest.post(Routes3.sendSoundboardSound(channelId), {
|
|
766
|
+
body,
|
|
767
|
+
signal
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Adds a recipient to a group DM channel
|
|
772
|
+
*
|
|
773
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#group-dm-add-recipient}
|
|
774
|
+
* @param channelId - The id of the channel to add the recipient to
|
|
775
|
+
* @param userId - The id of the user to add as a recipient
|
|
776
|
+
* @param body - The data for adding the recipient
|
|
777
|
+
* @param options - The options for adding the recipient
|
|
778
|
+
*/
|
|
779
|
+
async addGroupDMRecipient(channelId, userId, body, { signal } = {}) {
|
|
780
|
+
await this.rest.put(Routes3.channelRecipient(channelId, userId), {
|
|
781
|
+
body,
|
|
782
|
+
signal
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* Removes a recipient from a group DM channel
|
|
787
|
+
*
|
|
788
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#group-dm-remove-recipient}
|
|
789
|
+
* @param channelId - The id of the channel to remove the recipient from
|
|
790
|
+
* @param userId - The id of the user to remove as a recipient
|
|
791
|
+
* @param options - The options for removing the recipient
|
|
792
|
+
*/
|
|
793
|
+
async removeGroupDMRecipient(channelId, userId, { signal } = {}) {
|
|
794
|
+
await this.rest.delete(Routes3.channelRecipient(channelId, userId), {
|
|
795
|
+
signal
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
// src/api/gateway.ts
|
|
801
|
+
import { Routes as Routes4 } from "discord-api-types/v10";
|
|
802
|
+
var GatewayAPI = class {
|
|
803
|
+
constructor(rest) {
|
|
804
|
+
this.rest = rest;
|
|
805
|
+
}
|
|
806
|
+
static {
|
|
807
|
+
__name(this, "GatewayAPI");
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Gets gateway information.
|
|
811
|
+
*
|
|
812
|
+
* @see {@link https://discord.com/developers/docs/events/gateway#get-gateway}
|
|
813
|
+
* @param options - The options for fetching the gateway information
|
|
814
|
+
*/
|
|
815
|
+
async get({ signal } = {}) {
|
|
816
|
+
return this.rest.get(Routes4.gateway(), {
|
|
817
|
+
auth: false,
|
|
818
|
+
signal
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Gets gateway information with additional metadata.
|
|
823
|
+
*
|
|
824
|
+
* @see {@link https://discord.com/developers/docs/events/gateway#get-gateway-bot}
|
|
825
|
+
* @param options - The options for fetching the gateway information
|
|
826
|
+
*/
|
|
827
|
+
async getBot({ signal } = {}) {
|
|
828
|
+
return this.rest.get(Routes4.gatewayBot(), { signal });
|
|
829
|
+
}
|
|
756
830
|
};
|
|
757
831
|
|
|
758
832
|
// src/api/guild.ts
|
|
759
833
|
import { makeURLSearchParams as makeURLSearchParams3 } from "@discordjs/rest";
|
|
760
834
|
import {
|
|
761
|
-
Routes as
|
|
835
|
+
Routes as Routes6
|
|
762
836
|
} from "discord-api-types/v10";
|
|
763
837
|
|
|
764
838
|
// src/api/voice.ts
|
|
765
839
|
import {
|
|
766
|
-
Routes as
|
|
840
|
+
Routes as Routes5
|
|
767
841
|
} from "discord-api-types/v10";
|
|
768
842
|
var VoiceAPI = class {
|
|
769
843
|
constructor(rest) {
|
|
@@ -779,7 +853,7 @@ var VoiceAPI = class {
|
|
|
779
853
|
* @param options - The options for fetching the voice regions
|
|
780
854
|
*/
|
|
781
855
|
async getVoiceRegions({ signal } = {}) {
|
|
782
|
-
return this.rest.get(
|
|
856
|
+
return this.rest.get(Routes5.voiceRegions(), { signal });
|
|
783
857
|
}
|
|
784
858
|
/**
|
|
785
859
|
* Fetches voice state of a user by their id
|
|
@@ -788,7 +862,7 @@ var VoiceAPI = class {
|
|
|
788
862
|
* @param options - The options for fetching user voice state
|
|
789
863
|
*/
|
|
790
864
|
async getUserVoiceState(guildId, userId, { signal } = {}) {
|
|
791
|
-
return this.rest.get(
|
|
865
|
+
return this.rest.get(Routes5.guildVoiceState(guildId, userId), {
|
|
792
866
|
signal
|
|
793
867
|
});
|
|
794
868
|
}
|
|
@@ -799,7 +873,7 @@ var VoiceAPI = class {
|
|
|
799
873
|
* @param options - The options for fetching user voice state
|
|
800
874
|
*/
|
|
801
875
|
async getVoiceState(guildId, { signal } = {}) {
|
|
802
|
-
return this.rest.get(
|
|
876
|
+
return this.rest.get(Routes5.guildVoiceState(guildId, "@me"), {
|
|
803
877
|
signal
|
|
804
878
|
});
|
|
805
879
|
}
|
|
@@ -813,7 +887,7 @@ var VoiceAPI = class {
|
|
|
813
887
|
* @param options - The options for editing the voice state
|
|
814
888
|
*/
|
|
815
889
|
async editUserVoiceState(guildId, userId, body, { reason, signal } = {}) {
|
|
816
|
-
return this.rest.patch(
|
|
890
|
+
return this.rest.patch(Routes5.guildVoiceState(guildId, userId), {
|
|
817
891
|
reason,
|
|
818
892
|
body,
|
|
819
893
|
signal
|
|
@@ -828,7 +902,7 @@ var VoiceAPI = class {
|
|
|
828
902
|
* @param options - The options for editing the voice state
|
|
829
903
|
*/
|
|
830
904
|
async editVoiceState(guildId, body = {}, { signal } = {}) {
|
|
831
|
-
return this.rest.patch(
|
|
905
|
+
return this.rest.patch(Routes5.guildVoiceState(guildId, "@me"), {
|
|
832
906
|
body,
|
|
833
907
|
signal
|
|
834
908
|
});
|
|
@@ -850,7 +924,7 @@ var GuildsAPI = class {
|
|
|
850
924
|
if ("with_counts" in queryOrOptions) {
|
|
851
925
|
requestData.query = makeURLSearchParams3(queryOrOptions);
|
|
852
926
|
}
|
|
853
|
-
return this.rest.get(
|
|
927
|
+
return this.rest.get(Routes6.guild(guildId), requestData);
|
|
854
928
|
}
|
|
855
929
|
/**
|
|
856
930
|
* Fetches a guild preview
|
|
@@ -860,7 +934,7 @@ var GuildsAPI = class {
|
|
|
860
934
|
* @param options - The options for fetching the guild preview
|
|
861
935
|
*/
|
|
862
936
|
async getPreview(guildId, { signal } = {}) {
|
|
863
|
-
return this.rest.get(
|
|
937
|
+
return this.rest.get(Routes6.guildPreview(guildId), {
|
|
864
938
|
signal
|
|
865
939
|
});
|
|
866
940
|
}
|
|
@@ -873,7 +947,7 @@ var GuildsAPI = class {
|
|
|
873
947
|
* @deprecated API related to guild ownership may no longer be used.
|
|
874
948
|
*/
|
|
875
949
|
async create(body, { signal } = {}) {
|
|
876
|
-
return this.rest.post(
|
|
950
|
+
return this.rest.post(Routes6.guilds(), { body, signal });
|
|
877
951
|
}
|
|
878
952
|
/**
|
|
879
953
|
* Edits a guild
|
|
@@ -884,7 +958,7 @@ var GuildsAPI = class {
|
|
|
884
958
|
* @param options - The options for editing the guild
|
|
885
959
|
*/
|
|
886
960
|
async edit(guildId, body, { reason, signal } = {}) {
|
|
887
|
-
return this.rest.patch(
|
|
961
|
+
return this.rest.patch(Routes6.guild(guildId), {
|
|
888
962
|
reason,
|
|
889
963
|
body,
|
|
890
964
|
signal
|
|
@@ -899,7 +973,7 @@ var GuildsAPI = class {
|
|
|
899
973
|
* @deprecated API related to guild ownership may no longer be used.
|
|
900
974
|
*/
|
|
901
975
|
async delete(guildId, { signal } = {}) {
|
|
902
|
-
await this.rest.delete(
|
|
976
|
+
await this.rest.delete(Routes6.guild(guildId), { signal });
|
|
903
977
|
}
|
|
904
978
|
/**
|
|
905
979
|
* Adds user to the guild
|
|
@@ -911,13 +985,13 @@ var GuildsAPI = class {
|
|
|
911
985
|
* @param options - The options for adding users to the guild
|
|
912
986
|
*/
|
|
913
987
|
async addMember(guildId, userId, body, { signal } = {}) {
|
|
914
|
-
return this.rest.put(
|
|
988
|
+
return this.rest.put(Routes6.guildMember(guildId, userId), {
|
|
915
989
|
body,
|
|
916
990
|
signal
|
|
917
991
|
});
|
|
918
992
|
}
|
|
919
993
|
/**
|
|
920
|
-
* Fetches
|
|
994
|
+
* Fetches members of a guild.
|
|
921
995
|
*
|
|
922
996
|
* @see {@link https://discord.com/developers/docs/resources/guild#list-guild-members}
|
|
923
997
|
* @param guildId - The id of the guild
|
|
@@ -925,7 +999,7 @@ var GuildsAPI = class {
|
|
|
925
999
|
* @param options - The options for fetching the guild members
|
|
926
1000
|
*/
|
|
927
1001
|
async getMembers(guildId, query = {}, { signal } = {}) {
|
|
928
|
-
return this.rest.get(
|
|
1002
|
+
return this.rest.get(Routes6.guildMembers(guildId), {
|
|
929
1003
|
query: makeURLSearchParams3(query),
|
|
930
1004
|
signal
|
|
931
1005
|
});
|
|
@@ -938,7 +1012,7 @@ var GuildsAPI = class {
|
|
|
938
1012
|
* @param options - The options for fetching the guild channels
|
|
939
1013
|
*/
|
|
940
1014
|
async getChannels(guildId, { signal } = {}) {
|
|
941
|
-
return this.rest.get(
|
|
1015
|
+
return this.rest.get(Routes6.guildChannels(guildId), {
|
|
942
1016
|
signal
|
|
943
1017
|
});
|
|
944
1018
|
}
|
|
@@ -951,7 +1025,7 @@ var GuildsAPI = class {
|
|
|
951
1025
|
* @param options - The options for creating the guild channel
|
|
952
1026
|
*/
|
|
953
1027
|
async createChannel(guildId, body, { reason, signal } = {}) {
|
|
954
|
-
return this.rest.post(
|
|
1028
|
+
return this.rest.post(Routes6.guildChannels(guildId), {
|
|
955
1029
|
reason,
|
|
956
1030
|
body,
|
|
957
1031
|
signal
|
|
@@ -966,7 +1040,7 @@ var GuildsAPI = class {
|
|
|
966
1040
|
* @param options - The options for editing the guild channel positions
|
|
967
1041
|
*/
|
|
968
1042
|
async setChannelPositions(guildId, body, { reason, signal } = {}) {
|
|
969
|
-
await this.rest.patch(
|
|
1043
|
+
await this.rest.patch(Routes6.guildChannels(guildId), { reason, body, signal });
|
|
970
1044
|
}
|
|
971
1045
|
/**
|
|
972
1046
|
* Fetches the active threads in a guild
|
|
@@ -976,7 +1050,7 @@ var GuildsAPI = class {
|
|
|
976
1050
|
* @param options - The options for fetching the active threads
|
|
977
1051
|
*/
|
|
978
1052
|
async getActiveThreads(guildId, { signal } = {}) {
|
|
979
|
-
return this.rest.get(
|
|
1053
|
+
return this.rest.get(Routes6.guildActiveThreads(guildId), { signal });
|
|
980
1054
|
}
|
|
981
1055
|
/**
|
|
982
1056
|
* Fetches a guild member ban
|
|
@@ -987,7 +1061,7 @@ var GuildsAPI = class {
|
|
|
987
1061
|
* @param options - The options for fetching the ban
|
|
988
1062
|
*/
|
|
989
1063
|
async getMemberBan(guildId, userId, { signal } = {}) {
|
|
990
|
-
return this.rest.get(
|
|
1064
|
+
return this.rest.get(Routes6.guildBan(guildId, userId), { signal });
|
|
991
1065
|
}
|
|
992
1066
|
/**
|
|
993
1067
|
* Fetches guild member bans
|
|
@@ -998,7 +1072,7 @@ var GuildsAPI = class {
|
|
|
998
1072
|
* @param options - The options for fetching the bans
|
|
999
1073
|
*/
|
|
1000
1074
|
async getMemberBans(guildId, query = {}, { signal } = {}) {
|
|
1001
|
-
return this.rest.get(
|
|
1075
|
+
return this.rest.get(Routes6.guildBans(guildId), {
|
|
1002
1076
|
query: makeURLSearchParams3(query),
|
|
1003
1077
|
signal
|
|
1004
1078
|
});
|
|
@@ -1013,7 +1087,7 @@ var GuildsAPI = class {
|
|
|
1013
1087
|
* @param options - The options for banning the user
|
|
1014
1088
|
*/
|
|
1015
1089
|
async banUser(guildId, userId, body = {}, { reason, signal } = {}) {
|
|
1016
|
-
await this.rest.put(
|
|
1090
|
+
await this.rest.put(Routes6.guildBan(guildId, userId), { reason, body, signal });
|
|
1017
1091
|
}
|
|
1018
1092
|
/**
|
|
1019
1093
|
* Unbans a user from a guild
|
|
@@ -1024,7 +1098,7 @@ var GuildsAPI = class {
|
|
|
1024
1098
|
* @param options - The options for unbanning the user
|
|
1025
1099
|
*/
|
|
1026
1100
|
async unbanUser(guildId, userId, { reason, signal } = {}) {
|
|
1027
|
-
await this.rest.delete(
|
|
1101
|
+
await this.rest.delete(Routes6.guildBan(guildId, userId), { reason, signal });
|
|
1028
1102
|
}
|
|
1029
1103
|
/**
|
|
1030
1104
|
* Bulk ban users from a guild
|
|
@@ -1035,7 +1109,7 @@ var GuildsAPI = class {
|
|
|
1035
1109
|
* @param options - The options for bulk banning users
|
|
1036
1110
|
*/
|
|
1037
1111
|
async bulkBanUsers(guildId, body, { reason, signal } = {}) {
|
|
1038
|
-
return this.rest.post(
|
|
1112
|
+
return this.rest.post(Routes6.guildBulkBan(guildId), {
|
|
1039
1113
|
reason,
|
|
1040
1114
|
body,
|
|
1041
1115
|
signal
|
|
@@ -1049,7 +1123,7 @@ var GuildsAPI = class {
|
|
|
1049
1123
|
* @param options - The options for fetching the guild roles
|
|
1050
1124
|
*/
|
|
1051
1125
|
async getRoles(guildId, { signal } = {}) {
|
|
1052
|
-
return this.rest.get(
|
|
1126
|
+
return this.rest.get(Routes6.guildRoles(guildId), { signal });
|
|
1053
1127
|
}
|
|
1054
1128
|
/**
|
|
1055
1129
|
* Get a role in a guild
|
|
@@ -1060,7 +1134,7 @@ var GuildsAPI = class {
|
|
|
1060
1134
|
* @param options - The options for fetching the guild role
|
|
1061
1135
|
*/
|
|
1062
1136
|
async getRole(guildId, roleId, { signal } = {}) {
|
|
1063
|
-
return this.rest.get(
|
|
1137
|
+
return this.rest.get(Routes6.guildRole(guildId, roleId), { signal });
|
|
1064
1138
|
}
|
|
1065
1139
|
/**
|
|
1066
1140
|
* Creates a guild role
|
|
@@ -1071,7 +1145,7 @@ var GuildsAPI = class {
|
|
|
1071
1145
|
* @param options - The options for creating the guild role
|
|
1072
1146
|
*/
|
|
1073
1147
|
async createRole(guildId, body, { reason, signal } = {}) {
|
|
1074
|
-
return this.rest.post(
|
|
1148
|
+
return this.rest.post(Routes6.guildRoles(guildId), { reason, body, signal });
|
|
1075
1149
|
}
|
|
1076
1150
|
/**
|
|
1077
1151
|
* Sets role positions in a guild
|
|
@@ -1082,7 +1156,7 @@ var GuildsAPI = class {
|
|
|
1082
1156
|
* @param options - The options for setting role positions
|
|
1083
1157
|
*/
|
|
1084
1158
|
async setRolePositions(guildId, body, { reason, signal } = {}) {
|
|
1085
|
-
return this.rest.patch(
|
|
1159
|
+
return this.rest.patch(Routes6.guildRoles(guildId), {
|
|
1086
1160
|
reason,
|
|
1087
1161
|
body,
|
|
1088
1162
|
signal
|
|
@@ -1098,7 +1172,7 @@ var GuildsAPI = class {
|
|
|
1098
1172
|
* @param options - The options for editing the guild role
|
|
1099
1173
|
*/
|
|
1100
1174
|
async editRole(guildId, roleId, body, { reason, signal } = {}) {
|
|
1101
|
-
return this.rest.patch(
|
|
1175
|
+
return this.rest.patch(Routes6.guildRole(guildId, roleId), {
|
|
1102
1176
|
reason,
|
|
1103
1177
|
body,
|
|
1104
1178
|
signal
|
|
@@ -1113,7 +1187,7 @@ var GuildsAPI = class {
|
|
|
1113
1187
|
* @param options - The options for deleting the guild role
|
|
1114
1188
|
*/
|
|
1115
1189
|
async deleteRole(guildId, roleId, { reason, signal } = {}) {
|
|
1116
|
-
await this.rest.delete(
|
|
1190
|
+
await this.rest.delete(Routes6.guildRole(guildId, roleId), { reason, signal });
|
|
1117
1191
|
}
|
|
1118
1192
|
/**
|
|
1119
1193
|
* Edits the multi-factor-authentication (MFA) level of a guild
|
|
@@ -1125,7 +1199,7 @@ var GuildsAPI = class {
|
|
|
1125
1199
|
* @deprecated API related to guild ownership may no longer be used.
|
|
1126
1200
|
*/
|
|
1127
1201
|
async editMFALevel(guildId, level, { reason, signal } = {}) {
|
|
1128
|
-
return this.rest.post(
|
|
1202
|
+
return this.rest.post(Routes6.guildMFA(guildId), {
|
|
1129
1203
|
reason,
|
|
1130
1204
|
signal,
|
|
1131
1205
|
body: { level }
|
|
@@ -1140,7 +1214,7 @@ var GuildsAPI = class {
|
|
|
1140
1214
|
* @param options - The options for fetching the number of pruned members
|
|
1141
1215
|
*/
|
|
1142
1216
|
async getPruneCount(guildId, query = {}, { signal } = {}) {
|
|
1143
|
-
return this.rest.get(
|
|
1217
|
+
return this.rest.get(Routes6.guildPrune(guildId), {
|
|
1144
1218
|
signal,
|
|
1145
1219
|
query: makeURLSearchParams3(query)
|
|
1146
1220
|
});
|
|
@@ -1154,7 +1228,7 @@ var GuildsAPI = class {
|
|
|
1154
1228
|
* @param options - The options for initiating the prune
|
|
1155
1229
|
*/
|
|
1156
1230
|
async beginPrune(guildId, body = {}, { reason, signal } = {}) {
|
|
1157
|
-
return this.rest.post(
|
|
1231
|
+
return this.rest.post(Routes6.guildPrune(guildId), {
|
|
1158
1232
|
body,
|
|
1159
1233
|
reason,
|
|
1160
1234
|
signal
|
|
@@ -1168,7 +1242,7 @@ var GuildsAPI = class {
|
|
|
1168
1242
|
* @param options - The options for fetching the voice regions
|
|
1169
1243
|
*/
|
|
1170
1244
|
async getVoiceRegions(guildId, { signal } = {}) {
|
|
1171
|
-
return this.rest.get(
|
|
1245
|
+
return this.rest.get(Routes6.guildVoiceRegions(guildId), { signal });
|
|
1172
1246
|
}
|
|
1173
1247
|
/**
|
|
1174
1248
|
* Fetches the invites for a guild
|
|
@@ -1178,7 +1252,7 @@ var GuildsAPI = class {
|
|
|
1178
1252
|
* @param options - The options for fetching the invites
|
|
1179
1253
|
*/
|
|
1180
1254
|
async getInvites(guildId, { signal } = {}) {
|
|
1181
|
-
return this.rest.get(
|
|
1255
|
+
return this.rest.get(Routes6.guildInvites(guildId), { signal });
|
|
1182
1256
|
}
|
|
1183
1257
|
/**
|
|
1184
1258
|
* Fetches the integrations for a guild
|
|
@@ -1188,7 +1262,7 @@ var GuildsAPI = class {
|
|
|
1188
1262
|
* @param options - The options for fetching the integrations
|
|
1189
1263
|
*/
|
|
1190
1264
|
async getIntegrations(guildId, { signal } = {}) {
|
|
1191
|
-
return this.rest.get(
|
|
1265
|
+
return this.rest.get(Routes6.guildIntegrations(guildId), { signal });
|
|
1192
1266
|
}
|
|
1193
1267
|
/**
|
|
1194
1268
|
* Deletes an integration from a guild
|
|
@@ -1199,7 +1273,7 @@ var GuildsAPI = class {
|
|
|
1199
1273
|
* @param options - The options for deleting the integration
|
|
1200
1274
|
*/
|
|
1201
1275
|
async deleteIntegration(guildId, integrationId, { reason, signal } = {}) {
|
|
1202
|
-
await this.rest.delete(
|
|
1276
|
+
await this.rest.delete(Routes6.guildIntegration(guildId, integrationId), { reason, signal });
|
|
1203
1277
|
}
|
|
1204
1278
|
/**
|
|
1205
1279
|
* Fetches the widget settings for a guild
|
|
@@ -1209,7 +1283,7 @@ var GuildsAPI = class {
|
|
|
1209
1283
|
* @param options - The options for fetching the widget settings
|
|
1210
1284
|
*/
|
|
1211
1285
|
async getWidgetSettings(guildId, { signal } = {}) {
|
|
1212
|
-
return this.rest.get(
|
|
1286
|
+
return this.rest.get(Routes6.guildWidgetSettings(guildId), {
|
|
1213
1287
|
signal
|
|
1214
1288
|
});
|
|
1215
1289
|
}
|
|
@@ -1222,7 +1296,7 @@ var GuildsAPI = class {
|
|
|
1222
1296
|
* @param options - The options for editing the widget settings
|
|
1223
1297
|
*/
|
|
1224
1298
|
async editWidgetSettings(guildId, body, { reason, signal } = {}) {
|
|
1225
|
-
return this.rest.patch(
|
|
1299
|
+
return this.rest.patch(Routes6.guildWidgetSettings(guildId), {
|
|
1226
1300
|
reason,
|
|
1227
1301
|
body,
|
|
1228
1302
|
signal
|
|
@@ -1236,7 +1310,7 @@ var GuildsAPI = class {
|
|
|
1236
1310
|
* @param options - The options for fetching the widget
|
|
1237
1311
|
*/
|
|
1238
1312
|
async getWidget(guildId, { signal } = {}) {
|
|
1239
|
-
return this.rest.get(
|
|
1313
|
+
return this.rest.get(Routes6.guildWidgetJSON(guildId), { signal });
|
|
1240
1314
|
}
|
|
1241
1315
|
/**
|
|
1242
1316
|
* Fetches the vanity url for a guild
|
|
@@ -1246,7 +1320,7 @@ var GuildsAPI = class {
|
|
|
1246
1320
|
* @param options - The options for fetching the vanity url
|
|
1247
1321
|
*/
|
|
1248
1322
|
async getVanityURL(guildId, { signal } = {}) {
|
|
1249
|
-
return this.rest.get(
|
|
1323
|
+
return this.rest.get(Routes6.guildVanityUrl(guildId), { signal });
|
|
1250
1324
|
}
|
|
1251
1325
|
/**
|
|
1252
1326
|
* Fetches the widget image for a guild
|
|
@@ -1257,7 +1331,7 @@ var GuildsAPI = class {
|
|
|
1257
1331
|
* @param options - The options for fetching the widget image
|
|
1258
1332
|
*/
|
|
1259
1333
|
async getWidgetImage(guildId, style, { signal } = {}) {
|
|
1260
|
-
return this.rest.get(
|
|
1334
|
+
return this.rest.get(Routes6.guildWidgetImage(guildId), {
|
|
1261
1335
|
query: makeURLSearchParams3({ style }),
|
|
1262
1336
|
signal
|
|
1263
1337
|
});
|
|
@@ -1270,7 +1344,7 @@ var GuildsAPI = class {
|
|
|
1270
1344
|
* @param options - The options for fetching the welcome screen
|
|
1271
1345
|
*/
|
|
1272
1346
|
async getWelcomeScreen(guildId, { signal } = {}) {
|
|
1273
|
-
return this.rest.get(
|
|
1347
|
+
return this.rest.get(Routes6.guildWelcomeScreen(guildId), { signal });
|
|
1274
1348
|
}
|
|
1275
1349
|
/**
|
|
1276
1350
|
* Edits the welcome screen for a guild
|
|
@@ -1281,7 +1355,7 @@ var GuildsAPI = class {
|
|
|
1281
1355
|
* @param options - The options for editing the welcome screen
|
|
1282
1356
|
*/
|
|
1283
1357
|
async editWelcomeScreen(guildId, body, { reason, signal } = {}) {
|
|
1284
|
-
return this.rest.patch(
|
|
1358
|
+
return this.rest.patch(Routes6.guildWelcomeScreen(guildId), {
|
|
1285
1359
|
reason,
|
|
1286
1360
|
body,
|
|
1287
1361
|
signal
|
|
@@ -1308,7 +1382,7 @@ var GuildsAPI = class {
|
|
|
1308
1382
|
* @param options - The options for fetching the emojis
|
|
1309
1383
|
*/
|
|
1310
1384
|
async getEmojis(guildId, { signal } = {}) {
|
|
1311
|
-
return this.rest.get(
|
|
1385
|
+
return this.rest.get(Routes6.guildEmojis(guildId), { signal });
|
|
1312
1386
|
}
|
|
1313
1387
|
/**
|
|
1314
1388
|
* Fetches an emoji for a guild
|
|
@@ -1319,7 +1393,7 @@ var GuildsAPI = class {
|
|
|
1319
1393
|
* @param options - The options for fetching the emoji
|
|
1320
1394
|
*/
|
|
1321
1395
|
async getEmoji(guildId, emojiId, { signal } = {}) {
|
|
1322
|
-
return this.rest.get(
|
|
1396
|
+
return this.rest.get(Routes6.guildEmoji(guildId, emojiId), { signal });
|
|
1323
1397
|
}
|
|
1324
1398
|
/**
|
|
1325
1399
|
* Creates a new emoji for a guild
|
|
@@ -1330,7 +1404,7 @@ var GuildsAPI = class {
|
|
|
1330
1404
|
* @param options - The options for creating the emoji
|
|
1331
1405
|
*/
|
|
1332
1406
|
async createEmoji(guildId, body, { reason, signal } = {}) {
|
|
1333
|
-
return this.rest.post(
|
|
1407
|
+
return this.rest.post(Routes6.guildEmojis(guildId), {
|
|
1334
1408
|
reason,
|
|
1335
1409
|
body,
|
|
1336
1410
|
signal
|
|
@@ -1346,7 +1420,7 @@ var GuildsAPI = class {
|
|
|
1346
1420
|
* @param options - The options for editing the emoji
|
|
1347
1421
|
*/
|
|
1348
1422
|
async editEmoji(guildId, emojiId, body, { reason, signal } = {}) {
|
|
1349
|
-
return this.rest.patch(
|
|
1423
|
+
return this.rest.patch(Routes6.guildEmoji(guildId, emojiId), {
|
|
1350
1424
|
reason,
|
|
1351
1425
|
body,
|
|
1352
1426
|
signal
|
|
@@ -1361,7 +1435,7 @@ var GuildsAPI = class {
|
|
|
1361
1435
|
* @param options - The options for deleting the emoji
|
|
1362
1436
|
*/
|
|
1363
1437
|
async deleteEmoji(guildId, emojiId, { reason, signal } = {}) {
|
|
1364
|
-
await this.rest.delete(
|
|
1438
|
+
await this.rest.delete(Routes6.guildEmoji(guildId, emojiId), { reason, signal });
|
|
1365
1439
|
}
|
|
1366
1440
|
/**
|
|
1367
1441
|
* Fetches all scheduled events for a guild
|
|
@@ -1372,7 +1446,7 @@ var GuildsAPI = class {
|
|
|
1372
1446
|
* @param options - The options for fetching the scheduled events
|
|
1373
1447
|
*/
|
|
1374
1448
|
async getScheduledEvents(guildId, query = {}, { signal } = {}) {
|
|
1375
|
-
return this.rest.get(
|
|
1449
|
+
return this.rest.get(Routes6.guildScheduledEvents(guildId), {
|
|
1376
1450
|
query: makeURLSearchParams3(query),
|
|
1377
1451
|
signal
|
|
1378
1452
|
});
|
|
@@ -1386,7 +1460,7 @@ var GuildsAPI = class {
|
|
|
1386
1460
|
* @param options - The options for creating the scheduled event
|
|
1387
1461
|
*/
|
|
1388
1462
|
async createScheduledEvent(guildId, body, { reason, signal } = {}) {
|
|
1389
|
-
return this.rest.post(
|
|
1463
|
+
return this.rest.post(Routes6.guildScheduledEvents(guildId), {
|
|
1390
1464
|
reason,
|
|
1391
1465
|
body,
|
|
1392
1466
|
signal
|
|
@@ -1402,7 +1476,7 @@ var GuildsAPI = class {
|
|
|
1402
1476
|
* @param options - The options for fetching the scheduled event
|
|
1403
1477
|
*/
|
|
1404
1478
|
async getScheduledEvent(guildId, eventId, query = {}, { signal } = {}) {
|
|
1405
|
-
return this.rest.get(
|
|
1479
|
+
return this.rest.get(Routes6.guildScheduledEvent(guildId, eventId), {
|
|
1406
1480
|
query: makeURLSearchParams3(query),
|
|
1407
1481
|
signal
|
|
1408
1482
|
});
|
|
@@ -1417,7 +1491,7 @@ var GuildsAPI = class {
|
|
|
1417
1491
|
* @param options - The options for editing the scheduled event
|
|
1418
1492
|
*/
|
|
1419
1493
|
async editScheduledEvent(guildId, eventId, body, { reason, signal } = {}) {
|
|
1420
|
-
return this.rest.patch(
|
|
1494
|
+
return this.rest.patch(Routes6.guildScheduledEvent(guildId, eventId), {
|
|
1421
1495
|
reason,
|
|
1422
1496
|
body,
|
|
1423
1497
|
signal
|
|
@@ -1432,7 +1506,7 @@ var GuildsAPI = class {
|
|
|
1432
1506
|
* @param options - The options for deleting the scheduled event
|
|
1433
1507
|
*/
|
|
1434
1508
|
async deleteScheduledEvent(guildId, eventId, { reason, signal } = {}) {
|
|
1435
|
-
await this.rest.delete(
|
|
1509
|
+
await this.rest.delete(Routes6.guildScheduledEvent(guildId, eventId), { reason, signal });
|
|
1436
1510
|
}
|
|
1437
1511
|
/**
|
|
1438
1512
|
* Gets all users that are interested in a scheduled event
|
|
@@ -1444,7 +1518,7 @@ var GuildsAPI = class {
|
|
|
1444
1518
|
* @param options - The options for fetching the scheduled event users
|
|
1445
1519
|
*/
|
|
1446
1520
|
async getScheduledEventUsers(guildId, eventId, query = {}, { signal } = {}) {
|
|
1447
|
-
return this.rest.get(
|
|
1521
|
+
return this.rest.get(Routes6.guildScheduledEventUsers(guildId, eventId), {
|
|
1448
1522
|
query: makeURLSearchParams3(query),
|
|
1449
1523
|
signal
|
|
1450
1524
|
});
|
|
@@ -1457,7 +1531,7 @@ var GuildsAPI = class {
|
|
|
1457
1531
|
* @param options - The options for fetching the templates
|
|
1458
1532
|
*/
|
|
1459
1533
|
async getTemplates(guildId, { signal } = {}) {
|
|
1460
|
-
return this.rest.get(
|
|
1534
|
+
return this.rest.get(Routes6.guildTemplates(guildId), { signal });
|
|
1461
1535
|
}
|
|
1462
1536
|
/**
|
|
1463
1537
|
* Syncs a template for a guild
|
|
@@ -1468,7 +1542,7 @@ var GuildsAPI = class {
|
|
|
1468
1542
|
* @param options - The options for syncing the template
|
|
1469
1543
|
*/
|
|
1470
1544
|
async syncTemplate(guildId, templateCode, { signal } = {}) {
|
|
1471
|
-
return this.rest.put(
|
|
1545
|
+
return this.rest.put(Routes6.guildTemplate(guildId, templateCode), {
|
|
1472
1546
|
signal
|
|
1473
1547
|
});
|
|
1474
1548
|
}
|
|
@@ -1482,7 +1556,7 @@ var GuildsAPI = class {
|
|
|
1482
1556
|
* @param options - The options for editing the template
|
|
1483
1557
|
*/
|
|
1484
1558
|
async editTemplate(guildId, templateCode, body, { signal } = {}) {
|
|
1485
|
-
return this.rest.patch(
|
|
1559
|
+
return this.rest.patch(Routes6.guildTemplate(guildId, templateCode), {
|
|
1486
1560
|
body,
|
|
1487
1561
|
signal
|
|
1488
1562
|
});
|
|
@@ -1496,7 +1570,7 @@ var GuildsAPI = class {
|
|
|
1496
1570
|
* @param options - The options for deleting the template
|
|
1497
1571
|
*/
|
|
1498
1572
|
async deleteTemplate(guildId, templateCode, { signal } = {}) {
|
|
1499
|
-
await this.rest.delete(
|
|
1573
|
+
await this.rest.delete(Routes6.guildTemplate(guildId, templateCode), { signal });
|
|
1500
1574
|
}
|
|
1501
1575
|
/**
|
|
1502
1576
|
* Fetches all the stickers for a guild
|
|
@@ -1506,7 +1580,7 @@ var GuildsAPI = class {
|
|
|
1506
1580
|
* @param options - The options for fetching the stickers
|
|
1507
1581
|
*/
|
|
1508
1582
|
async getStickers(guildId, { signal } = {}) {
|
|
1509
|
-
return this.rest.get(
|
|
1583
|
+
return this.rest.get(Routes6.guildStickers(guildId), { signal });
|
|
1510
1584
|
}
|
|
1511
1585
|
/**
|
|
1512
1586
|
* Fetches a sticker for a guild
|
|
@@ -1517,7 +1591,7 @@ var GuildsAPI = class {
|
|
|
1517
1591
|
* @param options - The options for fetching the sticker
|
|
1518
1592
|
*/
|
|
1519
1593
|
async getSticker(guildId, stickerId, { signal } = {}) {
|
|
1520
|
-
return this.rest.get(
|
|
1594
|
+
return this.rest.get(Routes6.guildSticker(guildId, stickerId), { signal });
|
|
1521
1595
|
}
|
|
1522
1596
|
/**
|
|
1523
1597
|
* Creates a sticker for a guild
|
|
@@ -1529,7 +1603,7 @@ var GuildsAPI = class {
|
|
|
1529
1603
|
*/
|
|
1530
1604
|
async createSticker(guildId, { file, ...body }, { reason, signal } = {}) {
|
|
1531
1605
|
const fileData = { ...file, key: "file" };
|
|
1532
|
-
return this.rest.post(
|
|
1606
|
+
return this.rest.post(Routes6.guildStickers(guildId), {
|
|
1533
1607
|
appendToFormData: true,
|
|
1534
1608
|
body,
|
|
1535
1609
|
files: [fileData],
|
|
@@ -1547,7 +1621,7 @@ var GuildsAPI = class {
|
|
|
1547
1621
|
* @param options - The options for editing the sticker
|
|
1548
1622
|
*/
|
|
1549
1623
|
async editSticker(guildId, stickerId, body, { reason, signal } = {}) {
|
|
1550
|
-
return this.rest.patch(
|
|
1624
|
+
return this.rest.patch(Routes6.guildSticker(guildId, stickerId), {
|
|
1551
1625
|
reason,
|
|
1552
1626
|
body,
|
|
1553
1627
|
signal
|
|
@@ -1562,7 +1636,7 @@ var GuildsAPI = class {
|
|
|
1562
1636
|
* @param options - The options for deleting the sticker
|
|
1563
1637
|
*/
|
|
1564
1638
|
async deleteSticker(guildId, stickerId, { reason, signal } = {}) {
|
|
1565
|
-
await this.rest.delete(
|
|
1639
|
+
await this.rest.delete(Routes6.guildSticker(guildId, stickerId), { reason, signal });
|
|
1566
1640
|
}
|
|
1567
1641
|
/**
|
|
1568
1642
|
* Fetches the audit logs for a guild
|
|
@@ -1573,7 +1647,7 @@ var GuildsAPI = class {
|
|
|
1573
1647
|
* @param options - The options for fetching the audit logs
|
|
1574
1648
|
*/
|
|
1575
1649
|
async getAuditLogs(guildId, query = {}, { signal } = {}) {
|
|
1576
|
-
return this.rest.get(
|
|
1650
|
+
return this.rest.get(Routes6.guildAuditLog(guildId), {
|
|
1577
1651
|
query: makeURLSearchParams3(query),
|
|
1578
1652
|
signal
|
|
1579
1653
|
});
|
|
@@ -1586,7 +1660,7 @@ var GuildsAPI = class {
|
|
|
1586
1660
|
* @param options - The options for fetching the auto moderation rules
|
|
1587
1661
|
*/
|
|
1588
1662
|
async getAutoModerationRules(guildId, { signal } = {}) {
|
|
1589
|
-
return this.rest.get(
|
|
1663
|
+
return this.rest.get(Routes6.guildAutoModerationRules(guildId), {
|
|
1590
1664
|
signal
|
|
1591
1665
|
});
|
|
1592
1666
|
}
|
|
@@ -1599,7 +1673,7 @@ var GuildsAPI = class {
|
|
|
1599
1673
|
* @param options - The options for fetching the auto moderation rule
|
|
1600
1674
|
*/
|
|
1601
1675
|
async getAutoModerationRule(guildId, ruleId, { signal } = {}) {
|
|
1602
|
-
return this.rest.get(
|
|
1676
|
+
return this.rest.get(Routes6.guildAutoModerationRule(guildId, ruleId), {
|
|
1603
1677
|
signal
|
|
1604
1678
|
});
|
|
1605
1679
|
}
|
|
@@ -1612,7 +1686,7 @@ var GuildsAPI = class {
|
|
|
1612
1686
|
* @param options - The options for creating the auto moderation rule
|
|
1613
1687
|
*/
|
|
1614
1688
|
async createAutoModerationRule(guildId, body, { reason, signal } = {}) {
|
|
1615
|
-
return this.rest.post(
|
|
1689
|
+
return this.rest.post(Routes6.guildAutoModerationRules(guildId), {
|
|
1616
1690
|
reason,
|
|
1617
1691
|
body,
|
|
1618
1692
|
signal
|
|
@@ -1628,7 +1702,7 @@ var GuildsAPI = class {
|
|
|
1628
1702
|
* @param options - The options for editing the auto moderation rule
|
|
1629
1703
|
*/
|
|
1630
1704
|
async editAutoModerationRule(guildId, ruleId, body, { reason, signal } = {}) {
|
|
1631
|
-
return this.rest.patch(
|
|
1705
|
+
return this.rest.patch(Routes6.guildAutoModerationRule(guildId, ruleId), {
|
|
1632
1706
|
reason,
|
|
1633
1707
|
body,
|
|
1634
1708
|
signal
|
|
@@ -1643,7 +1717,7 @@ var GuildsAPI = class {
|
|
|
1643
1717
|
* @param options - The options for deleting the auto moderation rule
|
|
1644
1718
|
*/
|
|
1645
1719
|
async deleteAutoModerationRule(guildId, ruleId, { reason, signal } = {}) {
|
|
1646
|
-
await this.rest.delete(
|
|
1720
|
+
await this.rest.delete(Routes6.guildAutoModerationRule(guildId, ruleId), { reason, signal });
|
|
1647
1721
|
}
|
|
1648
1722
|
/**
|
|
1649
1723
|
* Fetches a guild member
|
|
@@ -1654,7 +1728,7 @@ var GuildsAPI = class {
|
|
|
1654
1728
|
* @param options - The options for fetching the guild member
|
|
1655
1729
|
*/
|
|
1656
1730
|
async getMember(guildId, userId, { signal } = {}) {
|
|
1657
|
-
return this.rest.get(
|
|
1731
|
+
return this.rest.get(Routes6.guildMember(guildId, userId), { signal });
|
|
1658
1732
|
}
|
|
1659
1733
|
/**
|
|
1660
1734
|
* Searches for guild members
|
|
@@ -1665,7 +1739,7 @@ var GuildsAPI = class {
|
|
|
1665
1739
|
* @param options - The options for searching for guild members
|
|
1666
1740
|
*/
|
|
1667
1741
|
async searchForMembers(guildId, query, { signal } = {}) {
|
|
1668
|
-
return this.rest.get(
|
|
1742
|
+
return this.rest.get(Routes6.guildMembersSearch(guildId), {
|
|
1669
1743
|
query: makeURLSearchParams3(query),
|
|
1670
1744
|
signal
|
|
1671
1745
|
});
|
|
@@ -1680,7 +1754,7 @@ var GuildsAPI = class {
|
|
|
1680
1754
|
* @param options - The options for editing the guild member
|
|
1681
1755
|
*/
|
|
1682
1756
|
async editMember(guildId, userId, body = {}, { reason, signal } = {}) {
|
|
1683
|
-
return this.rest.patch(
|
|
1757
|
+
return this.rest.patch(Routes6.guildMember(guildId, userId), {
|
|
1684
1758
|
reason,
|
|
1685
1759
|
body,
|
|
1686
1760
|
signal
|
|
@@ -1695,7 +1769,7 @@ var GuildsAPI = class {
|
|
|
1695
1769
|
* @param options - The options for removing the guild member
|
|
1696
1770
|
*/
|
|
1697
1771
|
async removeMember(guildId, userId, { reason, signal } = {}) {
|
|
1698
|
-
return this.rest.delete(
|
|
1772
|
+
return this.rest.delete(Routes6.guildMember(guildId, userId), { reason, signal });
|
|
1699
1773
|
}
|
|
1700
1774
|
/**
|
|
1701
1775
|
* Adds a role to a guild member
|
|
@@ -1707,7 +1781,7 @@ var GuildsAPI = class {
|
|
|
1707
1781
|
* @param options - The options for adding a role to a guild member
|
|
1708
1782
|
*/
|
|
1709
1783
|
async addRoleToMember(guildId, userId, roleId, { reason, signal } = {}) {
|
|
1710
|
-
await this.rest.put(
|
|
1784
|
+
await this.rest.put(Routes6.guildMemberRole(guildId, userId, roleId), { reason, signal });
|
|
1711
1785
|
}
|
|
1712
1786
|
/**
|
|
1713
1787
|
* Removes a role from a guild member
|
|
@@ -1719,7 +1793,7 @@ var GuildsAPI = class {
|
|
|
1719
1793
|
* @param options - The options for removing a role from a guild member
|
|
1720
1794
|
*/
|
|
1721
1795
|
async removeRoleFromMember(guildId, userId, roleId, { reason, signal } = {}) {
|
|
1722
|
-
await this.rest.delete(
|
|
1796
|
+
await this.rest.delete(Routes6.guildMemberRole(guildId, userId, roleId), { reason, signal });
|
|
1723
1797
|
}
|
|
1724
1798
|
/**
|
|
1725
1799
|
* Fetches a guild template
|
|
@@ -1729,7 +1803,7 @@ var GuildsAPI = class {
|
|
|
1729
1803
|
* @param options - The options for fetching the guild template
|
|
1730
1804
|
*/
|
|
1731
1805
|
async getTemplate(templateCode, { signal } = {}) {
|
|
1732
|
-
return this.rest.get(
|
|
1806
|
+
return this.rest.get(Routes6.template(templateCode), { signal });
|
|
1733
1807
|
}
|
|
1734
1808
|
/**
|
|
1735
1809
|
* Creates a new template
|
|
@@ -1740,7 +1814,7 @@ var GuildsAPI = class {
|
|
|
1740
1814
|
* @param options - The options for creating the template
|
|
1741
1815
|
*/
|
|
1742
1816
|
async createTemplate(guildId, body, { signal } = {}) {
|
|
1743
|
-
return this.rest.post(
|
|
1817
|
+
return this.rest.post(Routes6.guildTemplates(guildId), { body, signal });
|
|
1744
1818
|
}
|
|
1745
1819
|
/**
|
|
1746
1820
|
* Fetches webhooks for a guild
|
|
@@ -1749,7 +1823,7 @@ var GuildsAPI = class {
|
|
|
1749
1823
|
* @param id - The id of the guild
|
|
1750
1824
|
*/
|
|
1751
1825
|
async getWebhooks(id) {
|
|
1752
|
-
return this.rest.get(
|
|
1826
|
+
return this.rest.get(Routes6.guildWebhooks(id));
|
|
1753
1827
|
}
|
|
1754
1828
|
/**
|
|
1755
1829
|
* Sets the voice state for the current user
|
|
@@ -1771,7 +1845,7 @@ var GuildsAPI = class {
|
|
|
1771
1845
|
* @param options - The options for fetching the guild onboarding
|
|
1772
1846
|
*/
|
|
1773
1847
|
async getOnboarding(guildId, { signal } = {}) {
|
|
1774
|
-
return this.rest.get(
|
|
1848
|
+
return this.rest.get(Routes6.guildOnboarding(guildId), { signal });
|
|
1775
1849
|
}
|
|
1776
1850
|
/**
|
|
1777
1851
|
* Edits a guild onboarding
|
|
@@ -1782,8 +1856,89 @@ var GuildsAPI = class {
|
|
|
1782
1856
|
* @param options - The options for editing the guild onboarding
|
|
1783
1857
|
*/
|
|
1784
1858
|
async editOnboarding(guildId, body, { reason, signal } = {}) {
|
|
1785
|
-
return this.rest.put(
|
|
1859
|
+
return this.rest.put(Routes6.guildOnboarding(guildId), {
|
|
1860
|
+
reason,
|
|
1861
|
+
body,
|
|
1862
|
+
signal
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
/**
|
|
1866
|
+
* Fetches all the soundboard sounds for a guild
|
|
1867
|
+
*
|
|
1868
|
+
* @see {@link https://discord.com/developers/docs/resources/soundboard#list-guild-soundboard-sounds}
|
|
1869
|
+
* @param guildId - The id of the guild to fetch the soundboard sounds for
|
|
1870
|
+
* @param options - The options for fetching the soundboard sounds
|
|
1871
|
+
*/
|
|
1872
|
+
async getSoundboardSounds(guildId, { signal } = {}) {
|
|
1873
|
+
return this.rest.get(Routes6.guildSoundboardSounds(guildId), {
|
|
1874
|
+
signal
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Fetches a soundboard sound for a guild
|
|
1879
|
+
*
|
|
1880
|
+
* @see {@link https://discord.com/developers/docs/resources/soundboard#get-guild-soundboard-sound}
|
|
1881
|
+
* @param guildId - The id of the guild to fetch the soundboard sound for
|
|
1882
|
+
* @param soundId - The id of the soundboard sound to fetch
|
|
1883
|
+
* @param options - The options for fetching the soundboard sound
|
|
1884
|
+
*/
|
|
1885
|
+
async getSoundboardSound(guildId, soundId, { signal } = {}) {
|
|
1886
|
+
return this.rest.get(Routes6.guildSoundboardSound(guildId, soundId), {
|
|
1887
|
+
signal
|
|
1888
|
+
});
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* Creates a new soundboard sound for a guild
|
|
1892
|
+
*
|
|
1893
|
+
* @see {@link https://discord.com/developers/docs/resources/soundboard#create-guild-soundboard-sound}
|
|
1894
|
+
* @param guildId - The id of the guild to create the soundboard sound for
|
|
1895
|
+
* @param body - The data for creating the soundboard sound
|
|
1896
|
+
* @param options - The options for creating the soundboard sound
|
|
1897
|
+
*/
|
|
1898
|
+
async createSoundboardSound(guildId, body, { reason, signal } = {}) {
|
|
1899
|
+
return this.rest.post(Routes6.guildSoundboardSounds(guildId), {
|
|
1900
|
+
body,
|
|
1786
1901
|
reason,
|
|
1902
|
+
signal
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
/**
|
|
1906
|
+
* Edits a soundboard sound for a guild
|
|
1907
|
+
*
|
|
1908
|
+
* @see {@link https://discord.com/developers/docs/resources/soundboard#modify-guild-soundboard-sound}
|
|
1909
|
+
* @param guildId - The id of the guild to edit the soundboard sound for
|
|
1910
|
+
* @param soundId - The id of the soundboard sound to edit
|
|
1911
|
+
* @param body - The data for editing the soundboard sound
|
|
1912
|
+
* @param options - The options for editing the soundboard sound
|
|
1913
|
+
*/
|
|
1914
|
+
async editSoundboardSound(guildId, soundId, body, { reason, signal } = {}) {
|
|
1915
|
+
return this.rest.patch(Routes6.guildSoundboardSound(guildId, soundId), {
|
|
1916
|
+
body,
|
|
1917
|
+
reason,
|
|
1918
|
+
signal
|
|
1919
|
+
});
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Deletes a soundboard sound for a guild
|
|
1923
|
+
*
|
|
1924
|
+
* @see {@link https://discord.com/developers/docs/resources/soundboard#delete-guild-soundboard-sound}
|
|
1925
|
+
* @param guildId - The id of the guild to delete the soundboard sound for
|
|
1926
|
+
* @param soundId - The id of the soundboard sound to delete
|
|
1927
|
+
* @param options - The options for deleting the soundboard sound
|
|
1928
|
+
*/
|
|
1929
|
+
async deleteSoundboardSound(guildId, soundId, { reason, signal } = {}) {
|
|
1930
|
+
await this.rest.delete(Routes6.guildSoundboardSound(guildId, soundId), { reason, signal });
|
|
1931
|
+
}
|
|
1932
|
+
/**
|
|
1933
|
+
* Modifies incident actions for a guild.
|
|
1934
|
+
*
|
|
1935
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-incident-actions}
|
|
1936
|
+
* @param guildId - The id of the guild
|
|
1937
|
+
* @param body - The data for modifying guild incident actions
|
|
1938
|
+
* @param options - The options for modifying guild incident actions
|
|
1939
|
+
*/
|
|
1940
|
+
async editIncidentActions(guildId, body, { signal } = {}) {
|
|
1941
|
+
return this.rest.put(Routes6.guildIncidentActions(guildId), {
|
|
1787
1942
|
body,
|
|
1788
1943
|
signal
|
|
1789
1944
|
});
|
|
@@ -1791,9 +1946,10 @@ var GuildsAPI = class {
|
|
|
1791
1946
|
};
|
|
1792
1947
|
|
|
1793
1948
|
// src/api/interactions.ts
|
|
1949
|
+
import { makeURLSearchParams as makeURLSearchParams4 } from "@discordjs/rest";
|
|
1794
1950
|
import {
|
|
1795
1951
|
InteractionResponseType,
|
|
1796
|
-
Routes as
|
|
1952
|
+
Routes as Routes7
|
|
1797
1953
|
} from "discord-api-types/v10";
|
|
1798
1954
|
var InteractionsAPI = class {
|
|
1799
1955
|
constructor(rest, webhooks) {
|
|
@@ -1803,17 +1959,9 @@ var InteractionsAPI = class {
|
|
|
1803
1959
|
static {
|
|
1804
1960
|
__name(this, "InteractionsAPI");
|
|
1805
1961
|
}
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1810
|
-
* @param interactionId - The id of the interaction
|
|
1811
|
-
* @param interactionToken - The token of the interaction
|
|
1812
|
-
* @param body - The callback data for replying
|
|
1813
|
-
* @param options - The options for replying
|
|
1814
|
-
*/
|
|
1815
|
-
async reply(interactionId, interactionToken, { files, ...data }, { signal } = {}) {
|
|
1816
|
-
await this.rest.post(Routes6.interactionCallback(interactionId, interactionToken), {
|
|
1962
|
+
async reply(interactionId, interactionToken, { files, with_response, ...data }, { signal } = {}) {
|
|
1963
|
+
const response = await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
1964
|
+
query: makeURLSearchParams4({ with_response }),
|
|
1817
1965
|
files,
|
|
1818
1966
|
auth: false,
|
|
1819
1967
|
body: {
|
|
@@ -1822,18 +1970,11 @@ var InteractionsAPI = class {
|
|
|
1822
1970
|
},
|
|
1823
1971
|
signal
|
|
1824
1972
|
});
|
|
1973
|
+
return with_response ? response : void 0;
|
|
1825
1974
|
}
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1830
|
-
* @param interactionId - The id of the interaction
|
|
1831
|
-
* @param interactionToken - The token of the interaction
|
|
1832
|
-
* @param data - The data for deferring the reply
|
|
1833
|
-
* @param options - The options for deferring
|
|
1834
|
-
*/
|
|
1835
|
-
async defer(interactionId, interactionToken, data, { signal } = {}) {
|
|
1836
|
-
await this.rest.post(Routes6.interactionCallback(interactionId, interactionToken), {
|
|
1975
|
+
async defer(interactionId, interactionToken, { with_response, ...data } = {}, { signal } = {}) {
|
|
1976
|
+
const response = await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
1977
|
+
query: makeURLSearchParams4({ with_response }),
|
|
1837
1978
|
auth: false,
|
|
1838
1979
|
body: {
|
|
1839
1980
|
type: InteractionResponseType.DeferredChannelMessageWithSource,
|
|
@@ -1841,23 +1982,18 @@ var InteractionsAPI = class {
|
|
|
1841
1982
|
},
|
|
1842
1983
|
signal
|
|
1843
1984
|
});
|
|
1985
|
+
return with_response ? response : void 0;
|
|
1844
1986
|
}
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1849
|
-
* @param interactionId - The id of the interaction
|
|
1850
|
-
* @param interactionToken - The token of the interaction
|
|
1851
|
-
* @param options - The options for deferring
|
|
1852
|
-
*/
|
|
1853
|
-
async deferMessageUpdate(interactionId, interactionToken, { signal } = {}) {
|
|
1854
|
-
await this.rest.post(Routes6.interactionCallback(interactionId, interactionToken), {
|
|
1987
|
+
async deferMessageUpdate(interactionId, interactionToken, { with_response } = {}, { signal } = {}) {
|
|
1988
|
+
const response = await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
1989
|
+
query: makeURLSearchParams4({ with_response }),
|
|
1855
1990
|
auth: false,
|
|
1856
1991
|
body: {
|
|
1857
1992
|
type: InteractionResponseType.DeferredMessageUpdate
|
|
1858
1993
|
},
|
|
1859
1994
|
signal
|
|
1860
1995
|
});
|
|
1996
|
+
return with_response ? response : void 0;
|
|
1861
1997
|
}
|
|
1862
1998
|
/**
|
|
1863
1999
|
* Reply to a deferred interaction
|
|
@@ -1917,17 +2053,9 @@ var InteractionsAPI = class {
|
|
|
1917
2053
|
async deleteReply(applicationId, interactionToken, messageId, { signal } = {}) {
|
|
1918
2054
|
await this.webhooks.deleteMessage(applicationId, interactionToken, messageId ?? "@original", {}, { signal });
|
|
1919
2055
|
}
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1924
|
-
* @param interactionId - The id of the interaction
|
|
1925
|
-
* @param interactionToken - The token of the interaction
|
|
1926
|
-
* @param callbackData - The callback data for updating the interaction
|
|
1927
|
-
* @param options - The options for updating the interaction
|
|
1928
|
-
*/
|
|
1929
|
-
async updateMessage(interactionId, interactionToken, { files, ...data }, { signal } = {}) {
|
|
1930
|
-
await this.rest.post(Routes6.interactionCallback(interactionId, interactionToken), {
|
|
2056
|
+
async updateMessage(interactionId, interactionToken, { files, with_response, ...data }, { signal } = {}) {
|
|
2057
|
+
const response = await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
2058
|
+
query: makeURLSearchParams4({ with_response }),
|
|
1931
2059
|
files,
|
|
1932
2060
|
auth: false,
|
|
1933
2061
|
body: {
|
|
@@ -1936,47 +2064,34 @@ var InteractionsAPI = class {
|
|
|
1936
2064
|
},
|
|
1937
2065
|
signal
|
|
1938
2066
|
});
|
|
2067
|
+
return with_response ? response : void 0;
|
|
1939
2068
|
}
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1944
|
-
* @param interactionId - The id of the interaction
|
|
1945
|
-
* @param interactionToken - The token of the interaction
|
|
1946
|
-
* @param callbackData - The callback data for the autocomplete response
|
|
1947
|
-
* @param options - The options for sending the autocomplete response
|
|
1948
|
-
*/
|
|
1949
|
-
async createAutocompleteResponse(interactionId, interactionToken, callbackData, { signal } = {}) {
|
|
1950
|
-
await this.rest.post(Routes6.interactionCallback(interactionId, interactionToken), {
|
|
2069
|
+
async createAutocompleteResponse(interactionId, interactionToken, { with_response, ...data }, { signal } = {}) {
|
|
2070
|
+
const response = await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
2071
|
+
query: makeURLSearchParams4({ with_response }),
|
|
1951
2072
|
auth: false,
|
|
1952
2073
|
body: {
|
|
1953
2074
|
type: InteractionResponseType.ApplicationCommandAutocompleteResult,
|
|
1954
|
-
data
|
|
2075
|
+
data
|
|
1955
2076
|
},
|
|
1956
2077
|
signal
|
|
1957
2078
|
});
|
|
2079
|
+
return with_response ? response : void 0;
|
|
1958
2080
|
}
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1963
|
-
* @param interactionId - The id of the interaction
|
|
1964
|
-
* @param interactionToken - The token of the interaction
|
|
1965
|
-
* @param callbackData - The modal callback data to send
|
|
1966
|
-
* @param options - The options for sending the modal
|
|
1967
|
-
*/
|
|
1968
|
-
async createModal(interactionId, interactionToken, callbackData, { signal } = {}) {
|
|
1969
|
-
await this.rest.post(Routes6.interactionCallback(interactionId, interactionToken), {
|
|
2081
|
+
async createModal(interactionId, interactionToken, { with_response, ...data }, { signal } = {}) {
|
|
2082
|
+
const response = await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
2083
|
+
query: makeURLSearchParams4({ with_response }),
|
|
1970
2084
|
auth: false,
|
|
1971
2085
|
body: {
|
|
1972
2086
|
type: InteractionResponseType.Modal,
|
|
1973
|
-
data
|
|
2087
|
+
data
|
|
1974
2088
|
},
|
|
1975
2089
|
signal
|
|
1976
2090
|
});
|
|
2091
|
+
return with_response ? response : void 0;
|
|
1977
2092
|
}
|
|
1978
2093
|
/**
|
|
1979
|
-
*
|
|
2094
|
+
* Launches an activity and returns an interaction callback object
|
|
1980
2095
|
*
|
|
1981
2096
|
* @see {@link https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response}
|
|
1982
2097
|
* @param interactionId - The id of the interaction
|
|
@@ -1985,7 +2100,7 @@ var InteractionsAPI = class {
|
|
|
1985
2100
|
* @deprecated Sending a premium-style button is the new Discord behavior.
|
|
1986
2101
|
*/
|
|
1987
2102
|
async sendPremiumRequired(interactionId, interactionToken, { signal } = {}) {
|
|
1988
|
-
await this.rest.post(
|
|
2103
|
+
await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
1989
2104
|
auth: false,
|
|
1990
2105
|
body: {
|
|
1991
2106
|
type: InteractionResponseType.PremiumRequired
|
|
@@ -1993,11 +2108,22 @@ var InteractionsAPI = class {
|
|
|
1993
2108
|
signal
|
|
1994
2109
|
});
|
|
1995
2110
|
}
|
|
2111
|
+
async launchActivity(interactionId, interactionToken, { with_response } = {}, { signal } = {}) {
|
|
2112
|
+
const response = await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
2113
|
+
query: makeURLSearchParams4({ with_response }),
|
|
2114
|
+
auth: false,
|
|
2115
|
+
body: {
|
|
2116
|
+
type: InteractionResponseType.LaunchActivity
|
|
2117
|
+
},
|
|
2118
|
+
signal
|
|
2119
|
+
});
|
|
2120
|
+
return with_response ? response : void 0;
|
|
2121
|
+
}
|
|
1996
2122
|
};
|
|
1997
2123
|
|
|
1998
2124
|
// src/api/invite.ts
|
|
1999
|
-
import { makeURLSearchParams as
|
|
2000
|
-
import { Routes as
|
|
2125
|
+
import { makeURLSearchParams as makeURLSearchParams5 } from "@discordjs/rest";
|
|
2126
|
+
import { Routes as Routes8 } from "discord-api-types/v10";
|
|
2001
2127
|
var InvitesAPI = class {
|
|
2002
2128
|
constructor(rest) {
|
|
2003
2129
|
this.rest = rest;
|
|
@@ -2014,8 +2140,8 @@ var InvitesAPI = class {
|
|
|
2014
2140
|
* @param options - The options for fetching the invite
|
|
2015
2141
|
*/
|
|
2016
2142
|
async get(code, query = {}, { signal } = {}) {
|
|
2017
|
-
return this.rest.get(
|
|
2018
|
-
query:
|
|
2143
|
+
return this.rest.get(Routes8.invite(code), {
|
|
2144
|
+
query: makeURLSearchParams5(query),
|
|
2019
2145
|
signal
|
|
2020
2146
|
});
|
|
2021
2147
|
}
|
|
@@ -2027,14 +2153,14 @@ var InvitesAPI = class {
|
|
|
2027
2153
|
* @param options - The options for deleting the invite
|
|
2028
2154
|
*/
|
|
2029
2155
|
async delete(code, { reason, signal } = {}) {
|
|
2030
|
-
await this.rest.delete(
|
|
2156
|
+
await this.rest.delete(Routes8.invite(code), { reason, signal });
|
|
2031
2157
|
}
|
|
2032
2158
|
};
|
|
2033
2159
|
|
|
2034
2160
|
// src/api/monetization.ts
|
|
2035
|
-
import { makeURLSearchParams as
|
|
2161
|
+
import { makeURLSearchParams as makeURLSearchParams6 } from "@discordjs/rest";
|
|
2036
2162
|
import {
|
|
2037
|
-
Routes as
|
|
2163
|
+
Routes as Routes9
|
|
2038
2164
|
} from "discord-api-types/v10";
|
|
2039
2165
|
var MonetizationAPI = class {
|
|
2040
2166
|
constructor(rest) {
|
|
@@ -2046,36 +2172,77 @@ var MonetizationAPI = class {
|
|
|
2046
2172
|
/**
|
|
2047
2173
|
* Fetches the SKUs for an application.
|
|
2048
2174
|
*
|
|
2049
|
-
* @see {@link https://discord.com/developers/docs/
|
|
2175
|
+
* @see {@link https://discord.com/developers/docs/resources/sku#list-skus}
|
|
2176
|
+
* @param applicationId - The application id to fetch SKUs for
|
|
2050
2177
|
* @param options - The options for fetching the SKUs.
|
|
2051
2178
|
*/
|
|
2052
2179
|
async getSKUs(applicationId, { signal } = {}) {
|
|
2053
|
-
return this.rest.get(
|
|
2180
|
+
return this.rest.get(Routes9.skus(applicationId), { signal });
|
|
2181
|
+
}
|
|
2182
|
+
/**
|
|
2183
|
+
* Fetches subscriptions for an SKU.
|
|
2184
|
+
*
|
|
2185
|
+
* @see {@link https://discord.com/developers/docs/resources/subscription#list-sku-subscriptions}
|
|
2186
|
+
* @param skuId - The SKU id to fetch subscriptions for
|
|
2187
|
+
* @param query - The query options for fetching subscriptions
|
|
2188
|
+
* @param options - The options for fetching subscriptions
|
|
2189
|
+
*/
|
|
2190
|
+
async getSKUSubscriptions(skuId, query = {}, { signal } = {}) {
|
|
2191
|
+
return this.rest.get(Routes9.skuSubscriptions(skuId), {
|
|
2192
|
+
signal,
|
|
2193
|
+
query: makeURLSearchParams6(query)
|
|
2194
|
+
});
|
|
2195
|
+
}
|
|
2196
|
+
/**
|
|
2197
|
+
* Fetches a subscription for an SKU.
|
|
2198
|
+
*
|
|
2199
|
+
* @see {@link https://discord.com/developers/docs/resources/subscription#get-sku-subscription}
|
|
2200
|
+
* @param skuId - The SKU id to fetch subscription for
|
|
2201
|
+
* @param subscriptionId - The subscription id to fetch
|
|
2202
|
+
* @param options - The options for fetching the subscription
|
|
2203
|
+
*/
|
|
2204
|
+
async getSKUSubscription(skuId, subscriptionId, { signal } = {}) {
|
|
2205
|
+
return this.rest.get(Routes9.skuSubscription(skuId, subscriptionId), {
|
|
2206
|
+
signal
|
|
2207
|
+
});
|
|
2054
2208
|
}
|
|
2055
2209
|
/**
|
|
2056
2210
|
* Fetches the entitlements for an application.
|
|
2057
2211
|
*
|
|
2058
|
-
* @see {@link https://discord.com/developers/docs/
|
|
2212
|
+
* @see {@link https://discord.com/developers/docs/resources/entitlement#list-entitlements}
|
|
2059
2213
|
* @param applicationId - The application id to fetch entitlements for
|
|
2060
2214
|
* @param query - The query options for fetching entitlements
|
|
2061
2215
|
* @param options - The options for fetching entitlements
|
|
2062
2216
|
*/
|
|
2063
|
-
async getEntitlements(applicationId, query, { signal } = {}) {
|
|
2064
|
-
return this.rest.get(
|
|
2217
|
+
async getEntitlements(applicationId, query = {}, { signal } = {}) {
|
|
2218
|
+
return this.rest.get(Routes9.entitlements(applicationId), {
|
|
2065
2219
|
signal,
|
|
2066
|
-
query:
|
|
2220
|
+
query: makeURLSearchParams6(query)
|
|
2221
|
+
});
|
|
2222
|
+
}
|
|
2223
|
+
/**
|
|
2224
|
+
* Fetches an entitlement for an application.
|
|
2225
|
+
*
|
|
2226
|
+
* @see {@link https://discord.com/developers/docs/resources/entitlement#get-entitlement}
|
|
2227
|
+
* @param applicationId - The application id to fetch the entitlement for
|
|
2228
|
+
* @param entitlementId - The entitlement id to fetch
|
|
2229
|
+
* @param options - The options for fetching the entitlement
|
|
2230
|
+
*/
|
|
2231
|
+
async getEntitlement(applicationId, entitlementId, { signal } = {}) {
|
|
2232
|
+
return this.rest.get(Routes9.entitlement(applicationId, entitlementId), {
|
|
2233
|
+
signal
|
|
2067
2234
|
});
|
|
2068
2235
|
}
|
|
2069
2236
|
/**
|
|
2070
2237
|
* Creates a test entitlement for an application's SKU.
|
|
2071
2238
|
*
|
|
2072
|
-
* @see {@link https://discord.com/developers/docs/
|
|
2239
|
+
* @see {@link https://discord.com/developers/docs/resources/entitlement#create-test-entitlement}
|
|
2073
2240
|
* @param applicationId - The application id to create the entitlement for
|
|
2074
2241
|
* @param body - The data for creating the entitlement
|
|
2075
2242
|
* @param options - The options for creating the entitlement
|
|
2076
2243
|
*/
|
|
2077
2244
|
async createTestEntitlement(applicationId, body, { signal } = {}) {
|
|
2078
|
-
return this.rest.post(
|
|
2245
|
+
return this.rest.post(Routes9.entitlements(applicationId), {
|
|
2079
2246
|
body,
|
|
2080
2247
|
signal
|
|
2081
2248
|
});
|
|
@@ -2083,31 +2250,31 @@ var MonetizationAPI = class {
|
|
|
2083
2250
|
/**
|
|
2084
2251
|
* Deletes a test entitlement for an application's SKU.
|
|
2085
2252
|
*
|
|
2086
|
-
* @see {@link https://discord.com/developers/docs/
|
|
2253
|
+
* @see {@link https://discord.com/developers/docs/resources/entitlement#delete-test-entitlement}
|
|
2087
2254
|
* @param applicationId - The application id to delete the entitlement for
|
|
2088
2255
|
* @param entitlementId - The entitlement id to delete
|
|
2089
2256
|
* @param options - The options for deleting the entitlement
|
|
2090
2257
|
*/
|
|
2091
2258
|
async deleteTestEntitlement(applicationId, entitlementId, { signal } = {}) {
|
|
2092
|
-
await this.rest.delete(
|
|
2259
|
+
await this.rest.delete(Routes9.entitlement(applicationId, entitlementId), { signal });
|
|
2093
2260
|
}
|
|
2094
2261
|
/**
|
|
2095
2262
|
* Marks a given entitlement for the user as consumed. Only available for One-Time Purchase consumable SKUs.
|
|
2096
2263
|
*
|
|
2097
|
-
* @see {@link https://discord.com/developers/docs/
|
|
2264
|
+
* @see {@link https://discord.com/developers/docs/resources/entitlement#consume-an-entitlement}
|
|
2098
2265
|
* @param applicationId - The application id to consume the entitlement for
|
|
2099
2266
|
* @param entitlementId - The entitlement id to consume
|
|
2100
2267
|
* @param options - The options for consuming the entitlement
|
|
2101
2268
|
*/
|
|
2102
2269
|
async consumeEntitlement(applicationId, entitlementId, { signal } = {}) {
|
|
2103
|
-
await this.rest.post(
|
|
2270
|
+
await this.rest.post(Routes9.consumeEntitlement(applicationId, entitlementId), { signal });
|
|
2104
2271
|
}
|
|
2105
2272
|
};
|
|
2106
2273
|
|
|
2107
2274
|
// src/api/oauth2.ts
|
|
2108
|
-
import { makeURLSearchParams as
|
|
2275
|
+
import { makeURLSearchParams as makeURLSearchParams7 } from "@discordjs/rest";
|
|
2109
2276
|
import {
|
|
2110
|
-
Routes as
|
|
2277
|
+
Routes as Routes10,
|
|
2111
2278
|
RouteBases
|
|
2112
2279
|
} from "discord-api-types/v10";
|
|
2113
2280
|
var OAuth2API = class {
|
|
@@ -2124,8 +2291,8 @@ var OAuth2API = class {
|
|
|
2124
2291
|
* @param options - The options for creating the authorization URL
|
|
2125
2292
|
*/
|
|
2126
2293
|
generateAuthorizationURL(options) {
|
|
2127
|
-
const url = new URL(`${RouteBases.api}${
|
|
2128
|
-
url.search =
|
|
2294
|
+
const url = new URL(`${RouteBases.api}${Routes10.oauth2Authorization()}`);
|
|
2295
|
+
url.search = makeURLSearchParams7(options).toString();
|
|
2129
2296
|
return url.toString();
|
|
2130
2297
|
}
|
|
2131
2298
|
/**
|
|
@@ -2136,8 +2303,8 @@ var OAuth2API = class {
|
|
|
2136
2303
|
* @param options - The options for the token exchange request
|
|
2137
2304
|
*/
|
|
2138
2305
|
async tokenExchange(body, { signal } = {}) {
|
|
2139
|
-
return this.rest.post(
|
|
2140
|
-
body:
|
|
2306
|
+
return this.rest.post(Routes10.oauth2TokenExchange(), {
|
|
2307
|
+
body: makeURLSearchParams7(body),
|
|
2141
2308
|
passThroughBody: true,
|
|
2142
2309
|
headers: {
|
|
2143
2310
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
@@ -2154,8 +2321,8 @@ var OAuth2API = class {
|
|
|
2154
2321
|
* @param options - The options for the refresh token request
|
|
2155
2322
|
*/
|
|
2156
2323
|
async refreshToken(body, { signal } = {}) {
|
|
2157
|
-
return this.rest.post(
|
|
2158
|
-
body:
|
|
2324
|
+
return this.rest.post(Routes10.oauth2TokenExchange(), {
|
|
2325
|
+
body: makeURLSearchParams7(body),
|
|
2159
2326
|
passThroughBody: true,
|
|
2160
2327
|
headers: {
|
|
2161
2328
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
@@ -2174,8 +2341,8 @@ var OAuth2API = class {
|
|
|
2174
2341
|
* @param options - The options for the client credentials grant request
|
|
2175
2342
|
*/
|
|
2176
2343
|
async getToken(body, { signal } = {}) {
|
|
2177
|
-
return this.rest.post(
|
|
2178
|
-
body:
|
|
2344
|
+
return this.rest.post(Routes10.oauth2TokenExchange(), {
|
|
2345
|
+
body: makeURLSearchParams7(body),
|
|
2179
2346
|
passThroughBody: true,
|
|
2180
2347
|
headers: {
|
|
2181
2348
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
@@ -2191,7 +2358,7 @@ var OAuth2API = class {
|
|
|
2191
2358
|
* @param options - The options for the current bot application information request
|
|
2192
2359
|
*/
|
|
2193
2360
|
async getCurrentBotApplicationInformation({ signal } = {}) {
|
|
2194
|
-
return this.rest.get(
|
|
2361
|
+
return this.rest.get(Routes10.oauth2CurrentApplication(), {
|
|
2195
2362
|
signal
|
|
2196
2363
|
});
|
|
2197
2364
|
}
|
|
@@ -2202,7 +2369,7 @@ var OAuth2API = class {
|
|
|
2202
2369
|
* @param options - The options for the current authorization information request
|
|
2203
2370
|
*/
|
|
2204
2371
|
async getCurrentAuthorizationInformation({ signal } = {}) {
|
|
2205
|
-
return this.rest.get(
|
|
2372
|
+
return this.rest.get(Routes10.oauth2CurrentAuthorization(), {
|
|
2206
2373
|
signal
|
|
2207
2374
|
});
|
|
2208
2375
|
}
|
|
@@ -2216,8 +2383,8 @@ var OAuth2API = class {
|
|
|
2216
2383
|
* @param options - The options for the token revocation request
|
|
2217
2384
|
*/
|
|
2218
2385
|
async revokeToken(applicationId, applicationSecret, body, { signal } = {}) {
|
|
2219
|
-
await this.rest.post(
|
|
2220
|
-
body:
|
|
2386
|
+
await this.rest.post(Routes10.oauth2TokenRevocation(), {
|
|
2387
|
+
body: makeURLSearchParams7(body),
|
|
2221
2388
|
passThroughBody: true,
|
|
2222
2389
|
headers: {
|
|
2223
2390
|
Authorization: `Basic ${btoa(`${applicationId}:${applicationSecret}`)}`,
|
|
@@ -2230,9 +2397,9 @@ var OAuth2API = class {
|
|
|
2230
2397
|
};
|
|
2231
2398
|
|
|
2232
2399
|
// src/api/poll.ts
|
|
2233
|
-
import { makeURLSearchParams as
|
|
2400
|
+
import { makeURLSearchParams as makeURLSearchParams8 } from "@discordjs/rest";
|
|
2234
2401
|
import {
|
|
2235
|
-
Routes as
|
|
2402
|
+
Routes as Routes11
|
|
2236
2403
|
} from "discord-api-types/v10";
|
|
2237
2404
|
var PollAPI = class {
|
|
2238
2405
|
constructor(rest) {
|
|
@@ -2251,10 +2418,10 @@ var PollAPI = class {
|
|
|
2251
2418
|
* @param query - The query for getting the list of voters
|
|
2252
2419
|
* @param options - The options for getting the list of voters
|
|
2253
2420
|
*/
|
|
2254
|
-
async getAnswerVoters(channelId, messageId, answerId, query, { signal } = {}) {
|
|
2255
|
-
return this.rest.get(
|
|
2421
|
+
async getAnswerVoters(channelId, messageId, answerId, query = {}, { signal } = {}) {
|
|
2422
|
+
return this.rest.get(Routes11.pollAnswerVoters(channelId, messageId, answerId), {
|
|
2256
2423
|
signal,
|
|
2257
|
-
query:
|
|
2424
|
+
query: makeURLSearchParams8(query)
|
|
2258
2425
|
});
|
|
2259
2426
|
}
|
|
2260
2427
|
/**
|
|
@@ -2266,7 +2433,7 @@ var PollAPI = class {
|
|
|
2266
2433
|
* @param options - The options for expiring the poll
|
|
2267
2434
|
*/
|
|
2268
2435
|
async expirePoll(channelId, messageId, { signal } = {}) {
|
|
2269
|
-
return this.rest.post(
|
|
2436
|
+
return this.rest.post(Routes11.expirePoll(channelId, messageId), {
|
|
2270
2437
|
signal
|
|
2271
2438
|
});
|
|
2272
2439
|
}
|
|
@@ -2274,7 +2441,7 @@ var PollAPI = class {
|
|
|
2274
2441
|
|
|
2275
2442
|
// src/api/roleConnections.ts
|
|
2276
2443
|
import {
|
|
2277
|
-
Routes as
|
|
2444
|
+
Routes as Routes12
|
|
2278
2445
|
} from "discord-api-types/v10";
|
|
2279
2446
|
var RoleConnectionsAPI = class {
|
|
2280
2447
|
constructor(rest) {
|
|
@@ -2291,7 +2458,7 @@ var RoleConnectionsAPI = class {
|
|
|
2291
2458
|
* @param options - The options for fetching the role connection metadata records
|
|
2292
2459
|
*/
|
|
2293
2460
|
async getMetadataRecords(applicationId, { signal } = {}) {
|
|
2294
|
-
return this.rest.get(
|
|
2461
|
+
return this.rest.get(Routes12.applicationRoleConnectionMetadata(applicationId), {
|
|
2295
2462
|
signal
|
|
2296
2463
|
});
|
|
2297
2464
|
}
|
|
@@ -2304,16 +2471,38 @@ var RoleConnectionsAPI = class {
|
|
|
2304
2471
|
* @param options - The options for updating the role connection metadata records
|
|
2305
2472
|
*/
|
|
2306
2473
|
async updateMetadataRecords(applicationId, body, { signal } = {}) {
|
|
2307
|
-
return this.rest.put(
|
|
2474
|
+
return this.rest.put(Routes12.applicationRoleConnectionMetadata(applicationId), {
|
|
2308
2475
|
body,
|
|
2309
2476
|
signal
|
|
2310
2477
|
});
|
|
2311
2478
|
}
|
|
2312
2479
|
};
|
|
2313
2480
|
|
|
2481
|
+
// src/api/soundboardSounds.ts
|
|
2482
|
+
import { Routes as Routes13 } from "discord-api-types/v10";
|
|
2483
|
+
var SoundboardSoundsAPI = class {
|
|
2484
|
+
constructor(rest) {
|
|
2485
|
+
this.rest = rest;
|
|
2486
|
+
}
|
|
2487
|
+
static {
|
|
2488
|
+
__name(this, "SoundboardSoundsAPI");
|
|
2489
|
+
}
|
|
2490
|
+
/**
|
|
2491
|
+
* Fetches all the soundboard default sounds.
|
|
2492
|
+
*
|
|
2493
|
+
* @see {@link https://discord.com/developers/docs/resources/soundboard#list-default-soundboard-sounds}
|
|
2494
|
+
* @param options - The options for fetching the soundboard default sounds.
|
|
2495
|
+
*/
|
|
2496
|
+
async getSoundboardDefaultSounds({ signal } = {}) {
|
|
2497
|
+
return this.rest.get(Routes13.soundboardDefaultSounds(), {
|
|
2498
|
+
signal
|
|
2499
|
+
});
|
|
2500
|
+
}
|
|
2501
|
+
};
|
|
2502
|
+
|
|
2314
2503
|
// src/api/stageInstances.ts
|
|
2315
2504
|
import {
|
|
2316
|
-
Routes as
|
|
2505
|
+
Routes as Routes14
|
|
2317
2506
|
} from "discord-api-types/v10";
|
|
2318
2507
|
var StageInstancesAPI = class {
|
|
2319
2508
|
constructor(rest) {
|
|
@@ -2330,7 +2519,7 @@ var StageInstancesAPI = class {
|
|
|
2330
2519
|
* @param options - The options for creating the new stage instance
|
|
2331
2520
|
*/
|
|
2332
2521
|
async create(body, { reason, signal } = {}) {
|
|
2333
|
-
return this.rest.post(
|
|
2522
|
+
return this.rest.post(Routes14.stageInstances(), {
|
|
2334
2523
|
body,
|
|
2335
2524
|
reason,
|
|
2336
2525
|
signal
|
|
@@ -2344,7 +2533,7 @@ var StageInstancesAPI = class {
|
|
|
2344
2533
|
* @param options - The options for fetching the stage instance
|
|
2345
2534
|
*/
|
|
2346
2535
|
async get(channelId, { signal } = {}) {
|
|
2347
|
-
return this.rest.get(
|
|
2536
|
+
return this.rest.get(Routes14.stageInstance(channelId), { signal });
|
|
2348
2537
|
}
|
|
2349
2538
|
/**
|
|
2350
2539
|
* Edits a stage instance
|
|
@@ -2355,7 +2544,7 @@ var StageInstancesAPI = class {
|
|
|
2355
2544
|
* @param options - The options for editing the stage instance
|
|
2356
2545
|
*/
|
|
2357
2546
|
async edit(channelId, body, { reason, signal } = {}) {
|
|
2358
|
-
return this.rest.patch(
|
|
2547
|
+
return this.rest.patch(Routes14.stageInstance(channelId), {
|
|
2359
2548
|
body,
|
|
2360
2549
|
reason,
|
|
2361
2550
|
signal
|
|
@@ -2369,13 +2558,13 @@ var StageInstancesAPI = class {
|
|
|
2369
2558
|
* @param options - The options for deleting the stage instance
|
|
2370
2559
|
*/
|
|
2371
2560
|
async delete(channelId, { reason, signal } = {}) {
|
|
2372
|
-
await this.rest.delete(
|
|
2561
|
+
await this.rest.delete(Routes14.stageInstance(channelId), { reason, signal });
|
|
2373
2562
|
}
|
|
2374
2563
|
};
|
|
2375
2564
|
|
|
2376
2565
|
// src/api/sticker.ts
|
|
2377
2566
|
import {
|
|
2378
|
-
Routes as
|
|
2567
|
+
Routes as Routes15
|
|
2379
2568
|
} from "discord-api-types/v10";
|
|
2380
2569
|
var StickersAPI = class {
|
|
2381
2570
|
constructor(rest) {
|
|
@@ -2392,7 +2581,7 @@ var StickersAPI = class {
|
|
|
2392
2581
|
* @param options - The options for fetching the sticker pack
|
|
2393
2582
|
*/
|
|
2394
2583
|
async getStickerPack(packId, { signal } = {}) {
|
|
2395
|
-
return this.rest.get(
|
|
2584
|
+
return this.rest.get(Routes15.stickerPack(packId), { signal });
|
|
2396
2585
|
}
|
|
2397
2586
|
/**
|
|
2398
2587
|
* Fetches all of the sticker packs
|
|
@@ -2401,7 +2590,7 @@ var StickersAPI = class {
|
|
|
2401
2590
|
* @param options - The options for fetching the sticker packs
|
|
2402
2591
|
*/
|
|
2403
2592
|
async getStickers({ signal } = {}) {
|
|
2404
|
-
return this.rest.get(
|
|
2593
|
+
return this.rest.get(Routes15.stickerPacks(), { signal });
|
|
2405
2594
|
}
|
|
2406
2595
|
/**
|
|
2407
2596
|
* Fetches all of the sticker packs
|
|
@@ -2421,13 +2610,13 @@ var StickersAPI = class {
|
|
|
2421
2610
|
* @param options - The options for fetching the sticker
|
|
2422
2611
|
*/
|
|
2423
2612
|
async get(stickerId, { signal } = {}) {
|
|
2424
|
-
return this.rest.get(
|
|
2613
|
+
return this.rest.get(Routes15.sticker(stickerId), { signal });
|
|
2425
2614
|
}
|
|
2426
2615
|
};
|
|
2427
2616
|
|
|
2428
2617
|
// src/api/thread.ts
|
|
2429
2618
|
import {
|
|
2430
|
-
Routes as
|
|
2619
|
+
Routes as Routes16
|
|
2431
2620
|
} from "discord-api-types/v10";
|
|
2432
2621
|
var ThreadsAPI = class {
|
|
2433
2622
|
constructor(rest) {
|
|
@@ -2444,7 +2633,7 @@ var ThreadsAPI = class {
|
|
|
2444
2633
|
* @param options - The options for joining the thread
|
|
2445
2634
|
*/
|
|
2446
2635
|
async join(threadId, { signal } = {}) {
|
|
2447
|
-
await this.rest.put(
|
|
2636
|
+
await this.rest.put(Routes16.threadMembers(threadId, "@me"), { signal });
|
|
2448
2637
|
}
|
|
2449
2638
|
/**
|
|
2450
2639
|
* Adds a member to a thread
|
|
@@ -2455,7 +2644,7 @@ var ThreadsAPI = class {
|
|
|
2455
2644
|
* @param options - The options for adding the member to the thread
|
|
2456
2645
|
*/
|
|
2457
2646
|
async addMember(threadId, userId, { signal } = {}) {
|
|
2458
|
-
await this.rest.put(
|
|
2647
|
+
await this.rest.put(Routes16.threadMembers(threadId, userId), { signal });
|
|
2459
2648
|
}
|
|
2460
2649
|
/**
|
|
2461
2650
|
* Removes the current user from a thread
|
|
@@ -2465,7 +2654,7 @@ var ThreadsAPI = class {
|
|
|
2465
2654
|
* @param options - The options for leaving the thread
|
|
2466
2655
|
*/
|
|
2467
2656
|
async leave(threadId, { signal } = {}) {
|
|
2468
|
-
await this.rest.delete(
|
|
2657
|
+
await this.rest.delete(Routes16.threadMembers(threadId, "@me"), { signal });
|
|
2469
2658
|
}
|
|
2470
2659
|
/**
|
|
2471
2660
|
* Removes a member from a thread
|
|
@@ -2476,7 +2665,7 @@ var ThreadsAPI = class {
|
|
|
2476
2665
|
* @param options - The options for removing the member from the thread
|
|
2477
2666
|
*/
|
|
2478
2667
|
async removeMember(threadId, userId, { signal } = {}) {
|
|
2479
|
-
await this.rest.delete(
|
|
2668
|
+
await this.rest.delete(Routes16.threadMembers(threadId, userId), { signal });
|
|
2480
2669
|
}
|
|
2481
2670
|
/**
|
|
2482
2671
|
* Fetches a member of a thread
|
|
@@ -2487,7 +2676,7 @@ var ThreadsAPI = class {
|
|
|
2487
2676
|
* @param options - The options for fetching the member
|
|
2488
2677
|
*/
|
|
2489
2678
|
async getMember(threadId, userId, { signal } = {}) {
|
|
2490
|
-
return this.rest.get(
|
|
2679
|
+
return this.rest.get(Routes16.threadMembers(threadId, userId), { signal });
|
|
2491
2680
|
}
|
|
2492
2681
|
/**
|
|
2493
2682
|
* Fetches all members of a thread
|
|
@@ -2497,14 +2686,14 @@ var ThreadsAPI = class {
|
|
|
2497
2686
|
* @param options - The options for fetching the members
|
|
2498
2687
|
*/
|
|
2499
2688
|
async getAllMembers(threadId, { signal } = {}) {
|
|
2500
|
-
return this.rest.get(
|
|
2689
|
+
return this.rest.get(Routes16.threadMembers(threadId), { signal });
|
|
2501
2690
|
}
|
|
2502
2691
|
};
|
|
2503
2692
|
|
|
2504
2693
|
// src/api/user.ts
|
|
2505
|
-
import { makeURLSearchParams as
|
|
2694
|
+
import { makeURLSearchParams as makeURLSearchParams9 } from "@discordjs/rest";
|
|
2506
2695
|
import {
|
|
2507
|
-
Routes as
|
|
2696
|
+
Routes as Routes17
|
|
2508
2697
|
} from "discord-api-types/v10";
|
|
2509
2698
|
var UsersAPI = class {
|
|
2510
2699
|
constructor(rest) {
|
|
@@ -2521,7 +2710,7 @@ var UsersAPI = class {
|
|
|
2521
2710
|
* @param options - The options for fetching the user
|
|
2522
2711
|
*/
|
|
2523
2712
|
async get(userId, { signal } = {}) {
|
|
2524
|
-
return this.rest.get(
|
|
2713
|
+
return this.rest.get(Routes17.user(userId), { signal });
|
|
2525
2714
|
}
|
|
2526
2715
|
/**
|
|
2527
2716
|
* Returns the user object of the requester's account
|
|
@@ -2530,7 +2719,7 @@ var UsersAPI = class {
|
|
|
2530
2719
|
* @param options - The options for fetching the current user
|
|
2531
2720
|
*/
|
|
2532
2721
|
async getCurrent({ signal } = {}) {
|
|
2533
|
-
return this.rest.get(
|
|
2722
|
+
return this.rest.get(Routes17.user("@me"), { signal });
|
|
2534
2723
|
}
|
|
2535
2724
|
/**
|
|
2536
2725
|
* Returns a list of partial guild objects the current user is a member of
|
|
@@ -2540,8 +2729,8 @@ var UsersAPI = class {
|
|
|
2540
2729
|
* @param options - The options for fetching the guilds
|
|
2541
2730
|
*/
|
|
2542
2731
|
async getGuilds(query = {}, { signal } = {}) {
|
|
2543
|
-
return this.rest.get(
|
|
2544
|
-
query:
|
|
2732
|
+
return this.rest.get(Routes17.userGuilds(), {
|
|
2733
|
+
query: makeURLSearchParams9(query),
|
|
2545
2734
|
signal
|
|
2546
2735
|
});
|
|
2547
2736
|
}
|
|
@@ -2553,7 +2742,7 @@ var UsersAPI = class {
|
|
|
2553
2742
|
* @param options - The options for leaving the guild
|
|
2554
2743
|
*/
|
|
2555
2744
|
async leaveGuild(guildId, { signal } = {}) {
|
|
2556
|
-
await this.rest.delete(
|
|
2745
|
+
await this.rest.delete(Routes17.userGuild(guildId), { signal });
|
|
2557
2746
|
}
|
|
2558
2747
|
/**
|
|
2559
2748
|
* Edits the current user
|
|
@@ -2563,7 +2752,7 @@ var UsersAPI = class {
|
|
|
2563
2752
|
* @param options - The options for editing the user
|
|
2564
2753
|
*/
|
|
2565
2754
|
async edit(body, { signal } = {}) {
|
|
2566
|
-
return this.rest.patch(
|
|
2755
|
+
return this.rest.patch(Routes17.user("@me"), { body, signal });
|
|
2567
2756
|
}
|
|
2568
2757
|
/**
|
|
2569
2758
|
* Fetches the guild member for the current user
|
|
@@ -2573,7 +2762,7 @@ var UsersAPI = class {
|
|
|
2573
2762
|
* @param options - The options for fetching the guild member
|
|
2574
2763
|
*/
|
|
2575
2764
|
async getGuildMember(guildId, { signal } = {}) {
|
|
2576
|
-
return this.rest.get(
|
|
2765
|
+
return this.rest.get(Routes17.userGuildMember(guildId), { signal });
|
|
2577
2766
|
}
|
|
2578
2767
|
/**
|
|
2579
2768
|
* Edits the guild member for the current user
|
|
@@ -2584,7 +2773,7 @@ var UsersAPI = class {
|
|
|
2584
2773
|
* @param options - The options for editing the guild member
|
|
2585
2774
|
*/
|
|
2586
2775
|
async editCurrentGuildMember(guildId, body = {}, { reason, signal } = {}) {
|
|
2587
|
-
return this.rest.patch(
|
|
2776
|
+
return this.rest.patch(Routes17.guildMember(guildId, "@me"), {
|
|
2588
2777
|
reason,
|
|
2589
2778
|
body,
|
|
2590
2779
|
signal
|
|
@@ -2598,7 +2787,7 @@ var UsersAPI = class {
|
|
|
2598
2787
|
* @param options - The options for opening the DM
|
|
2599
2788
|
*/
|
|
2600
2789
|
async createDM(userId, { signal } = {}) {
|
|
2601
|
-
return this.rest.post(
|
|
2790
|
+
return this.rest.post(Routes17.userChannels(), {
|
|
2602
2791
|
body: { recipient_id: userId },
|
|
2603
2792
|
signal
|
|
2604
2793
|
});
|
|
@@ -2610,7 +2799,7 @@ var UsersAPI = class {
|
|
|
2610
2799
|
* @param options - The options for fetching the user's connections
|
|
2611
2800
|
*/
|
|
2612
2801
|
async getConnections({ signal } = {}) {
|
|
2613
|
-
return this.rest.get(
|
|
2802
|
+
return this.rest.get(Routes17.userConnections(), { signal });
|
|
2614
2803
|
}
|
|
2615
2804
|
/**
|
|
2616
2805
|
* Gets the current user's active application role connection
|
|
@@ -2620,7 +2809,7 @@ var UsersAPI = class {
|
|
|
2620
2809
|
* @param options - The options for fetching the role connections
|
|
2621
2810
|
*/
|
|
2622
2811
|
async getApplicationRoleConnection(applicationId, { signal } = {}) {
|
|
2623
|
-
return this.rest.get(
|
|
2812
|
+
return this.rest.get(Routes17.userApplicationRoleConnection(applicationId), {
|
|
2624
2813
|
signal
|
|
2625
2814
|
});
|
|
2626
2815
|
}
|
|
@@ -2633,7 +2822,7 @@ var UsersAPI = class {
|
|
|
2633
2822
|
* @param options - The options for updating the application role connection
|
|
2634
2823
|
*/
|
|
2635
2824
|
async updateApplicationRoleConnection(applicationId, body, { signal } = {}) {
|
|
2636
|
-
return this.rest.put(
|
|
2825
|
+
return this.rest.put(Routes17.userApplicationRoleConnection(applicationId), {
|
|
2637
2826
|
body,
|
|
2638
2827
|
signal
|
|
2639
2828
|
});
|
|
@@ -2641,9 +2830,9 @@ var UsersAPI = class {
|
|
|
2641
2830
|
};
|
|
2642
2831
|
|
|
2643
2832
|
// src/api/webhook.ts
|
|
2644
|
-
import { makeURLSearchParams as
|
|
2833
|
+
import { makeURLSearchParams as makeURLSearchParams10 } from "@discordjs/rest";
|
|
2645
2834
|
import {
|
|
2646
|
-
Routes as
|
|
2835
|
+
Routes as Routes18
|
|
2647
2836
|
} from "discord-api-types/v10";
|
|
2648
2837
|
var WebhooksAPI = class {
|
|
2649
2838
|
constructor(rest) {
|
|
@@ -2661,7 +2850,7 @@ var WebhooksAPI = class {
|
|
|
2661
2850
|
* @param options - The options for fetching the webhook
|
|
2662
2851
|
*/
|
|
2663
2852
|
async get(id, { token, signal } = {}) {
|
|
2664
|
-
return this.rest.get(
|
|
2853
|
+
return this.rest.get(Routes18.webhook(id, token), {
|
|
2665
2854
|
signal,
|
|
2666
2855
|
auth: !token
|
|
2667
2856
|
});
|
|
@@ -2676,7 +2865,7 @@ var WebhooksAPI = class {
|
|
|
2676
2865
|
* @param options - The options for editing the webhook
|
|
2677
2866
|
*/
|
|
2678
2867
|
async edit(id, body, { token, reason, signal } = {}) {
|
|
2679
|
-
return this.rest.patch(
|
|
2868
|
+
return this.rest.patch(Routes18.webhook(id, token), {
|
|
2680
2869
|
reason,
|
|
2681
2870
|
body,
|
|
2682
2871
|
signal,
|
|
@@ -2692,7 +2881,7 @@ var WebhooksAPI = class {
|
|
|
2692
2881
|
* @param options - The options for deleting the webhook
|
|
2693
2882
|
*/
|
|
2694
2883
|
async delete(id, { token, reason, signal } = {}) {
|
|
2695
|
-
await this.rest.delete(
|
|
2884
|
+
await this.rest.delete(Routes18.webhook(id, token), {
|
|
2696
2885
|
reason,
|
|
2697
2886
|
signal,
|
|
2698
2887
|
auth: !token
|
|
@@ -2707,15 +2896,9 @@ var WebhooksAPI = class {
|
|
|
2707
2896
|
* @param body - The data for executing the webhook
|
|
2708
2897
|
* @param options - The options for executing the webhook
|
|
2709
2898
|
*/
|
|
2710
|
-
async execute(id, token, {
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
with_components,
|
|
2714
|
-
files,
|
|
2715
|
-
...body
|
|
2716
|
-
}, { signal } = {}) {
|
|
2717
|
-
return this.rest.post(Routes16.webhook(id, token), {
|
|
2718
|
-
query: makeURLSearchParams9({ wait, thread_id, with_components }),
|
|
2899
|
+
async execute(id, token, { wait, thread_id, with_components, files, ...body }, { signal } = {}) {
|
|
2900
|
+
return this.rest.post(Routes18.webhook(id, token), {
|
|
2901
|
+
query: makeURLSearchParams10({ wait, thread_id, with_components }),
|
|
2719
2902
|
files,
|
|
2720
2903
|
body,
|
|
2721
2904
|
auth: false,
|
|
@@ -2734,8 +2917,8 @@ var WebhooksAPI = class {
|
|
|
2734
2917
|
* @param options - The options for executing the webhook
|
|
2735
2918
|
*/
|
|
2736
2919
|
async executeSlack(id, token, body, query = {}, { signal } = {}) {
|
|
2737
|
-
await this.rest.post(
|
|
2738
|
-
query:
|
|
2920
|
+
await this.rest.post(Routes18.webhookPlatform(id, token, "slack"), {
|
|
2921
|
+
query: makeURLSearchParams10(query),
|
|
2739
2922
|
body,
|
|
2740
2923
|
auth: false,
|
|
2741
2924
|
signal
|
|
@@ -2752,8 +2935,8 @@ var WebhooksAPI = class {
|
|
|
2752
2935
|
* @param options - The options for executing the webhook
|
|
2753
2936
|
*/
|
|
2754
2937
|
async executeGitHub(id, token, body, query = {}, { signal } = {}) {
|
|
2755
|
-
await this.rest.post(
|
|
2756
|
-
query:
|
|
2938
|
+
await this.rest.post(Routes18.webhookPlatform(id, token, "github"), {
|
|
2939
|
+
query: makeURLSearchParams10(query),
|
|
2757
2940
|
body,
|
|
2758
2941
|
signal,
|
|
2759
2942
|
auth: false
|
|
@@ -2770,8 +2953,8 @@ var WebhooksAPI = class {
|
|
|
2770
2953
|
* @param options - The options for fetching the message
|
|
2771
2954
|
*/
|
|
2772
2955
|
async getMessage(id, token, messageId, query = {}, { signal } = {}) {
|
|
2773
|
-
return this.rest.get(
|
|
2774
|
-
query:
|
|
2956
|
+
return this.rest.get(Routes18.webhookMessage(id, token, messageId), {
|
|
2957
|
+
query: makeURLSearchParams10(query),
|
|
2775
2958
|
auth: false,
|
|
2776
2959
|
signal
|
|
2777
2960
|
});
|
|
@@ -2786,14 +2969,9 @@ var WebhooksAPI = class {
|
|
|
2786
2969
|
* @param body - The data for editing the message
|
|
2787
2970
|
* @param options - The options for editing the message
|
|
2788
2971
|
*/
|
|
2789
|
-
async editMessage(id, token, messageId, {
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
files,
|
|
2793
|
-
...body
|
|
2794
|
-
}, { signal } = {}) {
|
|
2795
|
-
return this.rest.patch(Routes16.webhookMessage(id, token, messageId), {
|
|
2796
|
-
query: makeURLSearchParams9({ thread_id, with_components }),
|
|
2972
|
+
async editMessage(id, token, messageId, { thread_id, with_components, files, ...body }, { signal } = {}) {
|
|
2973
|
+
return this.rest.patch(Routes18.webhookMessage(id, token, messageId), {
|
|
2974
|
+
query: makeURLSearchParams10({ thread_id, with_components }),
|
|
2797
2975
|
auth: false,
|
|
2798
2976
|
body,
|
|
2799
2977
|
signal,
|
|
@@ -2811,8 +2989,8 @@ var WebhooksAPI = class {
|
|
|
2811
2989
|
* @param options - The options for deleting the message
|
|
2812
2990
|
*/
|
|
2813
2991
|
async deleteMessage(id, token, messageId, query = {}, { signal } = {}) {
|
|
2814
|
-
await this.rest.delete(
|
|
2815
|
-
query:
|
|
2992
|
+
await this.rest.delete(Routes18.webhookMessage(id, token, messageId), {
|
|
2993
|
+
query: makeURLSearchParams10(query),
|
|
2816
2994
|
auth: false,
|
|
2817
2995
|
signal
|
|
2818
2996
|
});
|
|
@@ -2826,12 +3004,14 @@ var API = class {
|
|
|
2826
3004
|
this.applicationCommands = new ApplicationCommandsAPI(rest);
|
|
2827
3005
|
this.applications = new ApplicationsAPI(rest);
|
|
2828
3006
|
this.channels = new ChannelsAPI(rest);
|
|
3007
|
+
this.gateway = new GatewayAPI(rest);
|
|
2829
3008
|
this.guilds = new GuildsAPI(rest);
|
|
2830
3009
|
this.invites = new InvitesAPI(rest);
|
|
2831
3010
|
this.monetization = new MonetizationAPI(rest);
|
|
2832
3011
|
this.oauth2 = new OAuth2API(rest);
|
|
2833
3012
|
this.poll = new PollAPI(rest);
|
|
2834
3013
|
this.roleConnections = new RoleConnectionsAPI(rest);
|
|
3014
|
+
this.soundboardSounds = new SoundboardSoundsAPI(rest);
|
|
2835
3015
|
this.stageInstances = new StageInstancesAPI(rest);
|
|
2836
3016
|
this.stickers = new StickersAPI(rest);
|
|
2837
3017
|
this.threads = new ThreadsAPI(rest);
|
|
@@ -2846,6 +3026,7 @@ var API = class {
|
|
|
2846
3026
|
applicationCommands;
|
|
2847
3027
|
applications;
|
|
2848
3028
|
channels;
|
|
3029
|
+
gateway;
|
|
2849
3030
|
guilds;
|
|
2850
3031
|
interactions;
|
|
2851
3032
|
invites;
|
|
@@ -2853,6 +3034,7 @@ var API = class {
|
|
|
2853
3034
|
oauth2;
|
|
2854
3035
|
poll;
|
|
2855
3036
|
roleConnections;
|
|
3037
|
+
soundboardSounds;
|
|
2856
3038
|
stageInstances;
|
|
2857
3039
|
stickers;
|
|
2858
3040
|
threads;
|
|
@@ -2862,8 +3044,8 @@ var API = class {
|
|
|
2862
3044
|
};
|
|
2863
3045
|
|
|
2864
3046
|
// src/client.ts
|
|
2865
|
-
import { clearTimeout, setTimeout } from "
|
|
2866
|
-
import { calculateShardId } from "@discordjs/util";
|
|
3047
|
+
import { clearTimeout, setTimeout } from "timers";
|
|
3048
|
+
import { calculateShardId, GatewayRateLimitError } from "@discordjs/util";
|
|
2867
3049
|
import { WebSocketShardEvents } from "@discordjs/ws";
|
|
2868
3050
|
import { DiscordSnowflake } from "@sapphire/snowflake";
|
|
2869
3051
|
import { AsyncEventEmitter } from "@vladfrangu/async_event_emitter";
|
|
@@ -2871,6 +3053,10 @@ import {
|
|
|
2871
3053
|
GatewayDispatchEvents,
|
|
2872
3054
|
GatewayOpcodes
|
|
2873
3055
|
} from "discord-api-types/v10";
|
|
3056
|
+
function createTimer(controller, timeout) {
|
|
3057
|
+
return setTimeout(() => controller.abort(), timeout);
|
|
3058
|
+
}
|
|
3059
|
+
__name(createTimer, "createTimer");
|
|
2874
3060
|
var Client = class extends AsyncEventEmitter {
|
|
2875
3061
|
static {
|
|
2876
3062
|
__name(this, "Client");
|
|
@@ -2905,10 +3091,19 @@ var Client = class extends AsyncEventEmitter {
|
|
|
2905
3091
|
const shardId = calculateShardId(options.guild_id, await this.gateway.getShardCount());
|
|
2906
3092
|
const nonce = options.nonce ?? DiscordSnowflake.generate().toString();
|
|
2907
3093
|
const controller = new AbortController();
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
3094
|
+
let timer = createTimer(controller, timeout);
|
|
3095
|
+
const onRatelimit = /* @__PURE__ */ __name(({ data }) => {
|
|
3096
|
+
if (data.meta.nonce === nonce) {
|
|
3097
|
+
controller.abort(new GatewayRateLimitError(data, options));
|
|
3098
|
+
}
|
|
3099
|
+
}, "onRatelimit");
|
|
3100
|
+
const cleanup = /* @__PURE__ */ __name(() => {
|
|
3101
|
+
if (timer) {
|
|
3102
|
+
clearTimeout(timer);
|
|
3103
|
+
}
|
|
3104
|
+
this.off(GatewayDispatchEvents.RateLimited, onRatelimit);
|
|
3105
|
+
}, "cleanup");
|
|
3106
|
+
this.on(GatewayDispatchEvents.RateLimited, onRatelimit);
|
|
2912
3107
|
await this.gateway.send(shardId, {
|
|
2913
3108
|
op: GatewayOpcodes.RequestGuildMembers,
|
|
2914
3109
|
// eslint-disable-next-line id-length
|
|
@@ -2933,21 +3128,19 @@ var Client = class extends AsyncEventEmitter {
|
|
|
2933
3128
|
chunkIndex: data.chunk_index,
|
|
2934
3129
|
chunkCount: data.chunk_count
|
|
2935
3130
|
};
|
|
2936
|
-
if (data.chunk_index >= data.chunk_count - 1)
|
|
2937
|
-
|
|
2938
|
-
} else {
|
|
2939
|
-
timer = createTimer();
|
|
2940
|
-
}
|
|
3131
|
+
if (data.chunk_index >= data.chunk_count - 1) break;
|
|
3132
|
+
timer = createTimer(controller, timeout);
|
|
2941
3133
|
}
|
|
2942
3134
|
} catch (error) {
|
|
2943
3135
|
if (error instanceof Error && error.name === "AbortError") {
|
|
3136
|
+
if (error.cause instanceof GatewayRateLimitError) {
|
|
3137
|
+
throw error.cause;
|
|
3138
|
+
}
|
|
2944
3139
|
throw new Error("Request timed out");
|
|
2945
3140
|
}
|
|
2946
3141
|
throw error;
|
|
2947
3142
|
} finally {
|
|
2948
|
-
|
|
2949
|
-
clearTimeout(timer);
|
|
2950
|
-
}
|
|
3143
|
+
cleanup();
|
|
2951
3144
|
}
|
|
2952
3145
|
}
|
|
2953
3146
|
/**
|
|
@@ -2974,6 +3167,86 @@ var Client = class extends AsyncEventEmitter {
|
|
|
2974
3167
|
}
|
|
2975
3168
|
return { members, nonce, notFound, presences };
|
|
2976
3169
|
}
|
|
3170
|
+
/**
|
|
3171
|
+
* Requests soundboard sounds from the gateway and returns an async iterator that yields the data from each soundboard sounds event.
|
|
3172
|
+
*
|
|
3173
|
+
* @see {@link https://discord.com/developers/docs/topics/gateway-events#request-soundboard-sounds}
|
|
3174
|
+
* @param options - The options for the request
|
|
3175
|
+
* @param timeout - The timeout for waiting for each soundboard sounds
|
|
3176
|
+
* @example
|
|
3177
|
+
* Requesting soundboard sounds for specific guilds
|
|
3178
|
+
* ```ts
|
|
3179
|
+
* for await (const { guildId, soundboardSounds } of this.requestSoundboardSoundsIterator({
|
|
3180
|
+
* guild_ids: ['1234567890', '9876543210'],
|
|
3181
|
+
* })) {
|
|
3182
|
+
* console.log(`Soundboard sounds for guild ${guildId}:`, soundboardSounds);
|
|
3183
|
+
* }
|
|
3184
|
+
* ```
|
|
3185
|
+
*/
|
|
3186
|
+
async *requestSoundboardSoundsIterator(options, timeout = 1e4) {
|
|
3187
|
+
const shardCount = await this.gateway.getShardCount();
|
|
3188
|
+
const shardIds = Map.groupBy(options.guild_ids, (guildId) => calculateShardId(guildId, shardCount));
|
|
3189
|
+
const controller = new AbortController();
|
|
3190
|
+
let timer = createTimer(controller, timeout);
|
|
3191
|
+
for (const [shardId, guildIds] of shardIds) {
|
|
3192
|
+
await this.gateway.send(shardId, {
|
|
3193
|
+
op: GatewayOpcodes.RequestSoundboardSounds,
|
|
3194
|
+
// eslint-disable-next-line id-length
|
|
3195
|
+
d: {
|
|
3196
|
+
...options,
|
|
3197
|
+
guild_ids: guildIds
|
|
3198
|
+
}
|
|
3199
|
+
});
|
|
3200
|
+
}
|
|
3201
|
+
try {
|
|
3202
|
+
const iterator = AsyncEventEmitter.on(this, GatewayDispatchEvents.SoundboardSounds, {
|
|
3203
|
+
signal: controller.signal
|
|
3204
|
+
});
|
|
3205
|
+
const guildIds = new Set(options.guild_ids);
|
|
3206
|
+
for await (const [{ data }] of iterator) {
|
|
3207
|
+
if (!guildIds.has(data.guild_id)) continue;
|
|
3208
|
+
clearTimeout(timer);
|
|
3209
|
+
timer = void 0;
|
|
3210
|
+
yield {
|
|
3211
|
+
guildId: data.guild_id,
|
|
3212
|
+
soundboardSounds: data.soundboard_sounds
|
|
3213
|
+
};
|
|
3214
|
+
guildIds.delete(data.guild_id);
|
|
3215
|
+
if (guildIds.size === 0) break;
|
|
3216
|
+
timer = createTimer(controller, timeout);
|
|
3217
|
+
}
|
|
3218
|
+
} catch (error) {
|
|
3219
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
3220
|
+
throw new Error("Request timed out");
|
|
3221
|
+
}
|
|
3222
|
+
throw error;
|
|
3223
|
+
} finally {
|
|
3224
|
+
if (timer) {
|
|
3225
|
+
clearTimeout(timer);
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
/**
|
|
3230
|
+
* Requests soundboard sounds from the gateway.
|
|
3231
|
+
*
|
|
3232
|
+
* @see {@link https://discord.com/developers/docs/topics/gateway-events#request-soundboard-sounds}
|
|
3233
|
+
* @param options - The options for the request
|
|
3234
|
+
* @param timeout - The timeout for waiting for each soundboard sounds event
|
|
3235
|
+
* @example
|
|
3236
|
+
* Requesting soundboard sounds for specific guilds
|
|
3237
|
+
* ```ts
|
|
3238
|
+
* const soundboardSounds = await client.requestSoundboardSounds({ guild_ids: ['1234567890', '9876543210'], });
|
|
3239
|
+
*
|
|
3240
|
+
* console.log(soundboardSounds.get('1234567890'));
|
|
3241
|
+
* ```
|
|
3242
|
+
*/
|
|
3243
|
+
async requestSoundboardSounds(options, timeout = 1e4) {
|
|
3244
|
+
const soundboardSounds = /* @__PURE__ */ new Map();
|
|
3245
|
+
for await (const data of this.requestSoundboardSoundsIterator(options, timeout)) {
|
|
3246
|
+
soundboardSounds.set(data.guildId, data.soundboardSounds);
|
|
3247
|
+
}
|
|
3248
|
+
return soundboardSounds;
|
|
3249
|
+
}
|
|
2977
3250
|
/**
|
|
2978
3251
|
* Updates the voice state of the bot user
|
|
2979
3252
|
*
|
|
@@ -3029,13 +3302,16 @@ __name(withFiles, "withFiles");
|
|
|
3029
3302
|
|
|
3030
3303
|
// src/index.ts
|
|
3031
3304
|
export * from "discord-api-types/v10";
|
|
3032
|
-
|
|
3305
|
+
import { GatewayRateLimitError as GatewayRateLimitError2 } from "@discordjs/util";
|
|
3306
|
+
var version = "2.4.0";
|
|
3033
3307
|
export {
|
|
3034
3308
|
API,
|
|
3035
3309
|
ApplicationCommandsAPI,
|
|
3036
3310
|
ApplicationsAPI,
|
|
3037
3311
|
ChannelsAPI,
|
|
3038
3312
|
Client,
|
|
3313
|
+
GatewayAPI,
|
|
3314
|
+
GatewayRateLimitError2 as GatewayRateLimitError,
|
|
3039
3315
|
GuildsAPI,
|
|
3040
3316
|
InteractionsAPI,
|
|
3041
3317
|
InvitesAPI,
|
|
@@ -3043,6 +3319,7 @@ export {
|
|
|
3043
3319
|
OAuth2API,
|
|
3044
3320
|
PollAPI,
|
|
3045
3321
|
RoleConnectionsAPI,
|
|
3322
|
+
SoundboardSoundsAPI,
|
|
3046
3323
|
StageInstancesAPI,
|
|
3047
3324
|
StickersAPI,
|
|
3048
3325
|
ThreadsAPI,
|