disgroove 2.2.3-dev.4f98e3d → 2.2.3-dev.7806bb2
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/lib/Client.d.ts +23 -6
- package/dist/lib/Client.js +36 -5
- package/dist/lib/constants.d.ts +6 -0
- package/dist/lib/constants.js +9 -2
- package/dist/lib/gateway/Shard.js +3 -3
- package/dist/lib/gateway/index.d.ts +0 -1
- package/dist/lib/gateway/index.js +0 -1
- package/dist/lib/rest/Endpoints.d.ts +2 -0
- package/dist/lib/rest/Endpoints.js +5 -1
- package/dist/lib/transformers/Channels.js +28 -2
- package/dist/lib/types/channel.d.ts +14 -3
- package/dist/lib/types/gateway-events.d.ts +4 -4
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/dist/lib/gateway/ShardManager.d.ts +0 -10
- package/dist/lib/gateway/ShardManager.js +0 -18
package/dist/lib/Client.d.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
import { GatewayIntents, type OAuth2Scopes, type ActionTypes, type ImageWidgetStyleOptions, type MFALevel, type ReactionTypes, type ApplicationCommandTypes, type EventTypes, type TriggerTypes, type ChannelTypes, type VideoQualityModes, type SortOrderTypes, type ForumLayoutTypes, type InviteTargetTypes, type VerificationLevel, type DefaultMessageNotificationLevel, type ExplicitContentFilterLevel, type SystemChannelFlags, type ApplicationFlags, type ApplicationIntegrationTypes, type ChannelFlags, type GuildFeatures, type GuildScheduledEventEntityTypes, type GuildScheduledEventPrivacyLevel, type GuildScheduledEventStatus, type MessageFlags, type OnboardingMode, type PrivacyLevel, type GuildMemberFlags, type InteractionContextTypes } from "./constants";
|
3
3
|
import { RequestManager, type File } from "./rest";
|
4
4
|
import EventEmitter from "node:events";
|
5
|
-
import {
|
5
|
+
import { Shard } from "./gateway";
|
6
6
|
import type { Application, ApplicationIntegrationTypeConfiguration, InstallParams } from "./types/application";
|
7
7
|
import type { ApplicationCommand, GuildApplicationCommandPermissions, ApplicationCommandOption, ApplicationCommandPermission } from "./types/application-command";
|
8
8
|
import type { ApplicationRoleConnectionMetadata } from "./types/application-role-connection-metadata";
|
@@ -50,7 +50,7 @@ export declare class Client extends EventEmitter {
|
|
50
50
|
intents: GatewayIntents | number;
|
51
51
|
shardsCount: number | "auto";
|
52
52
|
auth: "Bot" | "Bearer";
|
53
|
-
shards:
|
53
|
+
shards: Map<number, Shard>;
|
54
54
|
rest: RequestManager;
|
55
55
|
guildShardMap: Record<string, number>;
|
56
56
|
user: User | null;
|
@@ -136,6 +136,11 @@ export declare class Client extends EventEmitter {
|
|
136
136
|
exemptRoles?: Array<snowflake>;
|
137
137
|
exemptChannels?: Array<snowflake>;
|
138
138
|
}, reason?: string): Promise<AutoModerationRule>;
|
139
|
+
/** https://discord.com/developers/docs/resources/emoji#create-application-emoji */
|
140
|
+
createApplicationEmoji(applicationID: snowflake, options: {
|
141
|
+
name: string;
|
142
|
+
image: string;
|
143
|
+
}): Promise<Emoji>;
|
139
144
|
/** https://discord.com/developers/docs/resources/guild#create-guild-channel */
|
140
145
|
createChannel(guildID: snowflake, options: {
|
141
146
|
name: string;
|
@@ -367,6 +372,8 @@ export declare class Client extends EventEmitter {
|
|
367
372
|
deleteAllMessageReactions(channelID: snowflake, messageID: snowflake, emoji?: string): void;
|
368
373
|
/** https://discord.com/developers/docs/resources/auto-moderation#delete-auto-moderation-rule */
|
369
374
|
deleteAutoModerationRule(guildID: snowflake, autoModerationRuleID: snowflake, reason?: string): void;
|
375
|
+
/** https://discord.com/developers/docs/resources/emoji#delete-application-emoji */
|
376
|
+
deleteApplicationEmoji(applicationID: snowflake, emojiID: snowflake): void;
|
370
377
|
/** https://discord.com/developers/docs/resources/channel#deleteclose-channel */
|
371
378
|
deleteChannel(channelID: snowflake, reason?: string): Promise<Channel>;
|
372
379
|
/** https://discord.com/developers/docs/resources/channel#delete-channel-permission */
|
@@ -427,6 +434,10 @@ export declare class Client extends EventEmitter {
|
|
427
434
|
editApplicationCommandPermissions(applicationID: snowflake, guildID: snowflake, commandID: snowflake, options: {
|
428
435
|
permissions: Array<ApplicationCommandPermission>;
|
429
436
|
}): Promise<GuildApplicationCommandPermissions>;
|
437
|
+
/** https://discord.com/developers/docs/resources/emoji#modify-application-emoji */
|
438
|
+
editApplicationEmoji(applicationID: snowflake, emojiID: snowflake, options: {
|
439
|
+
name: string;
|
440
|
+
}): Promise<Emoji>;
|
430
441
|
/** https://discord.com/developers/docs/resources/channel#modify-channel */
|
431
442
|
editChannel(channelID: snowflake, options: {
|
432
443
|
name?: string;
|
@@ -740,6 +751,12 @@ export declare class Client extends EventEmitter {
|
|
740
751
|
getAutoModerationRules(guildID: snowflake): Promise<Array<AutoModerationRule>>;
|
741
752
|
/** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
|
742
753
|
getApplicationCommandPermissions(applicationID: snowflake, guildID: snowflake, commandID: snowflake): Promise<GuildApplicationCommandPermissions>;
|
754
|
+
/** https://discord.com/developers/docs/resources/emoji#get-application-emoji */
|
755
|
+
getApplicationEmoji(applicationID: snowflake, emojiID: snowflake): Promise<Emoji>;
|
756
|
+
/** https://discord.com/developers/docs/resources/emoji#list-application-emojis */
|
757
|
+
getApplicationEmojis(applicationID: snowflake): Promise<{
|
758
|
+
items: Array<Emoji>;
|
759
|
+
}>;
|
743
760
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records */
|
744
761
|
getApplicationRoleConnectionMetadataRecords(applicationID: snowflake): Promise<Array<ApplicationRoleConnectionMetadata>>;
|
745
762
|
/** https://discord.com/developers/docs/resources/channel#get-channel */
|
@@ -799,7 +816,7 @@ export declare class Client extends EventEmitter {
|
|
799
816
|
after?: snowflake;
|
800
817
|
limit?: number;
|
801
818
|
withCounts?: boolean;
|
802
|
-
}): Promise<Array<Pick<Guild, "id" | "name" | "icon" | "owner" | "permissions" | "features" | "approximateMemberCount" | "approximatePresenceCount">>>;
|
819
|
+
}): Promise<Array<Pick<Guild, "id" | "name" | "icon" | "banner" | "owner" | "permissions" | "features" | "approximateMemberCount" | "approximatePresenceCount">>>;
|
803
820
|
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
|
804
821
|
getGuildApplicationCommand(applicationID: snowflake, guildID: snowflake, commandID: snowflake): Promise<ApplicationCommand>;
|
805
822
|
/** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
|
@@ -1023,9 +1040,9 @@ export declare interface Client extends EventEmitter {
|
|
1023
1040
|
removeListener<K extends keyof ClientEvents>(eventName: K, listener: (...args: ClientEvents[K]) => void): this;
|
1024
1041
|
}
|
1025
1042
|
export interface ClientEvents {
|
1026
|
-
dispatch: [packet: RawPayload];
|
1027
|
-
heartbeatACK: [];
|
1028
|
-
hello: [interval: number];
|
1043
|
+
dispatch: [packet: RawPayload, shard: number];
|
1044
|
+
heartbeatACK: [shard: number];
|
1045
|
+
hello: [interval: number, shard: number];
|
1029
1046
|
ready: [];
|
1030
1047
|
resumed: [];
|
1031
1048
|
reconnect: [];
|
package/dist/lib/Client.js
CHANGED
@@ -40,7 +40,7 @@ class Client extends node_events_1.default {
|
|
40
40
|
: 0;
|
41
41
|
this.shardsCount = options?.shardsCount ?? "auto";
|
42
42
|
this.auth = options?.auth ?? "Bot";
|
43
|
-
this.shards = new
|
43
|
+
this.shards = new Map();
|
44
44
|
this.rest = new rest_1.RequestManager(token, this.auth);
|
45
45
|
this.guildShardMap = {};
|
46
46
|
this.user = null;
|
@@ -158,7 +158,7 @@ class Client extends node_events_1.default {
|
|
158
158
|
: this.shardsCount;
|
159
159
|
for (let i = 0; i < this.shardsCount; i++)
|
160
160
|
this.shards.set(i, new gateway_1.Shard(i, this));
|
161
|
-
this.shards.connect();
|
161
|
+
this.shards.forEach((shard) => shard.connect());
|
162
162
|
}
|
163
163
|
/** https://discord.com/developers/docs/monetization/entitlements#consume-an-entitlement */
|
164
164
|
consumeEntitlement(applicationID, entitlementID) {
|
@@ -183,6 +183,13 @@ class Client extends node_events_1.default {
|
|
183
183
|
});
|
184
184
|
return transformers_1.AutoModeration.autoModerationRuleFromRaw(response);
|
185
185
|
}
|
186
|
+
/** https://discord.com/developers/docs/resources/emoji#create-application-emoji */
|
187
|
+
async createApplicationEmoji(applicationID, options) {
|
188
|
+
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.applicationEmojis(applicationID), {
|
189
|
+
json: options,
|
190
|
+
});
|
191
|
+
return transformers_1.Emojis.emojiFromRaw(response);
|
192
|
+
}
|
186
193
|
/** https://discord.com/developers/docs/resources/guild#create-guild-channel */
|
187
194
|
async createChannel(guildID, options, reason) {
|
188
195
|
const response = await this.rest.request(rest_1.RESTMethods.Post, rest_1.Endpoints.guildChannels(guildID), {
|
@@ -707,6 +714,10 @@ class Client extends node_events_1.default {
|
|
707
714
|
reason,
|
708
715
|
});
|
709
716
|
}
|
717
|
+
/** https://discord.com/developers/docs/resources/emoji#delete-application-emoji */
|
718
|
+
deleteApplicationEmoji(applicationID, emojiID) {
|
719
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.applicationEmoji(applicationID, emojiID));
|
720
|
+
}
|
710
721
|
/** https://discord.com/developers/docs/resources/channel#deleteclose-channel */
|
711
722
|
async deleteChannel(channelID, reason) {
|
712
723
|
const response = await this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.channel(channelID), {
|
@@ -822,7 +833,7 @@ class Client extends node_events_1.default {
|
|
822
833
|
});
|
823
834
|
}
|
824
835
|
disconnect() {
|
825
|
-
this.shards.disconnect();
|
836
|
+
this.shards.forEach((shard) => shard.disconnect());
|
826
837
|
}
|
827
838
|
/** https://discord.com/developers/docs/resources/auto-moderation#modify-auto-moderation-rule */
|
828
839
|
async editAutoModerationRule(guildID, autoModerationRuleID, options, reason) {
|
@@ -856,6 +867,13 @@ class Client extends node_events_1.default {
|
|
856
867
|
});
|
857
868
|
return transformers_1.Guilds.guildApplicationCommandPermissionsFromRaw(response);
|
858
869
|
}
|
870
|
+
/** https://discord.com/developers/docs/resources/emoji#modify-application-emoji */
|
871
|
+
async editApplicationEmoji(applicationID, emojiID, options) {
|
872
|
+
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.applicationEmoji(applicationID, emojiID), {
|
873
|
+
json: options,
|
874
|
+
});
|
875
|
+
return transformers_1.Emojis.emojiFromRaw(response);
|
876
|
+
}
|
859
877
|
/** https://discord.com/developers/docs/resources/channel#modify-channel */
|
860
878
|
async editChannel(channelID, options, reason) {
|
861
879
|
const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.channel(channelID), {
|
@@ -1546,6 +1564,18 @@ class Client extends node_events_1.default {
|
|
1546
1564
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationCommandPermissions(applicationID, guildID, commandID));
|
1547
1565
|
return transformers_1.Guilds.guildApplicationCommandPermissionsFromRaw(response);
|
1548
1566
|
}
|
1567
|
+
/** https://discord.com/developers/docs/resources/emoji#get-application-emoji */
|
1568
|
+
async getApplicationEmoji(applicationID, emojiID) {
|
1569
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationEmoji(applicationID, emojiID));
|
1570
|
+
return transformers_1.Emojis.emojiFromRaw(response);
|
1571
|
+
}
|
1572
|
+
/** https://discord.com/developers/docs/resources/emoji#list-application-emojis */
|
1573
|
+
async getApplicationEmojis(applicationID) {
|
1574
|
+
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationEmojis(applicationID));
|
1575
|
+
return {
|
1576
|
+
items: response.items.map((emoji) => transformers_1.Emojis.emojiFromRaw(emoji)),
|
1577
|
+
};
|
1578
|
+
}
|
1549
1579
|
/** https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records */
|
1550
1580
|
async getApplicationRoleConnectionMetadataRecords(applicationID) {
|
1551
1581
|
const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationRoleConnectionMetadata(applicationID));
|
@@ -1675,6 +1705,7 @@ class Client extends node_events_1.default {
|
|
1675
1705
|
return response.map((guild) => ({
|
1676
1706
|
id: guild.id,
|
1677
1707
|
name: guild.name,
|
1708
|
+
banner: guild.banner,
|
1678
1709
|
icon: guild.icon,
|
1679
1710
|
owner: guild.owner,
|
1680
1711
|
permissions: guild.permissions,
|
@@ -2118,7 +2149,7 @@ class Client extends node_events_1.default {
|
|
2118
2149
|
}
|
2119
2150
|
/** https://discord.com/developers/docs/resources/channel#leave-thread */
|
2120
2151
|
leaveThread(channelID) {
|
2121
|
-
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(channelID));
|
2152
|
+
this.rest.request(rest_1.RESTMethods.Delete, rest_1.Endpoints.threadMembers(channelID, "@me"));
|
2122
2153
|
}
|
2123
2154
|
/** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
|
2124
2155
|
leaveVoiceChannel(guildID) {
|
@@ -2173,7 +2204,7 @@ class Client extends node_events_1.default {
|
|
2173
2204
|
}
|
2174
2205
|
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
2175
2206
|
setPresence(options) {
|
2176
|
-
this.shards.updatePresence(options);
|
2207
|
+
this.shards.forEach((shard) => shard.updatePresence(options));
|
2177
2208
|
}
|
2178
2209
|
/** https://discord.com/developers/docs/resources/guild-template#sync-guild-template */
|
2179
2210
|
async syncGuildTemplate(guildID, code) {
|
package/dist/lib/constants.d.ts
CHANGED
@@ -353,6 +353,11 @@ export declare enum MessageFlags {
|
|
353
353
|
SuppressNotifications = 4096,
|
354
354
|
IsVoiceMessage = 8192
|
355
355
|
}
|
356
|
+
/** https://discord.com/developers/docs/resources/channel#message-object-message-reference-types */
|
357
|
+
export declare enum MessageReferenceTypes {
|
358
|
+
Default = 0,
|
359
|
+
Forward = 1
|
360
|
+
}
|
356
361
|
/** https://discord.com/developers/docs/resources/channel#attachment-object-attachment-flags */
|
357
362
|
export declare enum AttachmentFlags {
|
358
363
|
IsRemix = 4
|
@@ -569,6 +574,7 @@ export declare enum Services {
|
|
569
574
|
Playstation = "playstation",
|
570
575
|
Reddit = "reddit",
|
571
576
|
RiotGames = "riotgames",
|
577
|
+
Roblox = "roblox",
|
572
578
|
Spotify = "spotify",
|
573
579
|
Skype = "skype",
|
574
580
|
Steam = "steam",
|
package/dist/lib/constants.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
exports.EntitlementTypes = exports.SKUFlags = exports.SKUTypes = exports.MembershipState = exports.TeamMemberRoleTypes = exports.RoleFlags = exports.BitwisePermissionFlags = exports.RPCCloseEventCodes = exports.RPCErrorCodes = exports.JSONErrorCodes = exports.HTTPResponseCodes = exports.VoiceCloseEventCodes = exports.VoiceOPCodes = exports.GatewayCloseEventCodes = exports.GatewayOPCodes = exports.OAuth2Scopes = exports.ActivityFlags = exports.ActivityType = exports.GatewayEvents = exports.StatusTypes = exports.GatewayIntents = exports.DeviceType = exports.WebhookTypes = exports.VisibilityTypes = exports.Services = exports.PremiumTypes = exports.UserFlags = exports.StickerFormatTypes = exports.StickerTypes = exports.PrivacyLevel = exports.LayoutType = exports.InviteTargetTypes = void 0;
|
3
|
+
exports.GuildScheduledEventStatus = exports.GuildScheduledEventEntityTypes = exports.GuildScheduledEventPrivacyLevel = exports.ImageWidgetStyleOptions = exports.PromptTypes = exports.OnboardingMode = exports.IntegrationExpireBehaviors = exports.GuildMemberFlags = exports.MutableGuildFeatures = exports.GuildFeatures = exports.SystemChannelFlags = exports.PremiumTier = exports.GuildNSFWLevel = exports.VerificationLevel = exports.MFALevel = exports.ExplicitContentFilterLevel = exports.DefaultMessageNotificationLevel = exports.ReactionTypes = exports.AllowedMentionTypes = exports.AttachmentFlags = exports.MessageReferenceTypes = exports.MessageFlags = exports.MessageActivityTypes = exports.MessageTypes = exports.ForumLayoutTypes = exports.SortOrderTypes = exports.ChannelFlags = exports.VideoQualityModes = exports.ChannelTypes = exports.ActionTypes = exports.EventTypes = exports.KeywordPresetTypes = exports.TriggerTypes = exports.AuditLogEvents = exports.ApplicationRoleConnectionMetadataType = exports.ApplicationFlags = exports.ApplicationIntegrationTypes = exports.TextInputStyles = exports.ButtonStyles = exports.InteractionCallbackType = exports.ComponentTypes = exports.InteractionContextTypes = exports.InteractionType = exports.ApplicationCommandPermissionType = exports.ApplicationCommandOptionType = exports.ApplicationCommandTypes = exports.Locales = exports.ImageFormats = exports.GuildNavigationTypes = exports.TimestampStyles = void 0;
|
4
|
+
exports.EntitlementTypes = exports.SKUFlags = exports.SKUTypes = exports.MembershipState = exports.TeamMemberRoleTypes = exports.RoleFlags = exports.BitwisePermissionFlags = exports.RPCCloseEventCodes = exports.RPCErrorCodes = exports.JSONErrorCodes = exports.HTTPResponseCodes = exports.VoiceCloseEventCodes = exports.VoiceOPCodes = exports.GatewayCloseEventCodes = exports.GatewayOPCodes = exports.OAuth2Scopes = exports.ActivityFlags = exports.ActivityType = exports.GatewayEvents = exports.StatusTypes = exports.GatewayIntents = exports.DeviceType = exports.WebhookTypes = exports.VisibilityTypes = exports.Services = exports.PremiumTypes = exports.UserFlags = exports.StickerFormatTypes = exports.StickerTypes = exports.PrivacyLevel = exports.LayoutType = exports.InviteTargetTypes = exports.InviteTypes = void 0;
|
5
5
|
/** https://discord.com/developers/docs/reference#message-formatting-timestamp-styles */
|
6
6
|
var TimestampStyles;
|
7
7
|
(function (TimestampStyles) {
|
@@ -386,6 +386,12 @@ var MessageFlags;
|
|
386
386
|
MessageFlags[MessageFlags["SuppressNotifications"] = 4096] = "SuppressNotifications";
|
387
387
|
MessageFlags[MessageFlags["IsVoiceMessage"] = 8192] = "IsVoiceMessage";
|
388
388
|
})(MessageFlags || (exports.MessageFlags = MessageFlags = {}));
|
389
|
+
/** https://discord.com/developers/docs/resources/channel#message-object-message-reference-types */
|
390
|
+
var MessageReferenceTypes;
|
391
|
+
(function (MessageReferenceTypes) {
|
392
|
+
MessageReferenceTypes[MessageReferenceTypes["Default"] = 0] = "Default";
|
393
|
+
MessageReferenceTypes[MessageReferenceTypes["Forward"] = 1] = "Forward";
|
394
|
+
})(MessageReferenceTypes || (exports.MessageReferenceTypes = MessageReferenceTypes = {}));
|
389
395
|
/** https://discord.com/developers/docs/resources/channel#attachment-object-attachment-flags */
|
390
396
|
var AttachmentFlags;
|
391
397
|
(function (AttachmentFlags) {
|
@@ -631,6 +637,7 @@ var Services;
|
|
631
637
|
Services["Playstation"] = "playstation";
|
632
638
|
Services["Reddit"] = "reddit";
|
633
639
|
Services["RiotGames"] = "riotgames";
|
640
|
+
Services["Roblox"] = "roblox";
|
634
641
|
Services["Spotify"] = "spotify";
|
635
642
|
Services["Skype"] = "skype";
|
636
643
|
Services["Steam"] = "steam";
|
@@ -88,7 +88,7 @@ class Shard {
|
|
88
88
|
}));
|
89
89
|
}
|
90
90
|
onDispatch(packet) {
|
91
|
-
this.client.emit("dispatch", packet);
|
91
|
+
this.client.emit("dispatch", packet, this.id);
|
92
92
|
switch (packet.t) {
|
93
93
|
case constants_1.GatewayEvents.Ready:
|
94
94
|
{
|
@@ -545,11 +545,11 @@ class Shard {
|
|
545
545
|
case constants_1.GatewayOPCodes.Hello:
|
546
546
|
{
|
547
547
|
this.heartbeatInterval = setInterval(() => this.heartbeat(null), packet.d.heartbeat_interval);
|
548
|
-
this.client.emit("hello", packet.d.heartbeat_interval);
|
548
|
+
this.client.emit("hello", packet.d.heartbeat_interval, this.id);
|
549
549
|
}
|
550
550
|
break;
|
551
551
|
case constants_1.GatewayOPCodes.HeartbeatACK:
|
552
|
-
this.client.emit("heartbeatACK");
|
552
|
+
this.client.emit("heartbeatACK", this.id);
|
553
553
|
break;
|
554
554
|
}
|
555
555
|
}
|
@@ -72,6 +72,8 @@ export declare const applicationCommand: (applicationID: snowflake, commandID: s
|
|
72
72
|
export declare const applicationCommands: (applicationID: snowflake) => `applications/${string}/commands`;
|
73
73
|
export declare const applicationCommandPermissions: (applicationID: snowflake, guildID: snowflake, commandID: snowflake) => `applications/${string}/guilds/${string}/commands/${string}/permissions`;
|
74
74
|
export declare const applicationUser: () => "applications/@me";
|
75
|
+
export declare const applicationEmoji: (applicationID: snowflake, emojiID: snowflake) => `applications/${string}/emojis/${string}`;
|
76
|
+
export declare const applicationEmojis: (applicationID: snowflake) => `applications/${string}/emojis`;
|
75
77
|
export declare const applicationEntitlement: (applicationID: snowflake, entitlementID: snowflake) => `applications/${string}/entitlements/${string}`;
|
76
78
|
export declare const applicationEntitlementConsume: (applicationID: snowflake, entitlementID: snowflake) => `applications/${string}/entitlements/${string}/consume`;
|
77
79
|
export declare const applicationEntitlements: (applicationID: snowflake) => `applications/${string}/entitlements`;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.channelMessageCrosspost = exports.channelMessageAllReactions = exports.channelMessage = exports.channelInvites = exports.channelFollowers = exports.channelBulkDelete = exports.channel = exports.template = exports.guildWidgetSettings = exports.guildWidgetJSON = exports.guildWidgetImage = exports.guildWelcomeScreen = exports.guildWebhooks = exports.guildVoiceState = exports.guildVoiceRegions = exports.guildVanityURL = exports.guildTemplates = exports.guildTemplate = exports.guildStickers = exports.guildSticker = exports.guildScheduledEventUsers = exports.guildScheduledEvents = exports.guildScheduledEvent = exports.guildRoles = exports.guildRole = exports.guildPrune = exports.guildPreview = exports.guildOnboarding = exports.guildMemberVerification = exports.guildMembersSearch = exports.guildMembers = exports.guildMemberRole = exports.guildMember = exports.guildMFA = exports.guildInvites = exports.guildIntegrations = exports.guildIntegration = exports.guildEmojis = exports.guildEmoji = exports.guildMemberNickname = exports.guildChannels = exports.guildBulkBan = exports.guildBans = exports.guildBan = exports.guildAutoModerationRules = exports.guildAutoModerationRule = exports.guildAuditLog = exports.guildActiveThreads = exports.guilds = exports.guild = void 0;
|
4
|
-
exports.voiceRegions = exports.stickerPacks = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.oauth2Authorization = exports.oauth2Application = exports.oauth2Authorize = exports.gatewayBot = exports.gateway = exports.webhookPlatform = exports.webhookMessage = exports.webhook = exports.guildApplicationCommandsPermissions = exports.applicationSKUs = exports.applicationRoleConnectionMetadata = exports.applicationGuildCommands = exports.applicationGuildCommand = exports.applicationEntitlements = exports.applicationEntitlementConsume = exports.applicationEntitlement = exports.applicationUser = exports.applicationCommandPermissions = exports.applicationCommands = exports.applicationCommand = exports.userGuilds = exports.userGuild = exports.userConnections = exports.userChannels = exports.userApplicationRoleConnection = exports.user = exports.pollExpire = exports.pollAnswerVoters = exports.threadMembers = exports.threads = exports.channelWebhooks = exports.channelTyping = exports.channelThreads = exports.channelRecipient = exports.channelPins = exports.channelPin = exports.channelPermission = exports.channelMessages = exports.channelMessageReaction = void 0;
|
4
|
+
exports.voiceRegions = exports.stickerPacks = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.oauth2Authorization = exports.oauth2Application = exports.oauth2Authorize = exports.gatewayBot = exports.gateway = exports.webhookPlatform = exports.webhookMessage = exports.webhook = exports.guildApplicationCommandsPermissions = exports.applicationSKUs = exports.applicationRoleConnectionMetadata = exports.applicationGuildCommands = exports.applicationGuildCommand = exports.applicationEntitlements = exports.applicationEntitlementConsume = exports.applicationEntitlement = exports.applicationEmojis = exports.applicationEmoji = exports.applicationUser = exports.applicationCommandPermissions = exports.applicationCommands = exports.applicationCommand = exports.userGuilds = exports.userGuild = exports.userConnections = exports.userChannels = exports.userApplicationRoleConnection = exports.user = exports.pollExpire = exports.pollAnswerVoters = exports.threadMembers = exports.threads = exports.channelWebhooks = exports.channelTyping = exports.channelThreads = exports.channelRecipient = exports.channelPins = exports.channelPin = exports.channelPermission = exports.channelMessages = exports.channelMessageReaction = void 0;
|
5
5
|
// Guilds
|
6
6
|
const guild = (guildID) => `guilds/${guildID}`;
|
7
7
|
exports.guild = guild;
|
@@ -160,6 +160,10 @@ const applicationCommandPermissions = (applicationID, guildID, commandID) => `ap
|
|
160
160
|
exports.applicationCommandPermissions = applicationCommandPermissions;
|
161
161
|
const applicationUser = () => "applications/@me";
|
162
162
|
exports.applicationUser = applicationUser;
|
163
|
+
const applicationEmoji = (applicationID, emojiID) => `applications/${applicationID}/emojis/${emojiID}`;
|
164
|
+
exports.applicationEmoji = applicationEmoji;
|
165
|
+
const applicationEmojis = (applicationID) => `applications/${applicationID}/emojis`;
|
166
|
+
exports.applicationEmojis = applicationEmojis;
|
163
167
|
const applicationEntitlement = (applicationID, entitlementID) => `applications/${applicationID}/entitlements/${entitlementID}`;
|
164
168
|
exports.applicationEntitlement = applicationEntitlement;
|
165
169
|
const applicationEntitlementConsume = (applicationID, entitlementID) => `applications/${applicationID}/entitlements/${entitlementID}/consume`;
|
@@ -499,6 +499,7 @@ class Channels {
|
|
499
499
|
? Applications_1.Applications.applicationFromRaw(message.application)
|
500
500
|
: undefined,
|
501
501
|
applicationID: message.application_id,
|
502
|
+
flags: message.flags,
|
502
503
|
messageReference: message.message_reference !== undefined
|
503
504
|
? {
|
504
505
|
messageID: message.message_reference.message_id,
|
@@ -507,7 +508,19 @@ class Channels {
|
|
507
508
|
failIfNotExists: message.message_reference.fail_if_not_exists,
|
508
509
|
}
|
509
510
|
: undefined,
|
510
|
-
|
511
|
+
messageSnapshots: message.message_snapshots?.map((messageSnapshot) => ({
|
512
|
+
message: {
|
513
|
+
type: messageSnapshot.message.type,
|
514
|
+
content: messageSnapshot.message.content,
|
515
|
+
embeds: messageSnapshot.message.embeds.map((embed) => this.embedFromRaw(embed)),
|
516
|
+
attachments: messageSnapshot.message.attachments.map((attachment) => this.attachmentFromRaw(attachment)),
|
517
|
+
timestamp: messageSnapshot.message.timestamp,
|
518
|
+
editedTimestamp: messageSnapshot.message.edited_timestamp,
|
519
|
+
flags: messageSnapshot.message.flags,
|
520
|
+
mentions: messageSnapshot.message.mentions.map((user) => Users_1.Users.userFromRaw(user)),
|
521
|
+
mentionRoles: messageSnapshot.message.mention_roles,
|
522
|
+
},
|
523
|
+
})),
|
511
524
|
referencedMessage: message.referenced_message !== undefined
|
512
525
|
? message.referenced_message !== null
|
513
526
|
? Channels.messageFromRaw(message.referenced_message)
|
@@ -594,6 +607,7 @@ class Channels {
|
|
594
607
|
? Applications_1.Applications.applicationToRaw(message.application)
|
595
608
|
: undefined,
|
596
609
|
application_id: message.applicationID,
|
610
|
+
flags: message.flags,
|
597
611
|
message_reference: message.messageReference !== undefined
|
598
612
|
? {
|
599
613
|
message_id: message.messageReference.messageID,
|
@@ -602,7 +616,19 @@ class Channels {
|
|
602
616
|
fail_if_not_exists: message.messageReference.failIfNotExists,
|
603
617
|
}
|
604
618
|
: undefined,
|
605
|
-
|
619
|
+
message_snapshots: message.messageSnapshots?.map((messageSnapshot) => ({
|
620
|
+
message: {
|
621
|
+
type: messageSnapshot.message.type,
|
622
|
+
content: messageSnapshot.message.content,
|
623
|
+
embeds: messageSnapshot.message.embeds.map((embed) => this.embedToRaw(embed)),
|
624
|
+
attachments: messageSnapshot.message.attachments.map((attachment) => this.attachmentToRaw(attachment)),
|
625
|
+
timestamp: messageSnapshot.message.timestamp,
|
626
|
+
edited_timestamp: messageSnapshot.message.editedTimestamp,
|
627
|
+
flags: messageSnapshot.message.flags,
|
628
|
+
mentions: messageSnapshot.message.mentions.map((user) => Users_1.Users.userToRaw(user)),
|
629
|
+
mention_roles: messageSnapshot.message.mentionRoles,
|
630
|
+
},
|
631
|
+
})),
|
606
632
|
referenced_message: message.referencedMessage !== undefined
|
607
633
|
? message.referencedMessage !== null
|
608
634
|
? Channels.messageToRaw(message.referencedMessage)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { AllowedMentionTypes, ApplicationIntegrationTypes, AttachmentFlags, ChannelFlags, ChannelTypes, ForumLayoutTypes, InteractionType, MessageActivityTypes, MessageFlags, MessageTypes, SortOrderTypes, VideoQualityModes } from "../constants";
|
1
|
+
import type { AllowedMentionTypes, ApplicationIntegrationTypes, AttachmentFlags, ChannelFlags, ChannelTypes, ForumLayoutTypes, InteractionType, MessageActivityTypes, MessageFlags, MessageReferenceTypes, MessageTypes, SortOrderTypes, VideoQualityModes } from "../constants";
|
2
2
|
import type { RawApplication, Application } from "./application";
|
3
3
|
import type { snowflake, timestamp } from "./common";
|
4
4
|
import type { RawEmoji, Emoji } from "./emoji";
|
@@ -69,8 +69,9 @@ export interface RawMessage {
|
|
69
69
|
activity?: RawMessageActivity;
|
70
70
|
application?: RawApplication;
|
71
71
|
application_id?: snowflake;
|
72
|
-
message_reference?: RawMessageReference;
|
73
72
|
flags?: MessageFlags;
|
73
|
+
message_reference?: RawMessageReference;
|
74
|
+
message_snapshots?: Array<RawMessageSnapshot>;
|
74
75
|
referenced_message?: RawMessage | null;
|
75
76
|
interaction_metadata?: RawMessageInteractionMetadata;
|
76
77
|
interaction?: RawMessageInteraction;
|
@@ -106,11 +107,16 @@ export interface RawMessageCall {
|
|
106
107
|
}
|
107
108
|
/** https://discord.com/developers/docs/resources/channel#message-reference-object-message-reference-structure */
|
108
109
|
export interface RawMessageReference {
|
110
|
+
type?: MessageReferenceTypes;
|
109
111
|
message_id?: snowflake;
|
110
112
|
channel_id?: snowflake;
|
111
113
|
guild_id?: snowflake;
|
112
114
|
fail_if_not_exists?: boolean;
|
113
115
|
}
|
116
|
+
/** https://discord.com/developers/docs/resources/channel#message-snapshot-object-message-snapshot-structure */
|
117
|
+
export interface RawMessageSnapshot {
|
118
|
+
message: Pick<RawMessage, "type" | "content" | "embeds" | "attachments" | "timestamp" | "edited_timestamp" | "flags" | "mentions" | "mention_roles">;
|
119
|
+
}
|
114
120
|
/** https://discord.com/developers/docs/resources/channel#followed-channel-object-followed-channel-structure */
|
115
121
|
export interface RawFollowedChannel {
|
116
122
|
channel_id: snowflake;
|
@@ -325,8 +331,9 @@ export interface Message {
|
|
325
331
|
activity?: MessageActivity;
|
326
332
|
application?: Application;
|
327
333
|
applicationID?: snowflake;
|
328
|
-
messageReference?: MessageReference;
|
329
334
|
flags?: MessageFlags;
|
335
|
+
messageReference?: MessageReference;
|
336
|
+
messageSnapshots?: Array<MessageSnapshot>;
|
330
337
|
referencedMessage?: Message | null;
|
331
338
|
interactionMetadata?: MessageInteractionMetadata;
|
332
339
|
interaction?: MessageInteraction;
|
@@ -358,11 +365,15 @@ export interface MessageCall {
|
|
358
365
|
endedTimestamp?: timestamp | null;
|
359
366
|
}
|
360
367
|
export interface MessageReference {
|
368
|
+
type?: MessageReferenceTypes;
|
361
369
|
messageID?: snowflake;
|
362
370
|
channelID?: snowflake;
|
363
371
|
guildID?: snowflake;
|
364
372
|
failIfNotExists?: boolean;
|
365
373
|
}
|
374
|
+
export interface MessageSnapshot {
|
375
|
+
message: Pick<Message, "type" | "content" | "embeds" | "attachments" | "timestamp" | "editedTimestamp" | "flags" | "mentions" | "mentionRoles">;
|
376
|
+
}
|
366
377
|
export interface FollowedChannel {
|
367
378
|
channelID: snowflake;
|
368
379
|
webhookID: snowflake;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { ActivityFlags, ActivityType, GatewayIntents, GatewayOPCodes, GuildMemberFlags, InviteTargetTypes, ReactionTypes, StatusTypes, TriggerTypes } from "../constants";
|
1
|
+
import type { ActivityFlags, ActivityType, GatewayEvents, GatewayIntents, GatewayOPCodes, GuildMemberFlags, InviteTargetTypes, ReactionTypes, StatusTypes, TriggerTypes } from "../constants";
|
2
2
|
import type { RawApplication, Application } from "./application";
|
3
3
|
import type { RawAutoModerationAction, AutoModerationAction } from "./auto-moderation";
|
4
4
|
import type { RawChannel, RawThreadMember, Channel, ThreadMember } from "./channel";
|
@@ -11,10 +11,10 @@ import type { RawUser, RawAvatarDecorationData, User, AvatarDecorationData } fro
|
|
11
11
|
import type { RawVoiceState, VoiceState } from "./voice";
|
12
12
|
/** https://discord.com/developers/docs/topics/gateway-events#payload-structure */
|
13
13
|
export interface RawPayload {
|
14
|
-
op:
|
14
|
+
op: GatewayOPCodes;
|
15
15
|
d: any | null;
|
16
16
|
s: number | null;
|
17
|
-
t:
|
17
|
+
t: GatewayEvents | null;
|
18
18
|
}
|
19
19
|
/** https://discord.com/developers/docs/topics/gateway-events#identify-identify-structure */
|
20
20
|
export interface RawIdentify {
|
@@ -356,7 +356,7 @@ export interface Payload {
|
|
356
356
|
op: GatewayOPCodes;
|
357
357
|
d: any | null;
|
358
358
|
s: number | null;
|
359
|
-
t:
|
359
|
+
t: GatewayEvents | null;
|
360
360
|
}
|
361
361
|
export interface Identify {
|
362
362
|
token: string;
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { Shard } from ".";
|
2
|
-
import type { GatewayPresenceUpdate } from "../types/gateway-events";
|
3
|
-
export declare class ShardManager extends Map<number, Shard> {
|
4
|
-
/** https://discord.com/developers/docs/topics/gateway#connections */
|
5
|
-
connect(): void;
|
6
|
-
/** https://discord.com/developers/docs/topics/gateway#connections */
|
7
|
-
disconnect(): void;
|
8
|
-
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
9
|
-
updatePresence(options: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>): void;
|
10
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ShardManager = void 0;
|
4
|
-
class ShardManager extends Map {
|
5
|
-
/** https://discord.com/developers/docs/topics/gateway#connections */
|
6
|
-
connect() {
|
7
|
-
this.forEach((shard) => shard.connect());
|
8
|
-
}
|
9
|
-
/** https://discord.com/developers/docs/topics/gateway#connections */
|
10
|
-
disconnect() {
|
11
|
-
this.forEach((shard) => shard.disconnect());
|
12
|
-
}
|
13
|
-
/** https://discord.com/developers/docs/topics/gateway-events#update-presence */
|
14
|
-
updatePresence(options) {
|
15
|
-
this.forEach((shard) => shard.updatePresence(options));
|
16
|
-
}
|
17
|
-
}
|
18
|
-
exports.ShardManager = ShardManager;
|