@discordeno/rest 19.0.0-next.f15ef49 → 19.0.0-next.f2b6590

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.
@@ -1 +1 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../src/manager.ts"],"names":[],"mappings":"AAkEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,WAAW,EAAsB,MAAM,YAAY,CAAA;AAK3F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,WAAW,CA2nDhF"}
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../src/manager.ts"],"names":[],"mappings":"AAqEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,WAAW,EAAsB,MAAM,YAAY,CAAA;AAK3F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,WAAW,CA8qDhF"}
package/dist/manager.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable no-const-assign */ import { InteractionResponseTypes } from '@discordeno/types';
2
- import { calculateBits, camelize, camelToSnakeCase, delay, findFiles, getBotIdFromToken, isGetMessagesAfter, isGetMessagesAround, isGetMessagesBefore, isGetMessagesLimit, logger, processReactionString, urlToBase64 } from '@discordeno/utils';
2
+ import { calculateBits, camelize, camelToSnakeCase, delay, encode, findFiles, getBotIdFromToken, isGetMessagesAfter, isGetMessagesAround, isGetMessagesBefore, isGetMessagesLimit, logger, processReactionString, urlToBase64 } from '@discordeno/utils';
3
+ import fetch from 'node-fetch';
3
4
  import { createInvalidRequestBucket } from './invalidBucket.js';
4
5
  import { Queue } from './queue.js';
5
6
  // TODO: make dynamic based on package.json file
@@ -11,7 +12,7 @@ export function createRestManager(options) {
11
12
  token: options.token,
12
13
  applicationId: options.applicationId ? BigInt(options.applicationId) : getBotIdFromToken(options.token),
13
14
  version: options.version ?? 10,
14
- baseUrl: options.baseUrl ?? 'https://discord.com/api',
15
+ baseUrl: options.proxy?.baseUrl ?? 'https://discord.com/api',
15
16
  maxRetryCount: Infinity,
16
17
  globallyRateLimited: false,
17
18
  processingRateLimitedPaths: false,
@@ -19,6 +20,7 @@ export function createRestManager(options) {
19
20
  queues: new Map(),
20
21
  rateLimitedPaths: new Map(),
21
22
  invalidBucket: createInvalidRequestBucket({}),
23
+ authorization: options.proxy?.authorization,
22
24
  routes: {
23
25
  webhooks: {
24
26
  id: (webhookId)=>{
@@ -655,8 +657,8 @@ export function createRestManager(options) {
655
657
  }
656
658
  // IF THERE IS NO REMAINING GLOBAL LIMIT, MARK IT RATE LIMITED GLOBALLY
657
659
  if (global) {
658
- const retryAfter1 = headers.get('retry-after');
659
- const globalReset = Date.now() + Number(retryAfter1) * 1000;
660
+ const retryAfter = headers.get('retry-after');
661
+ const globalReset = Date.now() + Number(retryAfter) * 1000;
660
662
  // rest.debug(
661
663
  // `[REST = Globally Rate Limited] URL: ${url} | Global Rest: ${globalReset}`
662
664
  // )
@@ -712,11 +714,12 @@ export function createRestManager(options) {
712
714
  logger.debug(`Request to ${url} exceeded the maximum allowed retries.`, 'with payload:', payload);
713
715
  // rest.debug(`[REST - RetriesMaxed] ${JSON.stringify(options)}`)
714
716
  // Remove item from queue to prevent retry
715
- return options.reject({
717
+ options.reject({
716
718
  ok: false,
717
719
  status: response.status,
718
720
  error: 'The options was rate limited and it maxed out the retries limit.'
719
721
  });
722
+ return;
720
723
  }
721
724
  // Rate limited, add back to queue
722
725
  rest.invalidBucket.handleCompletedRequest(response.status, response.headers.get('X-RateLimit-Scope') === 'shared');
@@ -726,16 +729,17 @@ export function createRestManager(options) {
726
729
  await response.json();
727
730
  return await options.retryRequest?.(options);
728
731
  }
729
- return options.reject({
732
+ options.reject({
730
733
  ok: false,
731
734
  status: response.status,
732
735
  body: JSON.stringify(await response.json())
733
736
  });
737
+ return;
734
738
  }
735
739
  const is204 = response.status === 204;
736
740
  const json = is204 ? undefined : await response.json();
737
741
  // Discord sometimes sends no response with 204 code
738
- return options.resolve({
742
+ options.resolve({
739
743
  ok: true,
740
744
  status: response.status,
741
745
  body: JSON.stringify(json)
@@ -786,6 +790,42 @@ export function createRestManager(options) {
786
790
  }
787
791
  },
788
792
  async makeRequest (method, url, body, options) {
793
+ if (!rest.baseUrl.startsWith('https://discord.com') && url[0] === '/') {
794
+ // Special handling for sending blobs across http to proxy
795
+ if (body?.file) {
796
+ if (!Array.isArray(body.file)) {
797
+ body.file = [
798
+ body.file
799
+ ];
800
+ }
801
+ // convert blobs to string before sending to proxy
802
+ body.file = await Promise.all(body.file.map(async (f)=>{
803
+ const url = encode(await f.blob.arrayBuffer());
804
+ return {
805
+ name: f.name,
806
+ blob: `data:${f.blob.type};base64,${url}`
807
+ };
808
+ }));
809
+ }
810
+ const headers = {
811
+ Authorization: rest.authorization ?? ""
812
+ };
813
+ if (body) {
814
+ headers['Content-Type'] = 'application/json';
815
+ }
816
+ const result = await fetch(`${rest.baseUrl}${url}`, {
817
+ body: body ? JSON.stringify(body) : undefined,
818
+ headers,
819
+ method
820
+ });
821
+ if (!result.ok) {
822
+ const err = await result.json().catch(()=>{});
823
+ // Legacy Handling to not break old code or when body is missing
824
+ if (!err?.body) throw new Error(`Error: ${err.message ?? result.statusText}`);
825
+ throw new Error(JSON.stringify(err));
826
+ }
827
+ return result.status !== 204 ? await result.json() : undefined;
828
+ }
789
829
  return await new Promise((resolve, reject)=>{
790
830
  const payload = {
791
831
  url,
@@ -795,7 +835,9 @@ export function createRestManager(options) {
795
835
  retryRequest: async function(options) {
796
836
  rest.processRequest(payload);
797
837
  },
798
- resolve: (data)=>resolve(data.status !== 204 ? JSON.parse(data.body ?? '{}') : undefined),
838
+ resolve: (data)=>{
839
+ resolve(data.status !== 204 ? JSON.parse(data.body ?? '{}') : undefined);
840
+ },
799
841
  reject,
800
842
  options
801
843
  };
@@ -809,7 +851,7 @@ export function createRestManager(options) {
809
851
  return camelize(await rest.makeRequest('POST', url, body));
810
852
  },
811
853
  async delete (url, body) {
812
- return camelize(await rest.makeRequest('DELETE', url, body));
854
+ camelize(await rest.makeRequest('DELETE', url, body));
813
855
  },
814
856
  async patch (url, body) {
815
857
  return camelize(await rest.makeRequest('PATCH', url, body));
@@ -819,11 +861,13 @@ export function createRestManager(options) {
819
861
  },
820
862
  async addReaction (channelId, messageId, reaction) {
821
863
  reaction = processReactionString(reaction);
822
- return await rest.put(rest.routes.channels.reactions.bot(channelId, messageId, reaction));
864
+ await rest.put(rest.routes.channels.reactions.bot(channelId, messageId, reaction));
823
865
  },
824
866
  async addReactions (channelId, messageId, reactions, ordered = false) {
825
867
  if (!ordered) {
826
- await Promise.all(reactions.map(async (reaction)=>await rest.addReaction(channelId, messageId, reaction)));
868
+ await Promise.all(reactions.map(async (reaction)=>{
869
+ await rest.addReaction(channelId, messageId, reaction);
870
+ }));
827
871
  return;
828
872
  }
829
873
  for (const reaction of reactions){
@@ -831,12 +875,12 @@ export function createRestManager(options) {
831
875
  }
832
876
  },
833
877
  async addRole (guildId, userId, roleId, reason) {
834
- return await rest.put(rest.routes.guilds.roles.member(guildId, userId, roleId), {
878
+ await rest.put(rest.routes.guilds.roles.member(guildId, userId, roleId), {
835
879
  reason
836
880
  });
837
881
  },
838
882
  async addThreadMember (channelId, userId) {
839
- return await rest.put(rest.routes.channels.threads.user(channelId, userId));
883
+ await rest.put(rest.routes.channels.threads.user(channelId, userId));
840
884
  },
841
885
  async createAutomodRule (guildId, options) {
842
886
  return await rest.post(rest.routes.guilds.automod.rules(guildId), options);
@@ -894,103 +938,103 @@ export function createRestManager(options) {
894
938
  });
895
939
  },
896
940
  async deleteAutomodRule (guildId, ruleId, reason) {
897
- return await rest.delete(rest.routes.guilds.automod.rule(guildId, ruleId), {
941
+ await rest.delete(rest.routes.guilds.automod.rule(guildId, ruleId), {
898
942
  reason
899
943
  });
900
944
  },
901
945
  async deleteChannel (channelId, reason) {
902
- return await rest.delete(rest.routes.channels.channel(channelId), {
946
+ await rest.delete(rest.routes.channels.channel(channelId), {
903
947
  reason
904
948
  });
905
949
  },
906
950
  async deleteChannelPermissionOverride (channelId, overwriteId, reason) {
907
- return await rest.delete(rest.routes.channels.overwrite(channelId, overwriteId), reason ? {
951
+ await rest.delete(rest.routes.channels.overwrite(channelId, overwriteId), reason ? {
908
952
  reason
909
953
  } : undefined);
910
954
  },
911
955
  async deleteEmoji (guildId, id, reason) {
912
- return await rest.delete(rest.routes.guilds.emoji(guildId, id), {
956
+ await rest.delete(rest.routes.guilds.emoji(guildId, id), {
913
957
  reason
914
958
  });
915
959
  },
916
960
  async deleteFollowupMessage (token, messageId) {
917
- return await rest.delete(rest.routes.interactions.responses.message(rest.applicationId, token, messageId));
961
+ await rest.delete(rest.routes.interactions.responses.message(rest.applicationId, token, messageId));
918
962
  },
919
963
  async deleteGlobalApplicationCommand (commandId) {
920
- return await rest.delete(rest.routes.interactions.commands.command(rest.applicationId, commandId));
964
+ await rest.delete(rest.routes.interactions.commands.command(rest.applicationId, commandId));
921
965
  },
922
966
  async deleteGuild (guildId) {
923
- return await rest.delete(rest.routes.guilds.guild(guildId));
967
+ await rest.delete(rest.routes.guilds.guild(guildId));
924
968
  },
925
969
  async deleteGuildApplicationCommand (commandId, guildId) {
926
- return await rest.delete(rest.routes.interactions.commands.guilds.one(rest.applicationId, guildId, commandId));
970
+ await rest.delete(rest.routes.interactions.commands.guilds.one(rest.applicationId, guildId, commandId));
927
971
  },
928
972
  async deleteGuildSticker (guildId, stickerId, reason) {
929
- return await rest.delete(rest.routes.guilds.sticker(guildId, stickerId), reason ? {
973
+ await rest.delete(rest.routes.guilds.sticker(guildId, stickerId), reason ? {
930
974
  reason
931
975
  } : undefined);
932
976
  },
933
977
  async deleteGuildTemplate (guildId, templateCode) {
934
- return await rest.delete(rest.routes.guilds.templates.guild(guildId, templateCode));
978
+ await rest.delete(rest.routes.guilds.templates.guild(guildId, templateCode));
935
979
  },
936
980
  async deleteIntegration (guildId, integrationId) {
937
- return await rest.delete(rest.routes.guilds.integration(guildId, integrationId));
981
+ await rest.delete(rest.routes.guilds.integration(guildId, integrationId));
938
982
  },
939
983
  async deleteInvite (inviteCode, reason) {
940
- return await rest.delete(rest.routes.guilds.invite(inviteCode), reason ? {
984
+ await rest.delete(rest.routes.guilds.invite(inviteCode), reason ? {
941
985
  reason
942
986
  } : undefined);
943
987
  },
944
988
  async deleteMessage (channelId, messageId, reason) {
945
- return await rest.delete(rest.routes.channels.message(channelId, messageId), {
989
+ await rest.delete(rest.routes.channels.message(channelId, messageId), {
946
990
  reason
947
991
  });
948
992
  },
949
993
  async deleteMessages (channelId, messageIds, reason) {
950
- return await rest.post(rest.routes.channels.bulk(channelId), {
994
+ await rest.post(rest.routes.channels.bulk(channelId), {
951
995
  messages: messageIds.slice(0, 100).map((id)=>id.toString()),
952
996
  reason
953
997
  });
954
998
  },
955
999
  async deleteOriginalInteractionResponse (token) {
956
- return await rest.delete(rest.routes.interactions.responses.original(rest.applicationId, token));
1000
+ await rest.delete(rest.routes.interactions.responses.original(rest.applicationId, token));
957
1001
  },
958
1002
  async deleteOwnReaction (channelId, messageId, reaction) {
959
1003
  reaction = processReactionString(reaction);
960
- return await rest.delete(rest.routes.channels.reactions.bot(channelId, messageId, reaction));
1004
+ await rest.delete(rest.routes.channels.reactions.bot(channelId, messageId, reaction));
961
1005
  },
962
1006
  async deleteReactionsAll (channelId, messageId) {
963
- return await rest.delete(rest.routes.channels.reactions.all(channelId, messageId));
1007
+ await rest.delete(rest.routes.channels.reactions.all(channelId, messageId));
964
1008
  },
965
1009
  async deleteReactionsEmoji (channelId, messageId, reaction) {
966
1010
  reaction = processReactionString(reaction);
967
- return await rest.delete(rest.routes.channels.reactions.emoji(channelId, messageId, reaction));
1011
+ await rest.delete(rest.routes.channels.reactions.emoji(channelId, messageId, reaction));
968
1012
  },
969
1013
  async deleteRole (guildId, roleId) {
970
- return await rest.delete(rest.routes.guilds.roles.one(guildId, roleId));
1014
+ await rest.delete(rest.routes.guilds.roles.one(guildId, roleId));
971
1015
  },
972
1016
  async deleteScheduledEvent (guildId, eventId) {
973
- return await rest.delete(rest.routes.guilds.events.event(guildId, eventId));
1017
+ await rest.delete(rest.routes.guilds.events.event(guildId, eventId));
974
1018
  },
975
1019
  async deleteStageInstance (channelId, reason) {
976
- return await rest.delete(rest.routes.channels.stage(channelId), reason ? {
1020
+ await rest.delete(rest.routes.channels.stage(channelId), reason ? {
977
1021
  reason
978
1022
  } : undefined);
979
1023
  },
980
1024
  async deleteUserReaction (channelId, messageId, userId, reaction) {
981
1025
  reaction = processReactionString(reaction);
982
- return await rest.delete(rest.routes.channels.reactions.user(channelId, messageId, reaction, userId));
1026
+ await rest.delete(rest.routes.channels.reactions.user(channelId, messageId, reaction, userId));
983
1027
  },
984
1028
  async deleteWebhook (webhookId, reason) {
985
- return await rest.delete(rest.routes.webhooks.id(webhookId), {
1029
+ await rest.delete(rest.routes.webhooks.id(webhookId), {
986
1030
  reason
987
1031
  });
988
1032
  },
989
1033
  async deleteWebhookMessage (webhookId, token, messageId, options) {
990
- return await rest.delete(rest.routes.webhooks.message(webhookId, token, messageId, options));
1034
+ await rest.delete(rest.routes.webhooks.message(webhookId, token, messageId, options));
991
1035
  },
992
1036
  async deleteWebhookWithToken (webhookId, token) {
993
- return await rest.delete(rest.routes.webhooks.webhook(webhookId, token));
1037
+ await rest.delete(rest.routes.webhooks.webhook(webhookId, token));
994
1038
  },
995
1039
  async editApplicationCommandPermissions (guildId, commandId, bearerToken, options) {
996
1040
  return await rest.put(rest.routes.interactions.commands.permission(rest.applicationId, guildId, commandId), {
@@ -1015,10 +1059,10 @@ export function createRestManager(options) {
1015
1059
  return await rest.patch(rest.routes.channels.channel(channelId), options);
1016
1060
  },
1017
1061
  async editChannelPermissionOverrides (channelId, options) {
1018
- return await rest.put(rest.routes.channels.overwrite(channelId, options.id), options);
1062
+ await rest.put(rest.routes.channels.overwrite(channelId, options.id), options);
1019
1063
  },
1020
1064
  async editChannelPositions (guildId, channelPositions) {
1021
- return await rest.patch(rest.routes.guilds.channels(guildId), channelPositions);
1065
+ await rest.patch(rest.routes.guilds.channels(guildId), channelPositions);
1022
1066
  },
1023
1067
  async editEmoji (guildId, id, options) {
1024
1068
  return await rest.patch(rest.routes.guilds.emoji(guildId, id), options);
@@ -1036,7 +1080,7 @@ export function createRestManager(options) {
1036
1080
  return await rest.patch(rest.routes.interactions.commands.guilds.one(rest.applicationId, guildId, commandId), options);
1037
1081
  },
1038
1082
  async editGuildMfaLevel (guildId, mfaLevel, reason) {
1039
- return await rest.post(rest.routes.guilds.mfa(guildId), {
1083
+ await rest.post(rest.routes.guilds.mfa(guildId), {
1040
1084
  level: mfaLevel,
1041
1085
  reason
1042
1086
  });
@@ -1060,7 +1104,7 @@ export function createRestManager(options) {
1060
1104
  });
1061
1105
  },
1062
1106
  async editOwnVoiceState (guildId, options) {
1063
- return await rest.patch(rest.routes.guilds.voice(guildId), {
1107
+ await rest.patch(rest.routes.guilds.voice(guildId), {
1064
1108
  channel_id: options.channelId,
1065
1109
  suppress: options.suppress,
1066
1110
  request_to_speak_timestamp: options.requestToSpeakTimestamp ? new Date(options.requestToSpeakTimestamp).toISOString() : options.requestToSpeakTimestamp
@@ -1081,7 +1125,7 @@ export function createRestManager(options) {
1081
1125
  });
1082
1126
  },
1083
1127
  async editUserVoiceState (guildId, options) {
1084
- return await rest.patch(rest.routes.guilds.voice(guildId, options.userId), {
1128
+ await rest.patch(rest.routes.guilds.voice(guildId, options.userId), {
1085
1129
  channel_id: options.channelId,
1086
1130
  suppress: options.suppress,
1087
1131
  user_id: options.userId
@@ -1298,24 +1342,24 @@ export function createRestManager(options) {
1298
1342
  return await rest.get(rest.routes.guilds.widget(guildId));
1299
1343
  },
1300
1344
  async joinThread (channelId) {
1301
- return await rest.put(rest.routes.channels.threads.me(channelId));
1345
+ await rest.put(rest.routes.channels.threads.me(channelId));
1302
1346
  },
1303
1347
  async leaveGuild (guildId) {
1304
- return await rest.delete(rest.routes.guilds.leave(guildId));
1348
+ await rest.delete(rest.routes.guilds.leave(guildId));
1305
1349
  },
1306
1350
  async leaveThread (channelId) {
1307
- return await rest.delete(rest.routes.channels.threads.me(channelId));
1351
+ await rest.delete(rest.routes.channels.threads.me(channelId));
1308
1352
  },
1309
1353
  async publishMessage (channelId, messageId) {
1310
1354
  return await rest.post(rest.routes.channels.crosspost(channelId, messageId));
1311
1355
  },
1312
1356
  async removeRole (guildId, userId, roleId, reason) {
1313
- return await rest.delete(rest.routes.guilds.roles.member(guildId, userId, roleId), {
1357
+ await rest.delete(rest.routes.guilds.roles.member(guildId, userId, roleId), {
1314
1358
  reason
1315
1359
  });
1316
1360
  },
1317
1361
  async removeThreadMember (channelId, userId) {
1318
- return await rest.delete(rest.routes.channels.threads.user(channelId, userId));
1362
+ await rest.delete(rest.routes.channels.threads.user(channelId, userId));
1319
1363
  },
1320
1364
  async sendFollowupMessage (token, options) {
1321
1365
  return await new Promise((resolve, reject)=>{
@@ -1328,13 +1372,15 @@ export function createRestManager(options) {
1328
1372
  // TODO: should change to reprocess queue item
1329
1373
  await rest.sendRequest(options);
1330
1374
  },
1331
- resolve: (data)=>resolve(data.status !== 204 ? JSON.parse(data.body ?? '{}') : undefined),
1375
+ resolve: (data)=>{
1376
+ resolve(data.status !== 204 ? JSON.parse(data.body ?? '{}') : undefined);
1377
+ },
1332
1378
  reject
1333
1379
  });
1334
1380
  });
1335
1381
  },
1336
1382
  async sendInteractionResponse (interactionId, token, options) {
1337
- return await new Promise((resolve, reject)=>{
1383
+ await new Promise((resolve, reject)=>{
1338
1384
  rest.sendRequest({
1339
1385
  url: rest.routes.interactions.responses.callback(interactionId, token),
1340
1386
  method: 'POST',
@@ -1344,7 +1390,9 @@ export function createRestManager(options) {
1344
1390
  // TODO: should change to reprocess queue item
1345
1391
  await rest.sendRequest(options);
1346
1392
  },
1347
- resolve: (data)=>resolve(data.status !== 204 ? JSON.parse(data.body ?? '{}') : undefined),
1393
+ resolve: (data)=>{
1394
+ resolve(data.status !== 204 ? JSON.parse(data.body ?? '{}') : undefined);
1395
+ },
1348
1396
  reject
1349
1397
  });
1350
1398
  });
@@ -1362,7 +1410,7 @@ export function createRestManager(options) {
1362
1410
  return await rest.put(rest.routes.guilds.templates.all(guildId));
1363
1411
  },
1364
1412
  async banMember (guildId, userId, options) {
1365
- return await rest.put(rest.routes.guilds.members.ban(guildId, userId), options);
1413
+ await rest.put(rest.routes.guilds.members.ban(guildId, userId), options);
1366
1414
  },
1367
1415
  async editBotMember (guildId, options) {
1368
1416
  return await rest.patch(rest.routes.guilds.members.bot(guildId), options);
@@ -1377,12 +1425,12 @@ export function createRestManager(options) {
1377
1425
  return await rest.get(rest.routes.guilds.members.members(guildId, options));
1378
1426
  },
1379
1427
  async kickMember (guildId, userId, reason) {
1380
- return await rest.delete(rest.routes.guilds.members.member(guildId, userId), {
1428
+ await rest.delete(rest.routes.guilds.members.member(guildId, userId), {
1381
1429
  reason
1382
1430
  });
1383
1431
  },
1384
1432
  async pinMessage (channelId, messageId, reason) {
1385
- return await rest.put(rest.routes.channels.pin(channelId, messageId), reason ? {
1433
+ await rest.put(rest.routes.channels.pin(channelId, messageId), reason ? {
1386
1434
  reason
1387
1435
  } : undefined);
1388
1436
  },
@@ -1393,15 +1441,15 @@ export function createRestManager(options) {
1393
1441
  return await rest.get(rest.routes.guilds.members.search(guildId, query, options));
1394
1442
  },
1395
1443
  async unbanMember (guildId, userId) {
1396
- return await rest.delete(rest.routes.guilds.members.ban(guildId, userId));
1444
+ await rest.delete(rest.routes.guilds.members.ban(guildId, userId));
1397
1445
  },
1398
1446
  async unpinMessage (channelId, messageId, reason) {
1399
- return await rest.delete(rest.routes.channels.pin(channelId, messageId), reason ? {
1447
+ await rest.delete(rest.routes.channels.pin(channelId, messageId), reason ? {
1400
1448
  reason
1401
1449
  } : undefined);
1402
1450
  },
1403
1451
  async triggerTypingIndicator (channelId) {
1404
- return await rest.post(rest.routes.channels.typing(channelId));
1452
+ await rest.post(rest.routes.channels.typing(channelId));
1405
1453
  },
1406
1454
  async upsertGlobalApplicationCommands (commands) {
1407
1455
  return await rest.put(rest.routes.interactions.commands.commands(rest.applicationId), commands);