@discordjs/core 2.2.2 → 2.3.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 +50 -2
- package/dist/http-only.d.ts +50 -2
- package/dist/http-only.js +235 -157
- package/dist/http-only.js.map +1 -1
- package/dist/http-only.mjs +227 -150
- package/dist/http-only.mjs.map +1 -1
- package/dist/index.d.mts +50 -2
- package/dist/index.d.ts +50 -2
- package/dist/index.js +240 -162
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +227 -150
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -753,17 +753,77 @@ var ChannelsAPI = class {
|
|
|
753
753
|
signal
|
|
754
754
|
});
|
|
755
755
|
}
|
|
756
|
+
/**
|
|
757
|
+
* Adds a recipient to a group DM channel
|
|
758
|
+
*
|
|
759
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#group-dm-add-recipient}
|
|
760
|
+
* @param channelId - The id of the channel to add the recipient to
|
|
761
|
+
* @param userId - The id of the user to add as a recipient
|
|
762
|
+
* @param body - The data for adding the recipient
|
|
763
|
+
* @param options - The options for adding the recipient
|
|
764
|
+
*/
|
|
765
|
+
async addGroupDMRecipient(channelId, userId, body, { signal } = {}) {
|
|
766
|
+
await this.rest.put(Routes3.channelRecipient(channelId, userId), {
|
|
767
|
+
body,
|
|
768
|
+
signal
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Removes a recipient from a group DM channel
|
|
773
|
+
*
|
|
774
|
+
* @see {@link https://discord.com/developers/docs/resources/channel#group-dm-remove-recipient}
|
|
775
|
+
* @param channelId - The id of the channel to remove the recipient from
|
|
776
|
+
* @param userId - The id of the user to remove as a recipient
|
|
777
|
+
* @param options - The options for removing the recipient
|
|
778
|
+
*/
|
|
779
|
+
async removeGroupDMRecipient(channelId, userId, { signal } = {}) {
|
|
780
|
+
await this.rest.delete(Routes3.channelRecipient(channelId, userId), {
|
|
781
|
+
signal
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
|
|
786
|
+
// src/api/gateway.ts
|
|
787
|
+
import { Routes as Routes4 } from "discord-api-types/v10";
|
|
788
|
+
var GatewayAPI = class {
|
|
789
|
+
constructor(rest) {
|
|
790
|
+
this.rest = rest;
|
|
791
|
+
}
|
|
792
|
+
static {
|
|
793
|
+
__name(this, "GatewayAPI");
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Gets gateway information.
|
|
797
|
+
*
|
|
798
|
+
* @see {@link https://discord.com/developers/docs/events/gateway#get-gateway}
|
|
799
|
+
* @param options - The options for fetching the gateway information
|
|
800
|
+
*/
|
|
801
|
+
async get({ signal } = {}) {
|
|
802
|
+
return this.rest.get(Routes4.gateway(), {
|
|
803
|
+
auth: false,
|
|
804
|
+
signal
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Gets gateway information with additional metadata.
|
|
809
|
+
*
|
|
810
|
+
* @see {@link https://discord.com/developers/docs/events/gateway#get-gateway-bot}
|
|
811
|
+
* @param options - The options for fetching the gateway information
|
|
812
|
+
*/
|
|
813
|
+
async getBot({ signal } = {}) {
|
|
814
|
+
return this.rest.get(Routes4.gatewayBot(), { signal });
|
|
815
|
+
}
|
|
756
816
|
};
|
|
757
817
|
|
|
758
818
|
// src/api/guild.ts
|
|
759
819
|
import { makeURLSearchParams as makeURLSearchParams3 } from "@discordjs/rest";
|
|
760
820
|
import {
|
|
761
|
-
Routes as
|
|
821
|
+
Routes as Routes6
|
|
762
822
|
} from "discord-api-types/v10";
|
|
763
823
|
|
|
764
824
|
// src/api/voice.ts
|
|
765
825
|
import {
|
|
766
|
-
Routes as
|
|
826
|
+
Routes as Routes5
|
|
767
827
|
} from "discord-api-types/v10";
|
|
768
828
|
var VoiceAPI = class {
|
|
769
829
|
constructor(rest) {
|
|
@@ -779,7 +839,7 @@ var VoiceAPI = class {
|
|
|
779
839
|
* @param options - The options for fetching the voice regions
|
|
780
840
|
*/
|
|
781
841
|
async getVoiceRegions({ signal } = {}) {
|
|
782
|
-
return this.rest.get(
|
|
842
|
+
return this.rest.get(Routes5.voiceRegions(), { signal });
|
|
783
843
|
}
|
|
784
844
|
/**
|
|
785
845
|
* Fetches voice state of a user by their id
|
|
@@ -788,7 +848,7 @@ var VoiceAPI = class {
|
|
|
788
848
|
* @param options - The options for fetching user voice state
|
|
789
849
|
*/
|
|
790
850
|
async getUserVoiceState(guildId, userId, { signal } = {}) {
|
|
791
|
-
return this.rest.get(
|
|
851
|
+
return this.rest.get(Routes5.guildVoiceState(guildId, userId), {
|
|
792
852
|
signal
|
|
793
853
|
});
|
|
794
854
|
}
|
|
@@ -799,7 +859,7 @@ var VoiceAPI = class {
|
|
|
799
859
|
* @param options - The options for fetching user voice state
|
|
800
860
|
*/
|
|
801
861
|
async getVoiceState(guildId, { signal } = {}) {
|
|
802
|
-
return this.rest.get(
|
|
862
|
+
return this.rest.get(Routes5.guildVoiceState(guildId, "@me"), {
|
|
803
863
|
signal
|
|
804
864
|
});
|
|
805
865
|
}
|
|
@@ -813,7 +873,7 @@ var VoiceAPI = class {
|
|
|
813
873
|
* @param options - The options for editing the voice state
|
|
814
874
|
*/
|
|
815
875
|
async editUserVoiceState(guildId, userId, body, { reason, signal } = {}) {
|
|
816
|
-
return this.rest.patch(
|
|
876
|
+
return this.rest.patch(Routes5.guildVoiceState(guildId, userId), {
|
|
817
877
|
reason,
|
|
818
878
|
body,
|
|
819
879
|
signal
|
|
@@ -828,7 +888,7 @@ var VoiceAPI = class {
|
|
|
828
888
|
* @param options - The options for editing the voice state
|
|
829
889
|
*/
|
|
830
890
|
async editVoiceState(guildId, body = {}, { signal } = {}) {
|
|
831
|
-
return this.rest.patch(
|
|
891
|
+
return this.rest.patch(Routes5.guildVoiceState(guildId, "@me"), {
|
|
832
892
|
body,
|
|
833
893
|
signal
|
|
834
894
|
});
|
|
@@ -850,7 +910,7 @@ var GuildsAPI = class {
|
|
|
850
910
|
if ("with_counts" in queryOrOptions) {
|
|
851
911
|
requestData.query = makeURLSearchParams3(queryOrOptions);
|
|
852
912
|
}
|
|
853
|
-
return this.rest.get(
|
|
913
|
+
return this.rest.get(Routes6.guild(guildId), requestData);
|
|
854
914
|
}
|
|
855
915
|
/**
|
|
856
916
|
* Fetches a guild preview
|
|
@@ -860,7 +920,7 @@ var GuildsAPI = class {
|
|
|
860
920
|
* @param options - The options for fetching the guild preview
|
|
861
921
|
*/
|
|
862
922
|
async getPreview(guildId, { signal } = {}) {
|
|
863
|
-
return this.rest.get(
|
|
923
|
+
return this.rest.get(Routes6.guildPreview(guildId), {
|
|
864
924
|
signal
|
|
865
925
|
});
|
|
866
926
|
}
|
|
@@ -873,7 +933,7 @@ var GuildsAPI = class {
|
|
|
873
933
|
* @deprecated API related to guild ownership may no longer be used.
|
|
874
934
|
*/
|
|
875
935
|
async create(body, { signal } = {}) {
|
|
876
|
-
return this.rest.post(
|
|
936
|
+
return this.rest.post(Routes6.guilds(), { body, signal });
|
|
877
937
|
}
|
|
878
938
|
/**
|
|
879
939
|
* Edits a guild
|
|
@@ -884,7 +944,7 @@ var GuildsAPI = class {
|
|
|
884
944
|
* @param options - The options for editing the guild
|
|
885
945
|
*/
|
|
886
946
|
async edit(guildId, body, { reason, signal } = {}) {
|
|
887
|
-
return this.rest.patch(
|
|
947
|
+
return this.rest.patch(Routes6.guild(guildId), {
|
|
888
948
|
reason,
|
|
889
949
|
body,
|
|
890
950
|
signal
|
|
@@ -899,7 +959,7 @@ var GuildsAPI = class {
|
|
|
899
959
|
* @deprecated API related to guild ownership may no longer be used.
|
|
900
960
|
*/
|
|
901
961
|
async delete(guildId, { signal } = {}) {
|
|
902
|
-
await this.rest.delete(
|
|
962
|
+
await this.rest.delete(Routes6.guild(guildId), { signal });
|
|
903
963
|
}
|
|
904
964
|
/**
|
|
905
965
|
* Adds user to the guild
|
|
@@ -911,7 +971,7 @@ var GuildsAPI = class {
|
|
|
911
971
|
* @param options - The options for adding users to the guild
|
|
912
972
|
*/
|
|
913
973
|
async addMember(guildId, userId, body, { signal } = {}) {
|
|
914
|
-
return this.rest.put(
|
|
974
|
+
return this.rest.put(Routes6.guildMember(guildId, userId), {
|
|
915
975
|
body,
|
|
916
976
|
signal
|
|
917
977
|
});
|
|
@@ -925,7 +985,7 @@ var GuildsAPI = class {
|
|
|
925
985
|
* @param options - The options for fetching the guild members
|
|
926
986
|
*/
|
|
927
987
|
async getMembers(guildId, query = {}, { signal } = {}) {
|
|
928
|
-
return this.rest.get(
|
|
988
|
+
return this.rest.get(Routes6.guildMembers(guildId), {
|
|
929
989
|
query: makeURLSearchParams3(query),
|
|
930
990
|
signal
|
|
931
991
|
});
|
|
@@ -938,7 +998,7 @@ var GuildsAPI = class {
|
|
|
938
998
|
* @param options - The options for fetching the guild channels
|
|
939
999
|
*/
|
|
940
1000
|
async getChannels(guildId, { signal } = {}) {
|
|
941
|
-
return this.rest.get(
|
|
1001
|
+
return this.rest.get(Routes6.guildChannels(guildId), {
|
|
942
1002
|
signal
|
|
943
1003
|
});
|
|
944
1004
|
}
|
|
@@ -951,7 +1011,7 @@ var GuildsAPI = class {
|
|
|
951
1011
|
* @param options - The options for creating the guild channel
|
|
952
1012
|
*/
|
|
953
1013
|
async createChannel(guildId, body, { reason, signal } = {}) {
|
|
954
|
-
return this.rest.post(
|
|
1014
|
+
return this.rest.post(Routes6.guildChannels(guildId), {
|
|
955
1015
|
reason,
|
|
956
1016
|
body,
|
|
957
1017
|
signal
|
|
@@ -966,7 +1026,7 @@ var GuildsAPI = class {
|
|
|
966
1026
|
* @param options - The options for editing the guild channel positions
|
|
967
1027
|
*/
|
|
968
1028
|
async setChannelPositions(guildId, body, { reason, signal } = {}) {
|
|
969
|
-
await this.rest.patch(
|
|
1029
|
+
await this.rest.patch(Routes6.guildChannels(guildId), { reason, body, signal });
|
|
970
1030
|
}
|
|
971
1031
|
/**
|
|
972
1032
|
* Fetches the active threads in a guild
|
|
@@ -976,7 +1036,7 @@ var GuildsAPI = class {
|
|
|
976
1036
|
* @param options - The options for fetching the active threads
|
|
977
1037
|
*/
|
|
978
1038
|
async getActiveThreads(guildId, { signal } = {}) {
|
|
979
|
-
return this.rest.get(
|
|
1039
|
+
return this.rest.get(Routes6.guildActiveThreads(guildId), { signal });
|
|
980
1040
|
}
|
|
981
1041
|
/**
|
|
982
1042
|
* Fetches a guild member ban
|
|
@@ -987,7 +1047,7 @@ var GuildsAPI = class {
|
|
|
987
1047
|
* @param options - The options for fetching the ban
|
|
988
1048
|
*/
|
|
989
1049
|
async getMemberBan(guildId, userId, { signal } = {}) {
|
|
990
|
-
return this.rest.get(
|
|
1050
|
+
return this.rest.get(Routes6.guildBan(guildId, userId), { signal });
|
|
991
1051
|
}
|
|
992
1052
|
/**
|
|
993
1053
|
* Fetches guild member bans
|
|
@@ -998,7 +1058,7 @@ var GuildsAPI = class {
|
|
|
998
1058
|
* @param options - The options for fetching the bans
|
|
999
1059
|
*/
|
|
1000
1060
|
async getMemberBans(guildId, query = {}, { signal } = {}) {
|
|
1001
|
-
return this.rest.get(
|
|
1061
|
+
return this.rest.get(Routes6.guildBans(guildId), {
|
|
1002
1062
|
query: makeURLSearchParams3(query),
|
|
1003
1063
|
signal
|
|
1004
1064
|
});
|
|
@@ -1013,7 +1073,7 @@ var GuildsAPI = class {
|
|
|
1013
1073
|
* @param options - The options for banning the user
|
|
1014
1074
|
*/
|
|
1015
1075
|
async banUser(guildId, userId, body = {}, { reason, signal } = {}) {
|
|
1016
|
-
await this.rest.put(
|
|
1076
|
+
await this.rest.put(Routes6.guildBan(guildId, userId), { reason, body, signal });
|
|
1017
1077
|
}
|
|
1018
1078
|
/**
|
|
1019
1079
|
* Unbans a user from a guild
|
|
@@ -1024,7 +1084,7 @@ var GuildsAPI = class {
|
|
|
1024
1084
|
* @param options - The options for unbanning the user
|
|
1025
1085
|
*/
|
|
1026
1086
|
async unbanUser(guildId, userId, { reason, signal } = {}) {
|
|
1027
|
-
await this.rest.delete(
|
|
1087
|
+
await this.rest.delete(Routes6.guildBan(guildId, userId), { reason, signal });
|
|
1028
1088
|
}
|
|
1029
1089
|
/**
|
|
1030
1090
|
* Bulk ban users from a guild
|
|
@@ -1035,7 +1095,7 @@ var GuildsAPI = class {
|
|
|
1035
1095
|
* @param options - The options for bulk banning users
|
|
1036
1096
|
*/
|
|
1037
1097
|
async bulkBanUsers(guildId, body, { reason, signal } = {}) {
|
|
1038
|
-
return this.rest.post(
|
|
1098
|
+
return this.rest.post(Routes6.guildBulkBan(guildId), {
|
|
1039
1099
|
reason,
|
|
1040
1100
|
body,
|
|
1041
1101
|
signal
|
|
@@ -1049,7 +1109,7 @@ var GuildsAPI = class {
|
|
|
1049
1109
|
* @param options - The options for fetching the guild roles
|
|
1050
1110
|
*/
|
|
1051
1111
|
async getRoles(guildId, { signal } = {}) {
|
|
1052
|
-
return this.rest.get(
|
|
1112
|
+
return this.rest.get(Routes6.guildRoles(guildId), { signal });
|
|
1053
1113
|
}
|
|
1054
1114
|
/**
|
|
1055
1115
|
* Get a role in a guild
|
|
@@ -1060,7 +1120,7 @@ var GuildsAPI = class {
|
|
|
1060
1120
|
* @param options - The options for fetching the guild role
|
|
1061
1121
|
*/
|
|
1062
1122
|
async getRole(guildId, roleId, { signal } = {}) {
|
|
1063
|
-
return this.rest.get(
|
|
1123
|
+
return this.rest.get(Routes6.guildRole(guildId, roleId), { signal });
|
|
1064
1124
|
}
|
|
1065
1125
|
/**
|
|
1066
1126
|
* Creates a guild role
|
|
@@ -1071,7 +1131,7 @@ var GuildsAPI = class {
|
|
|
1071
1131
|
* @param options - The options for creating the guild role
|
|
1072
1132
|
*/
|
|
1073
1133
|
async createRole(guildId, body, { reason, signal } = {}) {
|
|
1074
|
-
return this.rest.post(
|
|
1134
|
+
return this.rest.post(Routes6.guildRoles(guildId), { reason, body, signal });
|
|
1075
1135
|
}
|
|
1076
1136
|
/**
|
|
1077
1137
|
* Sets role positions in a guild
|
|
@@ -1082,7 +1142,7 @@ var GuildsAPI = class {
|
|
|
1082
1142
|
* @param options - The options for setting role positions
|
|
1083
1143
|
*/
|
|
1084
1144
|
async setRolePositions(guildId, body, { reason, signal } = {}) {
|
|
1085
|
-
return this.rest.patch(
|
|
1145
|
+
return this.rest.patch(Routes6.guildRoles(guildId), {
|
|
1086
1146
|
reason,
|
|
1087
1147
|
body,
|
|
1088
1148
|
signal
|
|
@@ -1098,7 +1158,7 @@ var GuildsAPI = class {
|
|
|
1098
1158
|
* @param options - The options for editing the guild role
|
|
1099
1159
|
*/
|
|
1100
1160
|
async editRole(guildId, roleId, body, { reason, signal } = {}) {
|
|
1101
|
-
return this.rest.patch(
|
|
1161
|
+
return this.rest.patch(Routes6.guildRole(guildId, roleId), {
|
|
1102
1162
|
reason,
|
|
1103
1163
|
body,
|
|
1104
1164
|
signal
|
|
@@ -1113,7 +1173,7 @@ var GuildsAPI = class {
|
|
|
1113
1173
|
* @param options - The options for deleting the guild role
|
|
1114
1174
|
*/
|
|
1115
1175
|
async deleteRole(guildId, roleId, { reason, signal } = {}) {
|
|
1116
|
-
await this.rest.delete(
|
|
1176
|
+
await this.rest.delete(Routes6.guildRole(guildId, roleId), { reason, signal });
|
|
1117
1177
|
}
|
|
1118
1178
|
/**
|
|
1119
1179
|
* Edits the multi-factor-authentication (MFA) level of a guild
|
|
@@ -1125,7 +1185,7 @@ var GuildsAPI = class {
|
|
|
1125
1185
|
* @deprecated API related to guild ownership may no longer be used.
|
|
1126
1186
|
*/
|
|
1127
1187
|
async editMFALevel(guildId, level, { reason, signal } = {}) {
|
|
1128
|
-
return this.rest.post(
|
|
1188
|
+
return this.rest.post(Routes6.guildMFA(guildId), {
|
|
1129
1189
|
reason,
|
|
1130
1190
|
signal,
|
|
1131
1191
|
body: { level }
|
|
@@ -1140,7 +1200,7 @@ var GuildsAPI = class {
|
|
|
1140
1200
|
* @param options - The options for fetching the number of pruned members
|
|
1141
1201
|
*/
|
|
1142
1202
|
async getPruneCount(guildId, query = {}, { signal } = {}) {
|
|
1143
|
-
return this.rest.get(
|
|
1203
|
+
return this.rest.get(Routes6.guildPrune(guildId), {
|
|
1144
1204
|
signal,
|
|
1145
1205
|
query: makeURLSearchParams3(query)
|
|
1146
1206
|
});
|
|
@@ -1154,7 +1214,7 @@ var GuildsAPI = class {
|
|
|
1154
1214
|
* @param options - The options for initiating the prune
|
|
1155
1215
|
*/
|
|
1156
1216
|
async beginPrune(guildId, body = {}, { reason, signal } = {}) {
|
|
1157
|
-
return this.rest.post(
|
|
1217
|
+
return this.rest.post(Routes6.guildPrune(guildId), {
|
|
1158
1218
|
body,
|
|
1159
1219
|
reason,
|
|
1160
1220
|
signal
|
|
@@ -1168,7 +1228,7 @@ var GuildsAPI = class {
|
|
|
1168
1228
|
* @param options - The options for fetching the voice regions
|
|
1169
1229
|
*/
|
|
1170
1230
|
async getVoiceRegions(guildId, { signal } = {}) {
|
|
1171
|
-
return this.rest.get(
|
|
1231
|
+
return this.rest.get(Routes6.guildVoiceRegions(guildId), { signal });
|
|
1172
1232
|
}
|
|
1173
1233
|
/**
|
|
1174
1234
|
* Fetches the invites for a guild
|
|
@@ -1178,7 +1238,7 @@ var GuildsAPI = class {
|
|
|
1178
1238
|
* @param options - The options for fetching the invites
|
|
1179
1239
|
*/
|
|
1180
1240
|
async getInvites(guildId, { signal } = {}) {
|
|
1181
|
-
return this.rest.get(
|
|
1241
|
+
return this.rest.get(Routes6.guildInvites(guildId), { signal });
|
|
1182
1242
|
}
|
|
1183
1243
|
/**
|
|
1184
1244
|
* Fetches the integrations for a guild
|
|
@@ -1188,7 +1248,7 @@ var GuildsAPI = class {
|
|
|
1188
1248
|
* @param options - The options for fetching the integrations
|
|
1189
1249
|
*/
|
|
1190
1250
|
async getIntegrations(guildId, { signal } = {}) {
|
|
1191
|
-
return this.rest.get(
|
|
1251
|
+
return this.rest.get(Routes6.guildIntegrations(guildId), { signal });
|
|
1192
1252
|
}
|
|
1193
1253
|
/**
|
|
1194
1254
|
* Deletes an integration from a guild
|
|
@@ -1199,7 +1259,7 @@ var GuildsAPI = class {
|
|
|
1199
1259
|
* @param options - The options for deleting the integration
|
|
1200
1260
|
*/
|
|
1201
1261
|
async deleteIntegration(guildId, integrationId, { reason, signal } = {}) {
|
|
1202
|
-
await this.rest.delete(
|
|
1262
|
+
await this.rest.delete(Routes6.guildIntegration(guildId, integrationId), { reason, signal });
|
|
1203
1263
|
}
|
|
1204
1264
|
/**
|
|
1205
1265
|
* Fetches the widget settings for a guild
|
|
@@ -1209,7 +1269,7 @@ var GuildsAPI = class {
|
|
|
1209
1269
|
* @param options - The options for fetching the widget settings
|
|
1210
1270
|
*/
|
|
1211
1271
|
async getWidgetSettings(guildId, { signal } = {}) {
|
|
1212
|
-
return this.rest.get(
|
|
1272
|
+
return this.rest.get(Routes6.guildWidgetSettings(guildId), {
|
|
1213
1273
|
signal
|
|
1214
1274
|
});
|
|
1215
1275
|
}
|
|
@@ -1222,7 +1282,7 @@ var GuildsAPI = class {
|
|
|
1222
1282
|
* @param options - The options for editing the widget settings
|
|
1223
1283
|
*/
|
|
1224
1284
|
async editWidgetSettings(guildId, body, { reason, signal } = {}) {
|
|
1225
|
-
return this.rest.patch(
|
|
1285
|
+
return this.rest.patch(Routes6.guildWidgetSettings(guildId), {
|
|
1226
1286
|
reason,
|
|
1227
1287
|
body,
|
|
1228
1288
|
signal
|
|
@@ -1236,7 +1296,7 @@ var GuildsAPI = class {
|
|
|
1236
1296
|
* @param options - The options for fetching the widget
|
|
1237
1297
|
*/
|
|
1238
1298
|
async getWidget(guildId, { signal } = {}) {
|
|
1239
|
-
return this.rest.get(
|
|
1299
|
+
return this.rest.get(Routes6.guildWidgetJSON(guildId), { signal });
|
|
1240
1300
|
}
|
|
1241
1301
|
/**
|
|
1242
1302
|
* Fetches the vanity url for a guild
|
|
@@ -1246,7 +1306,7 @@ var GuildsAPI = class {
|
|
|
1246
1306
|
* @param options - The options for fetching the vanity url
|
|
1247
1307
|
*/
|
|
1248
1308
|
async getVanityURL(guildId, { signal } = {}) {
|
|
1249
|
-
return this.rest.get(
|
|
1309
|
+
return this.rest.get(Routes6.guildVanityUrl(guildId), { signal });
|
|
1250
1310
|
}
|
|
1251
1311
|
/**
|
|
1252
1312
|
* Fetches the widget image for a guild
|
|
@@ -1257,7 +1317,7 @@ var GuildsAPI = class {
|
|
|
1257
1317
|
* @param options - The options for fetching the widget image
|
|
1258
1318
|
*/
|
|
1259
1319
|
async getWidgetImage(guildId, style, { signal } = {}) {
|
|
1260
|
-
return this.rest.get(
|
|
1320
|
+
return this.rest.get(Routes6.guildWidgetImage(guildId), {
|
|
1261
1321
|
query: makeURLSearchParams3({ style }),
|
|
1262
1322
|
signal
|
|
1263
1323
|
});
|
|
@@ -1270,7 +1330,7 @@ var GuildsAPI = class {
|
|
|
1270
1330
|
* @param options - The options for fetching the welcome screen
|
|
1271
1331
|
*/
|
|
1272
1332
|
async getWelcomeScreen(guildId, { signal } = {}) {
|
|
1273
|
-
return this.rest.get(
|
|
1333
|
+
return this.rest.get(Routes6.guildWelcomeScreen(guildId), { signal });
|
|
1274
1334
|
}
|
|
1275
1335
|
/**
|
|
1276
1336
|
* Edits the welcome screen for a guild
|
|
@@ -1281,7 +1341,7 @@ var GuildsAPI = class {
|
|
|
1281
1341
|
* @param options - The options for editing the welcome screen
|
|
1282
1342
|
*/
|
|
1283
1343
|
async editWelcomeScreen(guildId, body, { reason, signal } = {}) {
|
|
1284
|
-
return this.rest.patch(
|
|
1344
|
+
return this.rest.patch(Routes6.guildWelcomeScreen(guildId), {
|
|
1285
1345
|
reason,
|
|
1286
1346
|
body,
|
|
1287
1347
|
signal
|
|
@@ -1308,7 +1368,7 @@ var GuildsAPI = class {
|
|
|
1308
1368
|
* @param options - The options for fetching the emojis
|
|
1309
1369
|
*/
|
|
1310
1370
|
async getEmojis(guildId, { signal } = {}) {
|
|
1311
|
-
return this.rest.get(
|
|
1371
|
+
return this.rest.get(Routes6.guildEmojis(guildId), { signal });
|
|
1312
1372
|
}
|
|
1313
1373
|
/**
|
|
1314
1374
|
* Fetches an emoji for a guild
|
|
@@ -1319,7 +1379,7 @@ var GuildsAPI = class {
|
|
|
1319
1379
|
* @param options - The options for fetching the emoji
|
|
1320
1380
|
*/
|
|
1321
1381
|
async getEmoji(guildId, emojiId, { signal } = {}) {
|
|
1322
|
-
return this.rest.get(
|
|
1382
|
+
return this.rest.get(Routes6.guildEmoji(guildId, emojiId), { signal });
|
|
1323
1383
|
}
|
|
1324
1384
|
/**
|
|
1325
1385
|
* Creates a new emoji for a guild
|
|
@@ -1330,7 +1390,7 @@ var GuildsAPI = class {
|
|
|
1330
1390
|
* @param options - The options for creating the emoji
|
|
1331
1391
|
*/
|
|
1332
1392
|
async createEmoji(guildId, body, { reason, signal } = {}) {
|
|
1333
|
-
return this.rest.post(
|
|
1393
|
+
return this.rest.post(Routes6.guildEmojis(guildId), {
|
|
1334
1394
|
reason,
|
|
1335
1395
|
body,
|
|
1336
1396
|
signal
|
|
@@ -1346,7 +1406,7 @@ var GuildsAPI = class {
|
|
|
1346
1406
|
* @param options - The options for editing the emoji
|
|
1347
1407
|
*/
|
|
1348
1408
|
async editEmoji(guildId, emojiId, body, { reason, signal } = {}) {
|
|
1349
|
-
return this.rest.patch(
|
|
1409
|
+
return this.rest.patch(Routes6.guildEmoji(guildId, emojiId), {
|
|
1350
1410
|
reason,
|
|
1351
1411
|
body,
|
|
1352
1412
|
signal
|
|
@@ -1361,7 +1421,7 @@ var GuildsAPI = class {
|
|
|
1361
1421
|
* @param options - The options for deleting the emoji
|
|
1362
1422
|
*/
|
|
1363
1423
|
async deleteEmoji(guildId, emojiId, { reason, signal } = {}) {
|
|
1364
|
-
await this.rest.delete(
|
|
1424
|
+
await this.rest.delete(Routes6.guildEmoji(guildId, emojiId), { reason, signal });
|
|
1365
1425
|
}
|
|
1366
1426
|
/**
|
|
1367
1427
|
* Fetches all scheduled events for a guild
|
|
@@ -1372,7 +1432,7 @@ var GuildsAPI = class {
|
|
|
1372
1432
|
* @param options - The options for fetching the scheduled events
|
|
1373
1433
|
*/
|
|
1374
1434
|
async getScheduledEvents(guildId, query = {}, { signal } = {}) {
|
|
1375
|
-
return this.rest.get(
|
|
1435
|
+
return this.rest.get(Routes6.guildScheduledEvents(guildId), {
|
|
1376
1436
|
query: makeURLSearchParams3(query),
|
|
1377
1437
|
signal
|
|
1378
1438
|
});
|
|
@@ -1386,7 +1446,7 @@ var GuildsAPI = class {
|
|
|
1386
1446
|
* @param options - The options for creating the scheduled event
|
|
1387
1447
|
*/
|
|
1388
1448
|
async createScheduledEvent(guildId, body, { reason, signal } = {}) {
|
|
1389
|
-
return this.rest.post(
|
|
1449
|
+
return this.rest.post(Routes6.guildScheduledEvents(guildId), {
|
|
1390
1450
|
reason,
|
|
1391
1451
|
body,
|
|
1392
1452
|
signal
|
|
@@ -1402,7 +1462,7 @@ var GuildsAPI = class {
|
|
|
1402
1462
|
* @param options - The options for fetching the scheduled event
|
|
1403
1463
|
*/
|
|
1404
1464
|
async getScheduledEvent(guildId, eventId, query = {}, { signal } = {}) {
|
|
1405
|
-
return this.rest.get(
|
|
1465
|
+
return this.rest.get(Routes6.guildScheduledEvent(guildId, eventId), {
|
|
1406
1466
|
query: makeURLSearchParams3(query),
|
|
1407
1467
|
signal
|
|
1408
1468
|
});
|
|
@@ -1417,7 +1477,7 @@ var GuildsAPI = class {
|
|
|
1417
1477
|
* @param options - The options for editing the scheduled event
|
|
1418
1478
|
*/
|
|
1419
1479
|
async editScheduledEvent(guildId, eventId, body, { reason, signal } = {}) {
|
|
1420
|
-
return this.rest.patch(
|
|
1480
|
+
return this.rest.patch(Routes6.guildScheduledEvent(guildId, eventId), {
|
|
1421
1481
|
reason,
|
|
1422
1482
|
body,
|
|
1423
1483
|
signal
|
|
@@ -1432,7 +1492,7 @@ var GuildsAPI = class {
|
|
|
1432
1492
|
* @param options - The options for deleting the scheduled event
|
|
1433
1493
|
*/
|
|
1434
1494
|
async deleteScheduledEvent(guildId, eventId, { reason, signal } = {}) {
|
|
1435
|
-
await this.rest.delete(
|
|
1495
|
+
await this.rest.delete(Routes6.guildScheduledEvent(guildId, eventId), { reason, signal });
|
|
1436
1496
|
}
|
|
1437
1497
|
/**
|
|
1438
1498
|
* Gets all users that are interested in a scheduled event
|
|
@@ -1444,7 +1504,7 @@ var GuildsAPI = class {
|
|
|
1444
1504
|
* @param options - The options for fetching the scheduled event users
|
|
1445
1505
|
*/
|
|
1446
1506
|
async getScheduledEventUsers(guildId, eventId, query = {}, { signal } = {}) {
|
|
1447
|
-
return this.rest.get(
|
|
1507
|
+
return this.rest.get(Routes6.guildScheduledEventUsers(guildId, eventId), {
|
|
1448
1508
|
query: makeURLSearchParams3(query),
|
|
1449
1509
|
signal
|
|
1450
1510
|
});
|
|
@@ -1457,7 +1517,7 @@ var GuildsAPI = class {
|
|
|
1457
1517
|
* @param options - The options for fetching the templates
|
|
1458
1518
|
*/
|
|
1459
1519
|
async getTemplates(guildId, { signal } = {}) {
|
|
1460
|
-
return this.rest.get(
|
|
1520
|
+
return this.rest.get(Routes6.guildTemplates(guildId), { signal });
|
|
1461
1521
|
}
|
|
1462
1522
|
/**
|
|
1463
1523
|
* Syncs a template for a guild
|
|
@@ -1468,7 +1528,7 @@ var GuildsAPI = class {
|
|
|
1468
1528
|
* @param options - The options for syncing the template
|
|
1469
1529
|
*/
|
|
1470
1530
|
async syncTemplate(guildId, templateCode, { signal } = {}) {
|
|
1471
|
-
return this.rest.put(
|
|
1531
|
+
return this.rest.put(Routes6.guildTemplate(guildId, templateCode), {
|
|
1472
1532
|
signal
|
|
1473
1533
|
});
|
|
1474
1534
|
}
|
|
@@ -1482,7 +1542,7 @@ var GuildsAPI = class {
|
|
|
1482
1542
|
* @param options - The options for editing the template
|
|
1483
1543
|
*/
|
|
1484
1544
|
async editTemplate(guildId, templateCode, body, { signal } = {}) {
|
|
1485
|
-
return this.rest.patch(
|
|
1545
|
+
return this.rest.patch(Routes6.guildTemplate(guildId, templateCode), {
|
|
1486
1546
|
body,
|
|
1487
1547
|
signal
|
|
1488
1548
|
});
|
|
@@ -1496,7 +1556,7 @@ var GuildsAPI = class {
|
|
|
1496
1556
|
* @param options - The options for deleting the template
|
|
1497
1557
|
*/
|
|
1498
1558
|
async deleteTemplate(guildId, templateCode, { signal } = {}) {
|
|
1499
|
-
await this.rest.delete(
|
|
1559
|
+
await this.rest.delete(Routes6.guildTemplate(guildId, templateCode), { signal });
|
|
1500
1560
|
}
|
|
1501
1561
|
/**
|
|
1502
1562
|
* Fetches all the stickers for a guild
|
|
@@ -1506,7 +1566,7 @@ var GuildsAPI = class {
|
|
|
1506
1566
|
* @param options - The options for fetching the stickers
|
|
1507
1567
|
*/
|
|
1508
1568
|
async getStickers(guildId, { signal } = {}) {
|
|
1509
|
-
return this.rest.get(
|
|
1569
|
+
return this.rest.get(Routes6.guildStickers(guildId), { signal });
|
|
1510
1570
|
}
|
|
1511
1571
|
/**
|
|
1512
1572
|
* Fetches a sticker for a guild
|
|
@@ -1517,7 +1577,7 @@ var GuildsAPI = class {
|
|
|
1517
1577
|
* @param options - The options for fetching the sticker
|
|
1518
1578
|
*/
|
|
1519
1579
|
async getSticker(guildId, stickerId, { signal } = {}) {
|
|
1520
|
-
return this.rest.get(
|
|
1580
|
+
return this.rest.get(Routes6.guildSticker(guildId, stickerId), { signal });
|
|
1521
1581
|
}
|
|
1522
1582
|
/**
|
|
1523
1583
|
* Creates a sticker for a guild
|
|
@@ -1529,7 +1589,7 @@ var GuildsAPI = class {
|
|
|
1529
1589
|
*/
|
|
1530
1590
|
async createSticker(guildId, { file, ...body }, { reason, signal } = {}) {
|
|
1531
1591
|
const fileData = { ...file, key: "file" };
|
|
1532
|
-
return this.rest.post(
|
|
1592
|
+
return this.rest.post(Routes6.guildStickers(guildId), {
|
|
1533
1593
|
appendToFormData: true,
|
|
1534
1594
|
body,
|
|
1535
1595
|
files: [fileData],
|
|
@@ -1547,7 +1607,7 @@ var GuildsAPI = class {
|
|
|
1547
1607
|
* @param options - The options for editing the sticker
|
|
1548
1608
|
*/
|
|
1549
1609
|
async editSticker(guildId, stickerId, body, { reason, signal } = {}) {
|
|
1550
|
-
return this.rest.patch(
|
|
1610
|
+
return this.rest.patch(Routes6.guildSticker(guildId, stickerId), {
|
|
1551
1611
|
reason,
|
|
1552
1612
|
body,
|
|
1553
1613
|
signal
|
|
@@ -1562,7 +1622,7 @@ var GuildsAPI = class {
|
|
|
1562
1622
|
* @param options - The options for deleting the sticker
|
|
1563
1623
|
*/
|
|
1564
1624
|
async deleteSticker(guildId, stickerId, { reason, signal } = {}) {
|
|
1565
|
-
await this.rest.delete(
|
|
1625
|
+
await this.rest.delete(Routes6.guildSticker(guildId, stickerId), { reason, signal });
|
|
1566
1626
|
}
|
|
1567
1627
|
/**
|
|
1568
1628
|
* Fetches the audit logs for a guild
|
|
@@ -1573,7 +1633,7 @@ var GuildsAPI = class {
|
|
|
1573
1633
|
* @param options - The options for fetching the audit logs
|
|
1574
1634
|
*/
|
|
1575
1635
|
async getAuditLogs(guildId, query = {}, { signal } = {}) {
|
|
1576
|
-
return this.rest.get(
|
|
1636
|
+
return this.rest.get(Routes6.guildAuditLog(guildId), {
|
|
1577
1637
|
query: makeURLSearchParams3(query),
|
|
1578
1638
|
signal
|
|
1579
1639
|
});
|
|
@@ -1586,7 +1646,7 @@ var GuildsAPI = class {
|
|
|
1586
1646
|
* @param options - The options for fetching the auto moderation rules
|
|
1587
1647
|
*/
|
|
1588
1648
|
async getAutoModerationRules(guildId, { signal } = {}) {
|
|
1589
|
-
return this.rest.get(
|
|
1649
|
+
return this.rest.get(Routes6.guildAutoModerationRules(guildId), {
|
|
1590
1650
|
signal
|
|
1591
1651
|
});
|
|
1592
1652
|
}
|
|
@@ -1599,7 +1659,7 @@ var GuildsAPI = class {
|
|
|
1599
1659
|
* @param options - The options for fetching the auto moderation rule
|
|
1600
1660
|
*/
|
|
1601
1661
|
async getAutoModerationRule(guildId, ruleId, { signal } = {}) {
|
|
1602
|
-
return this.rest.get(
|
|
1662
|
+
return this.rest.get(Routes6.guildAutoModerationRule(guildId, ruleId), {
|
|
1603
1663
|
signal
|
|
1604
1664
|
});
|
|
1605
1665
|
}
|
|
@@ -1612,7 +1672,7 @@ var GuildsAPI = class {
|
|
|
1612
1672
|
* @param options - The options for creating the auto moderation rule
|
|
1613
1673
|
*/
|
|
1614
1674
|
async createAutoModerationRule(guildId, body, { reason, signal } = {}) {
|
|
1615
|
-
return this.rest.post(
|
|
1675
|
+
return this.rest.post(Routes6.guildAutoModerationRules(guildId), {
|
|
1616
1676
|
reason,
|
|
1617
1677
|
body,
|
|
1618
1678
|
signal
|
|
@@ -1628,7 +1688,7 @@ var GuildsAPI = class {
|
|
|
1628
1688
|
* @param options - The options for editing the auto moderation rule
|
|
1629
1689
|
*/
|
|
1630
1690
|
async editAutoModerationRule(guildId, ruleId, body, { reason, signal } = {}) {
|
|
1631
|
-
return this.rest.patch(
|
|
1691
|
+
return this.rest.patch(Routes6.guildAutoModerationRule(guildId, ruleId), {
|
|
1632
1692
|
reason,
|
|
1633
1693
|
body,
|
|
1634
1694
|
signal
|
|
@@ -1643,7 +1703,7 @@ var GuildsAPI = class {
|
|
|
1643
1703
|
* @param options - The options for deleting the auto moderation rule
|
|
1644
1704
|
*/
|
|
1645
1705
|
async deleteAutoModerationRule(guildId, ruleId, { reason, signal } = {}) {
|
|
1646
|
-
await this.rest.delete(
|
|
1706
|
+
await this.rest.delete(Routes6.guildAutoModerationRule(guildId, ruleId), { reason, signal });
|
|
1647
1707
|
}
|
|
1648
1708
|
/**
|
|
1649
1709
|
* Fetches a guild member
|
|
@@ -1654,7 +1714,7 @@ var GuildsAPI = class {
|
|
|
1654
1714
|
* @param options - The options for fetching the guild member
|
|
1655
1715
|
*/
|
|
1656
1716
|
async getMember(guildId, userId, { signal } = {}) {
|
|
1657
|
-
return this.rest.get(
|
|
1717
|
+
return this.rest.get(Routes6.guildMember(guildId, userId), { signal });
|
|
1658
1718
|
}
|
|
1659
1719
|
/**
|
|
1660
1720
|
* Searches for guild members
|
|
@@ -1665,7 +1725,7 @@ var GuildsAPI = class {
|
|
|
1665
1725
|
* @param options - The options for searching for guild members
|
|
1666
1726
|
*/
|
|
1667
1727
|
async searchForMembers(guildId, query, { signal } = {}) {
|
|
1668
|
-
return this.rest.get(
|
|
1728
|
+
return this.rest.get(Routes6.guildMembersSearch(guildId), {
|
|
1669
1729
|
query: makeURLSearchParams3(query),
|
|
1670
1730
|
signal
|
|
1671
1731
|
});
|
|
@@ -1680,7 +1740,7 @@ var GuildsAPI = class {
|
|
|
1680
1740
|
* @param options - The options for editing the guild member
|
|
1681
1741
|
*/
|
|
1682
1742
|
async editMember(guildId, userId, body = {}, { reason, signal } = {}) {
|
|
1683
|
-
return this.rest.patch(
|
|
1743
|
+
return this.rest.patch(Routes6.guildMember(guildId, userId), {
|
|
1684
1744
|
reason,
|
|
1685
1745
|
body,
|
|
1686
1746
|
signal
|
|
@@ -1695,7 +1755,7 @@ var GuildsAPI = class {
|
|
|
1695
1755
|
* @param options - The options for removing the guild member
|
|
1696
1756
|
*/
|
|
1697
1757
|
async removeMember(guildId, userId, { reason, signal } = {}) {
|
|
1698
|
-
return this.rest.delete(
|
|
1758
|
+
return this.rest.delete(Routes6.guildMember(guildId, userId), { reason, signal });
|
|
1699
1759
|
}
|
|
1700
1760
|
/**
|
|
1701
1761
|
* Adds a role to a guild member
|
|
@@ -1707,7 +1767,7 @@ var GuildsAPI = class {
|
|
|
1707
1767
|
* @param options - The options for adding a role to a guild member
|
|
1708
1768
|
*/
|
|
1709
1769
|
async addRoleToMember(guildId, userId, roleId, { reason, signal } = {}) {
|
|
1710
|
-
await this.rest.put(
|
|
1770
|
+
await this.rest.put(Routes6.guildMemberRole(guildId, userId, roleId), { reason, signal });
|
|
1711
1771
|
}
|
|
1712
1772
|
/**
|
|
1713
1773
|
* Removes a role from a guild member
|
|
@@ -1719,7 +1779,7 @@ var GuildsAPI = class {
|
|
|
1719
1779
|
* @param options - The options for removing a role from a guild member
|
|
1720
1780
|
*/
|
|
1721
1781
|
async removeRoleFromMember(guildId, userId, roleId, { reason, signal } = {}) {
|
|
1722
|
-
await this.rest.delete(
|
|
1782
|
+
await this.rest.delete(Routes6.guildMemberRole(guildId, userId, roleId), { reason, signal });
|
|
1723
1783
|
}
|
|
1724
1784
|
/**
|
|
1725
1785
|
* Fetches a guild template
|
|
@@ -1729,7 +1789,7 @@ var GuildsAPI = class {
|
|
|
1729
1789
|
* @param options - The options for fetching the guild template
|
|
1730
1790
|
*/
|
|
1731
1791
|
async getTemplate(templateCode, { signal } = {}) {
|
|
1732
|
-
return this.rest.get(
|
|
1792
|
+
return this.rest.get(Routes6.template(templateCode), { signal });
|
|
1733
1793
|
}
|
|
1734
1794
|
/**
|
|
1735
1795
|
* Creates a new template
|
|
@@ -1740,7 +1800,7 @@ var GuildsAPI = class {
|
|
|
1740
1800
|
* @param options - The options for creating the template
|
|
1741
1801
|
*/
|
|
1742
1802
|
async createTemplate(guildId, body, { signal } = {}) {
|
|
1743
|
-
return this.rest.post(
|
|
1803
|
+
return this.rest.post(Routes6.guildTemplates(guildId), { body, signal });
|
|
1744
1804
|
}
|
|
1745
1805
|
/**
|
|
1746
1806
|
* Fetches webhooks for a guild
|
|
@@ -1749,7 +1809,7 @@ var GuildsAPI = class {
|
|
|
1749
1809
|
* @param id - The id of the guild
|
|
1750
1810
|
*/
|
|
1751
1811
|
async getWebhooks(id) {
|
|
1752
|
-
return this.rest.get(
|
|
1812
|
+
return this.rest.get(Routes6.guildWebhooks(id));
|
|
1753
1813
|
}
|
|
1754
1814
|
/**
|
|
1755
1815
|
* Sets the voice state for the current user
|
|
@@ -1771,7 +1831,7 @@ var GuildsAPI = class {
|
|
|
1771
1831
|
* @param options - The options for fetching the guild onboarding
|
|
1772
1832
|
*/
|
|
1773
1833
|
async getOnboarding(guildId, { signal } = {}) {
|
|
1774
|
-
return this.rest.get(
|
|
1834
|
+
return this.rest.get(Routes6.guildOnboarding(guildId), { signal });
|
|
1775
1835
|
}
|
|
1776
1836
|
/**
|
|
1777
1837
|
* Edits a guild onboarding
|
|
@@ -1782,18 +1842,32 @@ var GuildsAPI = class {
|
|
|
1782
1842
|
* @param options - The options for editing the guild onboarding
|
|
1783
1843
|
*/
|
|
1784
1844
|
async editOnboarding(guildId, body, { reason, signal } = {}) {
|
|
1785
|
-
return this.rest.put(
|
|
1845
|
+
return this.rest.put(Routes6.guildOnboarding(guildId), {
|
|
1786
1846
|
reason,
|
|
1787
1847
|
body,
|
|
1788
1848
|
signal
|
|
1789
1849
|
});
|
|
1790
1850
|
}
|
|
1851
|
+
/**
|
|
1852
|
+
* Modifies incident actions for a guild.
|
|
1853
|
+
*
|
|
1854
|
+
* @see {@link https://discord.com/developers/docs/resources/guild#modify-guild-incident-actions}
|
|
1855
|
+
* @param guildId - The id of the guild
|
|
1856
|
+
* @param body - The data for modifying guild incident actions
|
|
1857
|
+
* @param options - The options for modifying guild incident actions
|
|
1858
|
+
*/
|
|
1859
|
+
async editIncidentActions(guildId, body, { signal } = {}) {
|
|
1860
|
+
return this.rest.put(Routes6.guildIncidentActions(guildId), {
|
|
1861
|
+
body,
|
|
1862
|
+
signal
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1791
1865
|
};
|
|
1792
1866
|
|
|
1793
1867
|
// src/api/interactions.ts
|
|
1794
1868
|
import {
|
|
1795
1869
|
InteractionResponseType,
|
|
1796
|
-
Routes as
|
|
1870
|
+
Routes as Routes7
|
|
1797
1871
|
} from "discord-api-types/v10";
|
|
1798
1872
|
var InteractionsAPI = class {
|
|
1799
1873
|
constructor(rest, webhooks) {
|
|
@@ -1813,7 +1887,7 @@ var InteractionsAPI = class {
|
|
|
1813
1887
|
* @param options - The options for replying
|
|
1814
1888
|
*/
|
|
1815
1889
|
async reply(interactionId, interactionToken, { files, ...data }, { signal } = {}) {
|
|
1816
|
-
await this.rest.post(
|
|
1890
|
+
await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
1817
1891
|
files,
|
|
1818
1892
|
auth: false,
|
|
1819
1893
|
body: {
|
|
@@ -1833,7 +1907,7 @@ var InteractionsAPI = class {
|
|
|
1833
1907
|
* @param options - The options for deferring
|
|
1834
1908
|
*/
|
|
1835
1909
|
async defer(interactionId, interactionToken, data, { signal } = {}) {
|
|
1836
|
-
await this.rest.post(
|
|
1910
|
+
await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
1837
1911
|
auth: false,
|
|
1838
1912
|
body: {
|
|
1839
1913
|
type: InteractionResponseType.DeferredChannelMessageWithSource,
|
|
@@ -1851,7 +1925,7 @@ var InteractionsAPI = class {
|
|
|
1851
1925
|
* @param options - The options for deferring
|
|
1852
1926
|
*/
|
|
1853
1927
|
async deferMessageUpdate(interactionId, interactionToken, { signal } = {}) {
|
|
1854
|
-
await this.rest.post(
|
|
1928
|
+
await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
1855
1929
|
auth: false,
|
|
1856
1930
|
body: {
|
|
1857
1931
|
type: InteractionResponseType.DeferredMessageUpdate
|
|
@@ -1927,7 +2001,7 @@ var InteractionsAPI = class {
|
|
|
1927
2001
|
* @param options - The options for updating the interaction
|
|
1928
2002
|
*/
|
|
1929
2003
|
async updateMessage(interactionId, interactionToken, { files, ...data }, { signal } = {}) {
|
|
1930
|
-
await this.rest.post(
|
|
2004
|
+
await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
1931
2005
|
files,
|
|
1932
2006
|
auth: false,
|
|
1933
2007
|
body: {
|
|
@@ -1947,7 +2021,7 @@ var InteractionsAPI = class {
|
|
|
1947
2021
|
* @param options - The options for sending the autocomplete response
|
|
1948
2022
|
*/
|
|
1949
2023
|
async createAutocompleteResponse(interactionId, interactionToken, callbackData, { signal } = {}) {
|
|
1950
|
-
await this.rest.post(
|
|
2024
|
+
await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
1951
2025
|
auth: false,
|
|
1952
2026
|
body: {
|
|
1953
2027
|
type: InteractionResponseType.ApplicationCommandAutocompleteResult,
|
|
@@ -1966,7 +2040,7 @@ var InteractionsAPI = class {
|
|
|
1966
2040
|
* @param options - The options for sending the modal
|
|
1967
2041
|
*/
|
|
1968
2042
|
async createModal(interactionId, interactionToken, callbackData, { signal } = {}) {
|
|
1969
|
-
await this.rest.post(
|
|
2043
|
+
await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
1970
2044
|
auth: false,
|
|
1971
2045
|
body: {
|
|
1972
2046
|
type: InteractionResponseType.Modal,
|
|
@@ -1985,7 +2059,7 @@ var InteractionsAPI = class {
|
|
|
1985
2059
|
* @deprecated Sending a premium-style button is the new Discord behavior.
|
|
1986
2060
|
*/
|
|
1987
2061
|
async sendPremiumRequired(interactionId, interactionToken, { signal } = {}) {
|
|
1988
|
-
await this.rest.post(
|
|
2062
|
+
await this.rest.post(Routes7.interactionCallback(interactionId, interactionToken), {
|
|
1989
2063
|
auth: false,
|
|
1990
2064
|
body: {
|
|
1991
2065
|
type: InteractionResponseType.PremiumRequired
|
|
@@ -1997,7 +2071,7 @@ var InteractionsAPI = class {
|
|
|
1997
2071
|
|
|
1998
2072
|
// src/api/invite.ts
|
|
1999
2073
|
import { makeURLSearchParams as makeURLSearchParams4 } from "@discordjs/rest";
|
|
2000
|
-
import { Routes as
|
|
2074
|
+
import { Routes as Routes8 } from "discord-api-types/v10";
|
|
2001
2075
|
var InvitesAPI = class {
|
|
2002
2076
|
constructor(rest) {
|
|
2003
2077
|
this.rest = rest;
|
|
@@ -2014,7 +2088,7 @@ var InvitesAPI = class {
|
|
|
2014
2088
|
* @param options - The options for fetching the invite
|
|
2015
2089
|
*/
|
|
2016
2090
|
async get(code, query = {}, { signal } = {}) {
|
|
2017
|
-
return this.rest.get(
|
|
2091
|
+
return this.rest.get(Routes8.invite(code), {
|
|
2018
2092
|
query: makeURLSearchParams4(query),
|
|
2019
2093
|
signal
|
|
2020
2094
|
});
|
|
@@ -2027,14 +2101,14 @@ var InvitesAPI = class {
|
|
|
2027
2101
|
* @param options - The options for deleting the invite
|
|
2028
2102
|
*/
|
|
2029
2103
|
async delete(code, { reason, signal } = {}) {
|
|
2030
|
-
await this.rest.delete(
|
|
2104
|
+
await this.rest.delete(Routes8.invite(code), { reason, signal });
|
|
2031
2105
|
}
|
|
2032
2106
|
};
|
|
2033
2107
|
|
|
2034
2108
|
// src/api/monetization.ts
|
|
2035
2109
|
import { makeURLSearchParams as makeURLSearchParams5 } from "@discordjs/rest";
|
|
2036
2110
|
import {
|
|
2037
|
-
Routes as
|
|
2111
|
+
Routes as Routes9
|
|
2038
2112
|
} from "discord-api-types/v10";
|
|
2039
2113
|
var MonetizationAPI = class {
|
|
2040
2114
|
constructor(rest) {
|
|
@@ -2050,7 +2124,7 @@ var MonetizationAPI = class {
|
|
|
2050
2124
|
* @param options - The options for fetching the SKUs.
|
|
2051
2125
|
*/
|
|
2052
2126
|
async getSKUs(applicationId, { signal } = {}) {
|
|
2053
|
-
return this.rest.get(
|
|
2127
|
+
return this.rest.get(Routes9.skus(applicationId), { signal });
|
|
2054
2128
|
}
|
|
2055
2129
|
/**
|
|
2056
2130
|
* Fetches the entitlements for an application.
|
|
@@ -2061,7 +2135,7 @@ var MonetizationAPI = class {
|
|
|
2061
2135
|
* @param options - The options for fetching entitlements
|
|
2062
2136
|
*/
|
|
2063
2137
|
async getEntitlements(applicationId, query, { signal } = {}) {
|
|
2064
|
-
return this.rest.get(
|
|
2138
|
+
return this.rest.get(Routes9.entitlements(applicationId), {
|
|
2065
2139
|
signal,
|
|
2066
2140
|
query: makeURLSearchParams5(query)
|
|
2067
2141
|
});
|
|
@@ -2075,7 +2149,7 @@ var MonetizationAPI = class {
|
|
|
2075
2149
|
* @param options - The options for creating the entitlement
|
|
2076
2150
|
*/
|
|
2077
2151
|
async createTestEntitlement(applicationId, body, { signal } = {}) {
|
|
2078
|
-
return this.rest.post(
|
|
2152
|
+
return this.rest.post(Routes9.entitlements(applicationId), {
|
|
2079
2153
|
body,
|
|
2080
2154
|
signal
|
|
2081
2155
|
});
|
|
@@ -2089,7 +2163,7 @@ var MonetizationAPI = class {
|
|
|
2089
2163
|
* @param options - The options for deleting the entitlement
|
|
2090
2164
|
*/
|
|
2091
2165
|
async deleteTestEntitlement(applicationId, entitlementId, { signal } = {}) {
|
|
2092
|
-
await this.rest.delete(
|
|
2166
|
+
await this.rest.delete(Routes9.entitlement(applicationId, entitlementId), { signal });
|
|
2093
2167
|
}
|
|
2094
2168
|
/**
|
|
2095
2169
|
* Marks a given entitlement for the user as consumed. Only available for One-Time Purchase consumable SKUs.
|
|
@@ -2100,14 +2174,14 @@ var MonetizationAPI = class {
|
|
|
2100
2174
|
* @param options - The options for consuming the entitlement
|
|
2101
2175
|
*/
|
|
2102
2176
|
async consumeEntitlement(applicationId, entitlementId, { signal } = {}) {
|
|
2103
|
-
await this.rest.post(
|
|
2177
|
+
await this.rest.post(Routes9.consumeEntitlement(applicationId, entitlementId), { signal });
|
|
2104
2178
|
}
|
|
2105
2179
|
};
|
|
2106
2180
|
|
|
2107
2181
|
// src/api/oauth2.ts
|
|
2108
2182
|
import { makeURLSearchParams as makeURLSearchParams6 } from "@discordjs/rest";
|
|
2109
2183
|
import {
|
|
2110
|
-
Routes as
|
|
2184
|
+
Routes as Routes10,
|
|
2111
2185
|
RouteBases
|
|
2112
2186
|
} from "discord-api-types/v10";
|
|
2113
2187
|
var OAuth2API = class {
|
|
@@ -2124,7 +2198,7 @@ var OAuth2API = class {
|
|
|
2124
2198
|
* @param options - The options for creating the authorization URL
|
|
2125
2199
|
*/
|
|
2126
2200
|
generateAuthorizationURL(options) {
|
|
2127
|
-
const url = new URL(`${RouteBases.api}${
|
|
2201
|
+
const url = new URL(`${RouteBases.api}${Routes10.oauth2Authorization()}`);
|
|
2128
2202
|
url.search = makeURLSearchParams6(options).toString();
|
|
2129
2203
|
return url.toString();
|
|
2130
2204
|
}
|
|
@@ -2136,7 +2210,7 @@ var OAuth2API = class {
|
|
|
2136
2210
|
* @param options - The options for the token exchange request
|
|
2137
2211
|
*/
|
|
2138
2212
|
async tokenExchange(body, { signal } = {}) {
|
|
2139
|
-
return this.rest.post(
|
|
2213
|
+
return this.rest.post(Routes10.oauth2TokenExchange(), {
|
|
2140
2214
|
body: makeURLSearchParams6(body),
|
|
2141
2215
|
passThroughBody: true,
|
|
2142
2216
|
headers: {
|
|
@@ -2154,7 +2228,7 @@ var OAuth2API = class {
|
|
|
2154
2228
|
* @param options - The options for the refresh token request
|
|
2155
2229
|
*/
|
|
2156
2230
|
async refreshToken(body, { signal } = {}) {
|
|
2157
|
-
return this.rest.post(
|
|
2231
|
+
return this.rest.post(Routes10.oauth2TokenExchange(), {
|
|
2158
2232
|
body: makeURLSearchParams6(body),
|
|
2159
2233
|
passThroughBody: true,
|
|
2160
2234
|
headers: {
|
|
@@ -2174,7 +2248,7 @@ var OAuth2API = class {
|
|
|
2174
2248
|
* @param options - The options for the client credentials grant request
|
|
2175
2249
|
*/
|
|
2176
2250
|
async getToken(body, { signal } = {}) {
|
|
2177
|
-
return this.rest.post(
|
|
2251
|
+
return this.rest.post(Routes10.oauth2TokenExchange(), {
|
|
2178
2252
|
body: makeURLSearchParams6(body),
|
|
2179
2253
|
passThroughBody: true,
|
|
2180
2254
|
headers: {
|
|
@@ -2191,7 +2265,7 @@ var OAuth2API = class {
|
|
|
2191
2265
|
* @param options - The options for the current bot application information request
|
|
2192
2266
|
*/
|
|
2193
2267
|
async getCurrentBotApplicationInformation({ signal } = {}) {
|
|
2194
|
-
return this.rest.get(
|
|
2268
|
+
return this.rest.get(Routes10.oauth2CurrentApplication(), {
|
|
2195
2269
|
signal
|
|
2196
2270
|
});
|
|
2197
2271
|
}
|
|
@@ -2202,7 +2276,7 @@ var OAuth2API = class {
|
|
|
2202
2276
|
* @param options - The options for the current authorization information request
|
|
2203
2277
|
*/
|
|
2204
2278
|
async getCurrentAuthorizationInformation({ signal } = {}) {
|
|
2205
|
-
return this.rest.get(
|
|
2279
|
+
return this.rest.get(Routes10.oauth2CurrentAuthorization(), {
|
|
2206
2280
|
signal
|
|
2207
2281
|
});
|
|
2208
2282
|
}
|
|
@@ -2216,7 +2290,7 @@ var OAuth2API = class {
|
|
|
2216
2290
|
* @param options - The options for the token revocation request
|
|
2217
2291
|
*/
|
|
2218
2292
|
async revokeToken(applicationId, applicationSecret, body, { signal } = {}) {
|
|
2219
|
-
await this.rest.post(
|
|
2293
|
+
await this.rest.post(Routes10.oauth2TokenRevocation(), {
|
|
2220
2294
|
body: makeURLSearchParams6(body),
|
|
2221
2295
|
passThroughBody: true,
|
|
2222
2296
|
headers: {
|
|
@@ -2232,7 +2306,7 @@ var OAuth2API = class {
|
|
|
2232
2306
|
// src/api/poll.ts
|
|
2233
2307
|
import { makeURLSearchParams as makeURLSearchParams7 } from "@discordjs/rest";
|
|
2234
2308
|
import {
|
|
2235
|
-
Routes as
|
|
2309
|
+
Routes as Routes11
|
|
2236
2310
|
} from "discord-api-types/v10";
|
|
2237
2311
|
var PollAPI = class {
|
|
2238
2312
|
constructor(rest) {
|
|
@@ -2252,7 +2326,7 @@ var PollAPI = class {
|
|
|
2252
2326
|
* @param options - The options for getting the list of voters
|
|
2253
2327
|
*/
|
|
2254
2328
|
async getAnswerVoters(channelId, messageId, answerId, query, { signal } = {}) {
|
|
2255
|
-
return this.rest.get(
|
|
2329
|
+
return this.rest.get(Routes11.pollAnswerVoters(channelId, messageId, answerId), {
|
|
2256
2330
|
signal,
|
|
2257
2331
|
query: makeURLSearchParams7(query)
|
|
2258
2332
|
});
|
|
@@ -2266,7 +2340,7 @@ var PollAPI = class {
|
|
|
2266
2340
|
* @param options - The options for expiring the poll
|
|
2267
2341
|
*/
|
|
2268
2342
|
async expirePoll(channelId, messageId, { signal } = {}) {
|
|
2269
|
-
return this.rest.post(
|
|
2343
|
+
return this.rest.post(Routes11.expirePoll(channelId, messageId), {
|
|
2270
2344
|
signal
|
|
2271
2345
|
});
|
|
2272
2346
|
}
|
|
@@ -2274,7 +2348,7 @@ var PollAPI = class {
|
|
|
2274
2348
|
|
|
2275
2349
|
// src/api/roleConnections.ts
|
|
2276
2350
|
import {
|
|
2277
|
-
Routes as
|
|
2351
|
+
Routes as Routes12
|
|
2278
2352
|
} from "discord-api-types/v10";
|
|
2279
2353
|
var RoleConnectionsAPI = class {
|
|
2280
2354
|
constructor(rest) {
|
|
@@ -2291,7 +2365,7 @@ var RoleConnectionsAPI = class {
|
|
|
2291
2365
|
* @param options - The options for fetching the role connection metadata records
|
|
2292
2366
|
*/
|
|
2293
2367
|
async getMetadataRecords(applicationId, { signal } = {}) {
|
|
2294
|
-
return this.rest.get(
|
|
2368
|
+
return this.rest.get(Routes12.applicationRoleConnectionMetadata(applicationId), {
|
|
2295
2369
|
signal
|
|
2296
2370
|
});
|
|
2297
2371
|
}
|
|
@@ -2304,7 +2378,7 @@ var RoleConnectionsAPI = class {
|
|
|
2304
2378
|
* @param options - The options for updating the role connection metadata records
|
|
2305
2379
|
*/
|
|
2306
2380
|
async updateMetadataRecords(applicationId, body, { signal } = {}) {
|
|
2307
|
-
return this.rest.put(
|
|
2381
|
+
return this.rest.put(Routes12.applicationRoleConnectionMetadata(applicationId), {
|
|
2308
2382
|
body,
|
|
2309
2383
|
signal
|
|
2310
2384
|
});
|
|
@@ -2313,7 +2387,7 @@ var RoleConnectionsAPI = class {
|
|
|
2313
2387
|
|
|
2314
2388
|
// src/api/stageInstances.ts
|
|
2315
2389
|
import {
|
|
2316
|
-
Routes as
|
|
2390
|
+
Routes as Routes13
|
|
2317
2391
|
} from "discord-api-types/v10";
|
|
2318
2392
|
var StageInstancesAPI = class {
|
|
2319
2393
|
constructor(rest) {
|
|
@@ -2330,7 +2404,7 @@ var StageInstancesAPI = class {
|
|
|
2330
2404
|
* @param options - The options for creating the new stage instance
|
|
2331
2405
|
*/
|
|
2332
2406
|
async create(body, { reason, signal } = {}) {
|
|
2333
|
-
return this.rest.post(
|
|
2407
|
+
return this.rest.post(Routes13.stageInstances(), {
|
|
2334
2408
|
body,
|
|
2335
2409
|
reason,
|
|
2336
2410
|
signal
|
|
@@ -2344,7 +2418,7 @@ var StageInstancesAPI = class {
|
|
|
2344
2418
|
* @param options - The options for fetching the stage instance
|
|
2345
2419
|
*/
|
|
2346
2420
|
async get(channelId, { signal } = {}) {
|
|
2347
|
-
return this.rest.get(
|
|
2421
|
+
return this.rest.get(Routes13.stageInstance(channelId), { signal });
|
|
2348
2422
|
}
|
|
2349
2423
|
/**
|
|
2350
2424
|
* Edits a stage instance
|
|
@@ -2355,7 +2429,7 @@ var StageInstancesAPI = class {
|
|
|
2355
2429
|
* @param options - The options for editing the stage instance
|
|
2356
2430
|
*/
|
|
2357
2431
|
async edit(channelId, body, { reason, signal } = {}) {
|
|
2358
|
-
return this.rest.patch(
|
|
2432
|
+
return this.rest.patch(Routes13.stageInstance(channelId), {
|
|
2359
2433
|
body,
|
|
2360
2434
|
reason,
|
|
2361
2435
|
signal
|
|
@@ -2369,13 +2443,13 @@ var StageInstancesAPI = class {
|
|
|
2369
2443
|
* @param options - The options for deleting the stage instance
|
|
2370
2444
|
*/
|
|
2371
2445
|
async delete(channelId, { reason, signal } = {}) {
|
|
2372
|
-
await this.rest.delete(
|
|
2446
|
+
await this.rest.delete(Routes13.stageInstance(channelId), { reason, signal });
|
|
2373
2447
|
}
|
|
2374
2448
|
};
|
|
2375
2449
|
|
|
2376
2450
|
// src/api/sticker.ts
|
|
2377
2451
|
import {
|
|
2378
|
-
Routes as
|
|
2452
|
+
Routes as Routes14
|
|
2379
2453
|
} from "discord-api-types/v10";
|
|
2380
2454
|
var StickersAPI = class {
|
|
2381
2455
|
constructor(rest) {
|
|
@@ -2392,7 +2466,7 @@ var StickersAPI = class {
|
|
|
2392
2466
|
* @param options - The options for fetching the sticker pack
|
|
2393
2467
|
*/
|
|
2394
2468
|
async getStickerPack(packId, { signal } = {}) {
|
|
2395
|
-
return this.rest.get(
|
|
2469
|
+
return this.rest.get(Routes14.stickerPack(packId), { signal });
|
|
2396
2470
|
}
|
|
2397
2471
|
/**
|
|
2398
2472
|
* Fetches all of the sticker packs
|
|
@@ -2401,7 +2475,7 @@ var StickersAPI = class {
|
|
|
2401
2475
|
* @param options - The options for fetching the sticker packs
|
|
2402
2476
|
*/
|
|
2403
2477
|
async getStickers({ signal } = {}) {
|
|
2404
|
-
return this.rest.get(
|
|
2478
|
+
return this.rest.get(Routes14.stickerPacks(), { signal });
|
|
2405
2479
|
}
|
|
2406
2480
|
/**
|
|
2407
2481
|
* Fetches all of the sticker packs
|
|
@@ -2421,13 +2495,13 @@ var StickersAPI = class {
|
|
|
2421
2495
|
* @param options - The options for fetching the sticker
|
|
2422
2496
|
*/
|
|
2423
2497
|
async get(stickerId, { signal } = {}) {
|
|
2424
|
-
return this.rest.get(
|
|
2498
|
+
return this.rest.get(Routes14.sticker(stickerId), { signal });
|
|
2425
2499
|
}
|
|
2426
2500
|
};
|
|
2427
2501
|
|
|
2428
2502
|
// src/api/thread.ts
|
|
2429
2503
|
import {
|
|
2430
|
-
Routes as
|
|
2504
|
+
Routes as Routes15
|
|
2431
2505
|
} from "discord-api-types/v10";
|
|
2432
2506
|
var ThreadsAPI = class {
|
|
2433
2507
|
constructor(rest) {
|
|
@@ -2444,7 +2518,7 @@ var ThreadsAPI = class {
|
|
|
2444
2518
|
* @param options - The options for joining the thread
|
|
2445
2519
|
*/
|
|
2446
2520
|
async join(threadId, { signal } = {}) {
|
|
2447
|
-
await this.rest.put(
|
|
2521
|
+
await this.rest.put(Routes15.threadMembers(threadId, "@me"), { signal });
|
|
2448
2522
|
}
|
|
2449
2523
|
/**
|
|
2450
2524
|
* Adds a member to a thread
|
|
@@ -2455,7 +2529,7 @@ var ThreadsAPI = class {
|
|
|
2455
2529
|
* @param options - The options for adding the member to the thread
|
|
2456
2530
|
*/
|
|
2457
2531
|
async addMember(threadId, userId, { signal } = {}) {
|
|
2458
|
-
await this.rest.put(
|
|
2532
|
+
await this.rest.put(Routes15.threadMembers(threadId, userId), { signal });
|
|
2459
2533
|
}
|
|
2460
2534
|
/**
|
|
2461
2535
|
* Removes the current user from a thread
|
|
@@ -2465,7 +2539,7 @@ var ThreadsAPI = class {
|
|
|
2465
2539
|
* @param options - The options for leaving the thread
|
|
2466
2540
|
*/
|
|
2467
2541
|
async leave(threadId, { signal } = {}) {
|
|
2468
|
-
await this.rest.delete(
|
|
2542
|
+
await this.rest.delete(Routes15.threadMembers(threadId, "@me"), { signal });
|
|
2469
2543
|
}
|
|
2470
2544
|
/**
|
|
2471
2545
|
* Removes a member from a thread
|
|
@@ -2476,7 +2550,7 @@ var ThreadsAPI = class {
|
|
|
2476
2550
|
* @param options - The options for removing the member from the thread
|
|
2477
2551
|
*/
|
|
2478
2552
|
async removeMember(threadId, userId, { signal } = {}) {
|
|
2479
|
-
await this.rest.delete(
|
|
2553
|
+
await this.rest.delete(Routes15.threadMembers(threadId, userId), { signal });
|
|
2480
2554
|
}
|
|
2481
2555
|
/**
|
|
2482
2556
|
* Fetches a member of a thread
|
|
@@ -2487,7 +2561,7 @@ var ThreadsAPI = class {
|
|
|
2487
2561
|
* @param options - The options for fetching the member
|
|
2488
2562
|
*/
|
|
2489
2563
|
async getMember(threadId, userId, { signal } = {}) {
|
|
2490
|
-
return this.rest.get(
|
|
2564
|
+
return this.rest.get(Routes15.threadMembers(threadId, userId), { signal });
|
|
2491
2565
|
}
|
|
2492
2566
|
/**
|
|
2493
2567
|
* Fetches all members of a thread
|
|
@@ -2497,14 +2571,14 @@ var ThreadsAPI = class {
|
|
|
2497
2571
|
* @param options - The options for fetching the members
|
|
2498
2572
|
*/
|
|
2499
2573
|
async getAllMembers(threadId, { signal } = {}) {
|
|
2500
|
-
return this.rest.get(
|
|
2574
|
+
return this.rest.get(Routes15.threadMembers(threadId), { signal });
|
|
2501
2575
|
}
|
|
2502
2576
|
};
|
|
2503
2577
|
|
|
2504
2578
|
// src/api/user.ts
|
|
2505
2579
|
import { makeURLSearchParams as makeURLSearchParams8 } from "@discordjs/rest";
|
|
2506
2580
|
import {
|
|
2507
|
-
Routes as
|
|
2581
|
+
Routes as Routes16
|
|
2508
2582
|
} from "discord-api-types/v10";
|
|
2509
2583
|
var UsersAPI = class {
|
|
2510
2584
|
constructor(rest) {
|
|
@@ -2521,7 +2595,7 @@ var UsersAPI = class {
|
|
|
2521
2595
|
* @param options - The options for fetching the user
|
|
2522
2596
|
*/
|
|
2523
2597
|
async get(userId, { signal } = {}) {
|
|
2524
|
-
return this.rest.get(
|
|
2598
|
+
return this.rest.get(Routes16.user(userId), { signal });
|
|
2525
2599
|
}
|
|
2526
2600
|
/**
|
|
2527
2601
|
* Returns the user object of the requester's account
|
|
@@ -2530,7 +2604,7 @@ var UsersAPI = class {
|
|
|
2530
2604
|
* @param options - The options for fetching the current user
|
|
2531
2605
|
*/
|
|
2532
2606
|
async getCurrent({ signal } = {}) {
|
|
2533
|
-
return this.rest.get(
|
|
2607
|
+
return this.rest.get(Routes16.user("@me"), { signal });
|
|
2534
2608
|
}
|
|
2535
2609
|
/**
|
|
2536
2610
|
* Returns a list of partial guild objects the current user is a member of
|
|
@@ -2540,7 +2614,7 @@ var UsersAPI = class {
|
|
|
2540
2614
|
* @param options - The options for fetching the guilds
|
|
2541
2615
|
*/
|
|
2542
2616
|
async getGuilds(query = {}, { signal } = {}) {
|
|
2543
|
-
return this.rest.get(
|
|
2617
|
+
return this.rest.get(Routes16.userGuilds(), {
|
|
2544
2618
|
query: makeURLSearchParams8(query),
|
|
2545
2619
|
signal
|
|
2546
2620
|
});
|
|
@@ -2553,7 +2627,7 @@ var UsersAPI = class {
|
|
|
2553
2627
|
* @param options - The options for leaving the guild
|
|
2554
2628
|
*/
|
|
2555
2629
|
async leaveGuild(guildId, { signal } = {}) {
|
|
2556
|
-
await this.rest.delete(
|
|
2630
|
+
await this.rest.delete(Routes16.userGuild(guildId), { signal });
|
|
2557
2631
|
}
|
|
2558
2632
|
/**
|
|
2559
2633
|
* Edits the current user
|
|
@@ -2563,7 +2637,7 @@ var UsersAPI = class {
|
|
|
2563
2637
|
* @param options - The options for editing the user
|
|
2564
2638
|
*/
|
|
2565
2639
|
async edit(body, { signal } = {}) {
|
|
2566
|
-
return this.rest.patch(
|
|
2640
|
+
return this.rest.patch(Routes16.user("@me"), { body, signal });
|
|
2567
2641
|
}
|
|
2568
2642
|
/**
|
|
2569
2643
|
* Fetches the guild member for the current user
|
|
@@ -2573,7 +2647,7 @@ var UsersAPI = class {
|
|
|
2573
2647
|
* @param options - The options for fetching the guild member
|
|
2574
2648
|
*/
|
|
2575
2649
|
async getGuildMember(guildId, { signal } = {}) {
|
|
2576
|
-
return this.rest.get(
|
|
2650
|
+
return this.rest.get(Routes16.userGuildMember(guildId), { signal });
|
|
2577
2651
|
}
|
|
2578
2652
|
/**
|
|
2579
2653
|
* Edits the guild member for the current user
|
|
@@ -2584,7 +2658,7 @@ var UsersAPI = class {
|
|
|
2584
2658
|
* @param options - The options for editing the guild member
|
|
2585
2659
|
*/
|
|
2586
2660
|
async editCurrentGuildMember(guildId, body = {}, { reason, signal } = {}) {
|
|
2587
|
-
return this.rest.patch(
|
|
2661
|
+
return this.rest.patch(Routes16.guildMember(guildId, "@me"), {
|
|
2588
2662
|
reason,
|
|
2589
2663
|
body,
|
|
2590
2664
|
signal
|
|
@@ -2598,7 +2672,7 @@ var UsersAPI = class {
|
|
|
2598
2672
|
* @param options - The options for opening the DM
|
|
2599
2673
|
*/
|
|
2600
2674
|
async createDM(userId, { signal } = {}) {
|
|
2601
|
-
return this.rest.post(
|
|
2675
|
+
return this.rest.post(Routes16.userChannels(), {
|
|
2602
2676
|
body: { recipient_id: userId },
|
|
2603
2677
|
signal
|
|
2604
2678
|
});
|
|
@@ -2610,7 +2684,7 @@ var UsersAPI = class {
|
|
|
2610
2684
|
* @param options - The options for fetching the user's connections
|
|
2611
2685
|
*/
|
|
2612
2686
|
async getConnections({ signal } = {}) {
|
|
2613
|
-
return this.rest.get(
|
|
2687
|
+
return this.rest.get(Routes16.userConnections(), { signal });
|
|
2614
2688
|
}
|
|
2615
2689
|
/**
|
|
2616
2690
|
* Gets the current user's active application role connection
|
|
@@ -2620,7 +2694,7 @@ var UsersAPI = class {
|
|
|
2620
2694
|
* @param options - The options for fetching the role connections
|
|
2621
2695
|
*/
|
|
2622
2696
|
async getApplicationRoleConnection(applicationId, { signal } = {}) {
|
|
2623
|
-
return this.rest.get(
|
|
2697
|
+
return this.rest.get(Routes16.userApplicationRoleConnection(applicationId), {
|
|
2624
2698
|
signal
|
|
2625
2699
|
});
|
|
2626
2700
|
}
|
|
@@ -2633,7 +2707,7 @@ var UsersAPI = class {
|
|
|
2633
2707
|
* @param options - The options for updating the application role connection
|
|
2634
2708
|
*/
|
|
2635
2709
|
async updateApplicationRoleConnection(applicationId, body, { signal } = {}) {
|
|
2636
|
-
return this.rest.put(
|
|
2710
|
+
return this.rest.put(Routes16.userApplicationRoleConnection(applicationId), {
|
|
2637
2711
|
body,
|
|
2638
2712
|
signal
|
|
2639
2713
|
});
|
|
@@ -2643,7 +2717,7 @@ var UsersAPI = class {
|
|
|
2643
2717
|
// src/api/webhook.ts
|
|
2644
2718
|
import { makeURLSearchParams as makeURLSearchParams9 } from "@discordjs/rest";
|
|
2645
2719
|
import {
|
|
2646
|
-
Routes as
|
|
2720
|
+
Routes as Routes17
|
|
2647
2721
|
} from "discord-api-types/v10";
|
|
2648
2722
|
var WebhooksAPI = class {
|
|
2649
2723
|
constructor(rest) {
|
|
@@ -2661,7 +2735,7 @@ var WebhooksAPI = class {
|
|
|
2661
2735
|
* @param options - The options for fetching the webhook
|
|
2662
2736
|
*/
|
|
2663
2737
|
async get(id, { token, signal } = {}) {
|
|
2664
|
-
return this.rest.get(
|
|
2738
|
+
return this.rest.get(Routes17.webhook(id, token), {
|
|
2665
2739
|
signal,
|
|
2666
2740
|
auth: !token
|
|
2667
2741
|
});
|
|
@@ -2676,7 +2750,7 @@ var WebhooksAPI = class {
|
|
|
2676
2750
|
* @param options - The options for editing the webhook
|
|
2677
2751
|
*/
|
|
2678
2752
|
async edit(id, body, { token, reason, signal } = {}) {
|
|
2679
|
-
return this.rest.patch(
|
|
2753
|
+
return this.rest.patch(Routes17.webhook(id, token), {
|
|
2680
2754
|
reason,
|
|
2681
2755
|
body,
|
|
2682
2756
|
signal,
|
|
@@ -2692,7 +2766,7 @@ var WebhooksAPI = class {
|
|
|
2692
2766
|
* @param options - The options for deleting the webhook
|
|
2693
2767
|
*/
|
|
2694
2768
|
async delete(id, { token, reason, signal } = {}) {
|
|
2695
|
-
await this.rest.delete(
|
|
2769
|
+
await this.rest.delete(Routes17.webhook(id, token), {
|
|
2696
2770
|
reason,
|
|
2697
2771
|
signal,
|
|
2698
2772
|
auth: !token
|
|
@@ -2714,7 +2788,7 @@ var WebhooksAPI = class {
|
|
|
2714
2788
|
files,
|
|
2715
2789
|
...body
|
|
2716
2790
|
}, { signal } = {}) {
|
|
2717
|
-
return this.rest.post(
|
|
2791
|
+
return this.rest.post(Routes17.webhook(id, token), {
|
|
2718
2792
|
query: makeURLSearchParams9({ wait, thread_id, with_components }),
|
|
2719
2793
|
files,
|
|
2720
2794
|
body,
|
|
@@ -2734,7 +2808,7 @@ var WebhooksAPI = class {
|
|
|
2734
2808
|
* @param options - The options for executing the webhook
|
|
2735
2809
|
*/
|
|
2736
2810
|
async executeSlack(id, token, body, query = {}, { signal } = {}) {
|
|
2737
|
-
await this.rest.post(
|
|
2811
|
+
await this.rest.post(Routes17.webhookPlatform(id, token, "slack"), {
|
|
2738
2812
|
query: makeURLSearchParams9(query),
|
|
2739
2813
|
body,
|
|
2740
2814
|
auth: false,
|
|
@@ -2752,7 +2826,7 @@ var WebhooksAPI = class {
|
|
|
2752
2826
|
* @param options - The options for executing the webhook
|
|
2753
2827
|
*/
|
|
2754
2828
|
async executeGitHub(id, token, body, query = {}, { signal } = {}) {
|
|
2755
|
-
await this.rest.post(
|
|
2829
|
+
await this.rest.post(Routes17.webhookPlatform(id, token, "github"), {
|
|
2756
2830
|
query: makeURLSearchParams9(query),
|
|
2757
2831
|
body,
|
|
2758
2832
|
signal,
|
|
@@ -2770,7 +2844,7 @@ var WebhooksAPI = class {
|
|
|
2770
2844
|
* @param options - The options for fetching the message
|
|
2771
2845
|
*/
|
|
2772
2846
|
async getMessage(id, token, messageId, query = {}, { signal } = {}) {
|
|
2773
|
-
return this.rest.get(
|
|
2847
|
+
return this.rest.get(Routes17.webhookMessage(id, token, messageId), {
|
|
2774
2848
|
query: makeURLSearchParams9(query),
|
|
2775
2849
|
auth: false,
|
|
2776
2850
|
signal
|
|
@@ -2792,7 +2866,7 @@ var WebhooksAPI = class {
|
|
|
2792
2866
|
files,
|
|
2793
2867
|
...body
|
|
2794
2868
|
}, { signal } = {}) {
|
|
2795
|
-
return this.rest.patch(
|
|
2869
|
+
return this.rest.patch(Routes17.webhookMessage(id, token, messageId), {
|
|
2796
2870
|
query: makeURLSearchParams9({ thread_id, with_components }),
|
|
2797
2871
|
auth: false,
|
|
2798
2872
|
body,
|
|
@@ -2811,7 +2885,7 @@ var WebhooksAPI = class {
|
|
|
2811
2885
|
* @param options - The options for deleting the message
|
|
2812
2886
|
*/
|
|
2813
2887
|
async deleteMessage(id, token, messageId, query = {}, { signal } = {}) {
|
|
2814
|
-
await this.rest.delete(
|
|
2888
|
+
await this.rest.delete(Routes17.webhookMessage(id, token, messageId), {
|
|
2815
2889
|
query: makeURLSearchParams9(query),
|
|
2816
2890
|
auth: false,
|
|
2817
2891
|
signal
|
|
@@ -2826,6 +2900,7 @@ var API = class {
|
|
|
2826
2900
|
this.applicationCommands = new ApplicationCommandsAPI(rest);
|
|
2827
2901
|
this.applications = new ApplicationsAPI(rest);
|
|
2828
2902
|
this.channels = new ChannelsAPI(rest);
|
|
2903
|
+
this.gateway = new GatewayAPI(rest);
|
|
2829
2904
|
this.guilds = new GuildsAPI(rest);
|
|
2830
2905
|
this.invites = new InvitesAPI(rest);
|
|
2831
2906
|
this.monetization = new MonetizationAPI(rest);
|
|
@@ -2846,6 +2921,7 @@ var API = class {
|
|
|
2846
2921
|
applicationCommands;
|
|
2847
2922
|
applications;
|
|
2848
2923
|
channels;
|
|
2924
|
+
gateway;
|
|
2849
2925
|
guilds;
|
|
2850
2926
|
interactions;
|
|
2851
2927
|
invites;
|
|
@@ -3029,13 +3105,14 @@ __name(withFiles, "withFiles");
|
|
|
3029
3105
|
|
|
3030
3106
|
// src/index.ts
|
|
3031
3107
|
export * from "discord-api-types/v10";
|
|
3032
|
-
var version = "2.
|
|
3108
|
+
var version = "2.3.0";
|
|
3033
3109
|
export {
|
|
3034
3110
|
API,
|
|
3035
3111
|
ApplicationCommandsAPI,
|
|
3036
3112
|
ApplicationsAPI,
|
|
3037
3113
|
ChannelsAPI,
|
|
3038
3114
|
Client,
|
|
3115
|
+
GatewayAPI,
|
|
3039
3116
|
GuildsAPI,
|
|
3040
3117
|
InteractionsAPI,
|
|
3041
3118
|
InvitesAPI,
|