@impulsedev/chameleon 3.6.0 → 3.7.1
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,3 +1,85 @@
|
|
|
1
|
+
// src/types/message/index.ts
|
|
2
|
+
var MessageType = {
|
|
3
|
+
DEFAULT: 0,
|
|
4
|
+
RECIPIENT_ADD: 1,
|
|
5
|
+
RECIPIENT_REMOVE: 2,
|
|
6
|
+
CALL: 3,
|
|
7
|
+
CHANNEL_NAME_CHANGE: 4,
|
|
8
|
+
CHANNEL_ICON_CHANGE: 5,
|
|
9
|
+
CHANNEL_PINNED_MESSAGE: 6,
|
|
10
|
+
USER_JOIN: 7,
|
|
11
|
+
GUILD_BOOST: 8,
|
|
12
|
+
GUILD_BOOST_TIER_1: 9,
|
|
13
|
+
GUILD_BOOST_TIER_2: 10,
|
|
14
|
+
GUILD_BOOST_TIER_3: 11,
|
|
15
|
+
CHANNEL_FOLLOW_ADD: 12,
|
|
16
|
+
GUILD_DISCOVERY_DISQUALIFIED: 14,
|
|
17
|
+
GUILD_DISCOVERY_REQUALIFIED: 15,
|
|
18
|
+
GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING: 16,
|
|
19
|
+
GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING: 17,
|
|
20
|
+
THREAD_CREATED: 18,
|
|
21
|
+
REPLY: 19,
|
|
22
|
+
CHAT_INPUT_COMMAND: 20,
|
|
23
|
+
THREAD_STARTER_MESSAGE: 21,
|
|
24
|
+
GUILD_INVITE_REMINDER: 22,
|
|
25
|
+
CONTEXT_MENU_COMMAND: 23,
|
|
26
|
+
AUTO_MODERATION_ACTION: 24,
|
|
27
|
+
ROLE_SUBSCRIPTION_PURCHASE: 25,
|
|
28
|
+
INTERACTION_PREMIUM_UPSELL: 26,
|
|
29
|
+
STAGE_START: 27,
|
|
30
|
+
STAGE_END: 28,
|
|
31
|
+
STAGE_SPEAKER: 29,
|
|
32
|
+
STAGE_TOPIC: 31,
|
|
33
|
+
GUILD_APPLICATION_PREMIUM_SUBSCRIPTION: 32,
|
|
34
|
+
GUILD_INCIDENT_ALERT_MODE_ENABLED: 36,
|
|
35
|
+
GUILD_INCIDENT_ALERT_MODE_DISABLED: 37,
|
|
36
|
+
GUILD_INCIDENT_REPORT_RAID: 38,
|
|
37
|
+
GUILD_INCIDENT_REPORT_FALSE_ALARM: 39,
|
|
38
|
+
PURCHASE_NOTIFICATION: 44,
|
|
39
|
+
POLL_RESULT: 46
|
|
40
|
+
};
|
|
41
|
+
var MessageActivityType = {
|
|
42
|
+
JOIN: 1,
|
|
43
|
+
SPECTATE: 2,
|
|
44
|
+
LISTEN: 3,
|
|
45
|
+
JOIN_REQUEST: 5
|
|
46
|
+
};
|
|
47
|
+
var MessageFlag = {
|
|
48
|
+
CROSSPOSTED: 1 << 0,
|
|
49
|
+
IS_CROSSPOST: 1 << 1,
|
|
50
|
+
SUPPRESS_EMBEDS: 1 << 2,
|
|
51
|
+
SOURCE_MESSAGE_DELETED: 1 << 3,
|
|
52
|
+
URGENT: 1 << 4,
|
|
53
|
+
HAS_THREAD: 1 << 5,
|
|
54
|
+
EPHEMERAL: 1 << 6,
|
|
55
|
+
LOADING: 1 << 7,
|
|
56
|
+
FAILED_TO_MENTION_SOME_ROLES_IN_THREAD: 1 << 8,
|
|
57
|
+
SUPPRESS_NOTIFICATIONS: 1 << 12,
|
|
58
|
+
IS_VOICE_MESSAGE: 1 << 13,
|
|
59
|
+
HAS_SNAPSHOT: 1 << 14,
|
|
60
|
+
IS_COMPONENTS_V2: 1 << 15
|
|
61
|
+
};
|
|
62
|
+
var MessageReferenceType = {
|
|
63
|
+
DEFAULT: 0,
|
|
64
|
+
FORWARD: 1
|
|
65
|
+
};
|
|
66
|
+
var EmbedType = {
|
|
67
|
+
RICH: "rich",
|
|
68
|
+
IMAGE: "image",
|
|
69
|
+
VIDEO: "video",
|
|
70
|
+
GIFV: "gifv",
|
|
71
|
+
ARTICLE: "article",
|
|
72
|
+
LINK: "link",
|
|
73
|
+
POLL_RESULT: "poll_result"
|
|
74
|
+
};
|
|
75
|
+
var AttachmentFlag = {
|
|
76
|
+
IS_CLIP: 1 << 0,
|
|
77
|
+
IS_THUMBNAIL: 1 << 1,
|
|
78
|
+
IS_REMIX: 1 << 2,
|
|
79
|
+
IS_SPOILER: 1 << 3,
|
|
80
|
+
IS_ANIMATED: 1 << 5
|
|
81
|
+
};
|
|
82
|
+
|
|
1
83
|
// src/builders/embed.ts
|
|
2
84
|
var Colors = {
|
|
3
85
|
Blue: 2003199,
|
|
@@ -850,6 +932,40 @@ function buildMessage(raw, cache, oldMessage) {
|
|
|
850
932
|
const msgId = raw.id ?? oldMessage?.id;
|
|
851
933
|
const channelId = raw.channel_id ?? oldMessage?.channelId;
|
|
852
934
|
const guildId = raw.guild_id ? raw.guild_id : oldMessage?.guildId;
|
|
935
|
+
const stickerItems = raw.sticker_items ?? oldMessage?.stickerItems;
|
|
936
|
+
const stickers = raw.stickers ?? oldMessage?.stickers;
|
|
937
|
+
const poll = raw.poll ?? oldMessage?.poll;
|
|
938
|
+
const components = raw.components ?? oldMessage?.components;
|
|
939
|
+
const webhookId = raw.webhook_id ?? oldMessage?.webhookId;
|
|
940
|
+
const flags = raw.flags ?? oldMessage?.flags;
|
|
941
|
+
const messageReference = raw.message_reference ?? oldMessage?.messageReference;
|
|
942
|
+
const referencedMessage = raw.referenced_message ?? oldMessage?.referencedMessage;
|
|
943
|
+
const interactionMetadata = raw.interaction_metadata ?? oldMessage?.interactionMetadata;
|
|
944
|
+
const interaction = raw.interaction ?? oldMessage?.interaction;
|
|
945
|
+
const thread = raw.thread ?? oldMessage?.thread;
|
|
946
|
+
const call = raw.call ?? oldMessage?.call;
|
|
947
|
+
const messageSnapshots = raw.message_snapshots ?? oldMessage?.messageSnapshots;
|
|
948
|
+
const type = raw.type ?? oldMessage?.type ?? 0;
|
|
949
|
+
const attachments = raw.attachments ?? oldMessage?.attachments ?? [];
|
|
950
|
+
const embeds = raw.embeds ?? oldMessage?.embeds ?? [];
|
|
951
|
+
const mentionEveryone = raw.mention_everyone ?? oldMessage?.mentionEveryone ?? false;
|
|
952
|
+
const tts = raw.tts ?? oldMessage?.tts ?? false;
|
|
953
|
+
const pinned = raw.pinned ?? oldMessage?.pinned ?? false;
|
|
954
|
+
const editedTimestamp = raw.edited_timestamp ? Date.parse(raw.edited_timestamp) : oldMessage?.editedTimestamp ?? null;
|
|
955
|
+
const hasReply = Boolean(messageReference || referencedMessage || type === MessageType.REPLY);
|
|
956
|
+
const hasForward = Boolean(
|
|
957
|
+
(messageReference?.type ?? 0) === MessageReferenceType.FORWARD || (raw.message_snapshots ?? oldMessage?.messageSnapshots ?? []).length > 0 || (flags ?? 0) & MessageFlag.HAS_SNAPSHOT
|
|
958
|
+
);
|
|
959
|
+
const hasVoiceMessage = Boolean((flags ?? 0) & MessageFlag.IS_VOICE_MESSAGE);
|
|
960
|
+
const hasStickers = (stickerItems ?? stickers ?? []).length > 0;
|
|
961
|
+
const systemPresence = {
|
|
962
|
+
any: type !== MessageType.DEFAULT && type !== MessageType.REPLY,
|
|
963
|
+
booster: type === MessageType.GUILD_BOOST || type === MessageType.GUILD_BOOST_TIER_1 || type === MessageType.GUILD_BOOST_TIER_2 || type === MessageType.GUILD_BOOST_TIER_3,
|
|
964
|
+
call: type === MessageType.CALL,
|
|
965
|
+
pinned: type === MessageType.CHANNEL_PINNED_MESSAGE,
|
|
966
|
+
thread: type === MessageType.THREAD_STARTER_MESSAGE,
|
|
967
|
+
welcome: type === MessageType.USER_JOIN
|
|
968
|
+
};
|
|
853
969
|
const msg = {
|
|
854
970
|
id: msgId,
|
|
855
971
|
channelId,
|
|
@@ -858,15 +974,47 @@ function buildMessage(raw, cache, oldMessage) {
|
|
|
858
974
|
url: `https://discord.com/channels/${guildId ?? "@me"}/${channelId}/${msgId}`,
|
|
859
975
|
content: raw.content ?? oldMessage?.content ?? "",
|
|
860
976
|
timestamp: raw.timestamp ? Date.parse(raw.timestamp) : oldMessage?.timestamp ?? Date.now(),
|
|
861
|
-
editedTimestamp
|
|
862
|
-
tts
|
|
863
|
-
mentionEveryone
|
|
977
|
+
editedTimestamp,
|
|
978
|
+
tts,
|
|
979
|
+
mentionEveryone,
|
|
864
980
|
mentions: raw.mentions ? raw.mentions.map((m) => buildUser(m)) : oldMessage?.mentions ?? [],
|
|
865
981
|
mentionRoles: raw.mention_roles ?? oldMessage?.mentionRoles ?? [],
|
|
866
|
-
attachments
|
|
867
|
-
embeds
|
|
868
|
-
pinned
|
|
869
|
-
type
|
|
982
|
+
attachments,
|
|
983
|
+
embeds,
|
|
984
|
+
pinned,
|
|
985
|
+
type,
|
|
986
|
+
...webhookId ? { webhookId } : {},
|
|
987
|
+
...flags !== void 0 ? { flags } : {},
|
|
988
|
+
...messageReference ? { messageReference } : {},
|
|
989
|
+
...messageSnapshots ? { messageSnapshots } : {},
|
|
990
|
+
...referencedMessage !== void 0 ? { referencedMessage } : {},
|
|
991
|
+
...interactionMetadata ? { interactionMetadata } : {},
|
|
992
|
+
...interaction ? { interaction } : {},
|
|
993
|
+
...thread ? { thread } : {},
|
|
994
|
+
...components ? { components } : {},
|
|
995
|
+
...stickerItems ? { stickerItems } : {},
|
|
996
|
+
...stickers ? { stickers } : {},
|
|
997
|
+
...poll ? { poll } : {},
|
|
998
|
+
...call ? { call } : {},
|
|
999
|
+
has: {
|
|
1000
|
+
attachments: attachments.length > 0 && !hasVoiceMessage,
|
|
1001
|
+
components: (components ?? []).length > 0,
|
|
1002
|
+
edited: editedTimestamp !== null,
|
|
1003
|
+
embeds: embeds.length > 0,
|
|
1004
|
+
forwarded: hasForward,
|
|
1005
|
+
interaction: Boolean(interactionMetadata || interaction),
|
|
1006
|
+
mentionHere: mentionEveryone && (raw.content ?? oldMessage?.content ?? "").includes("@here"),
|
|
1007
|
+
mentionEveryone,
|
|
1008
|
+
pinned,
|
|
1009
|
+
poll: Boolean(poll),
|
|
1010
|
+
reply: hasReply,
|
|
1011
|
+
stickers: hasStickers,
|
|
1012
|
+
system: systemPresence,
|
|
1013
|
+
thread: Boolean(thread),
|
|
1014
|
+
tts,
|
|
1015
|
+
voiceMessage: hasVoiceMessage,
|
|
1016
|
+
webhook: Boolean(webhookId)
|
|
1017
|
+
}
|
|
870
1018
|
};
|
|
871
1019
|
return msg;
|
|
872
1020
|
}
|
|
@@ -886,6 +1034,12 @@ function resolveRole(roleId, client, guildId) {
|
|
|
886
1034
|
}
|
|
887
1035
|
|
|
888
1036
|
export {
|
|
1037
|
+
MessageType,
|
|
1038
|
+
MessageActivityType,
|
|
1039
|
+
MessageFlag,
|
|
1040
|
+
MessageReferenceType,
|
|
1041
|
+
EmbedType,
|
|
1042
|
+
AttachmentFlag,
|
|
889
1043
|
ComponentType,
|
|
890
1044
|
ButtonStyle,
|
|
891
1045
|
Colors,
|
package/dist/index.d.ts
CHANGED
|
@@ -935,6 +935,33 @@ interface PollCreateRequest {
|
|
|
935
935
|
interface MessageSnapshot {
|
|
936
936
|
message: Partial<Message>;
|
|
937
937
|
}
|
|
938
|
+
interface MessageSystemPresence {
|
|
939
|
+
any: boolean;
|
|
940
|
+
booster: boolean;
|
|
941
|
+
call: boolean;
|
|
942
|
+
pinned: boolean;
|
|
943
|
+
thread: boolean;
|
|
944
|
+
welcome: boolean;
|
|
945
|
+
}
|
|
946
|
+
interface MessagePresence {
|
|
947
|
+
attachments: boolean;
|
|
948
|
+
components: boolean;
|
|
949
|
+
edited: boolean;
|
|
950
|
+
embeds: boolean;
|
|
951
|
+
forwarded: boolean;
|
|
952
|
+
interaction: boolean;
|
|
953
|
+
mentionHere: boolean;
|
|
954
|
+
mentionEveryone: boolean;
|
|
955
|
+
pinned: boolean;
|
|
956
|
+
poll: boolean;
|
|
957
|
+
reply: boolean;
|
|
958
|
+
stickers: boolean;
|
|
959
|
+
system: MessageSystemPresence;
|
|
960
|
+
thread: boolean;
|
|
961
|
+
tts: boolean;
|
|
962
|
+
voiceMessage: boolean;
|
|
963
|
+
webhook: boolean;
|
|
964
|
+
}
|
|
938
965
|
interface Message {
|
|
939
966
|
id: string;
|
|
940
967
|
channelId: string;
|
|
@@ -976,6 +1003,7 @@ interface Message {
|
|
|
976
1003
|
poll?: Poll;
|
|
977
1004
|
call?: MessageCall;
|
|
978
1005
|
sharedClientTheme?: SharedClientTheme;
|
|
1006
|
+
has: MessagePresence;
|
|
979
1007
|
}
|
|
980
1008
|
type MessageCreateOptions = string | {
|
|
981
1009
|
content?: string;
|
|
@@ -2223,6 +2251,7 @@ type InteractionReplyOptions = string | {
|
|
|
2223
2251
|
toJSON(): Record<string, unknown>;
|
|
2224
2252
|
} | Record<string, unknown>)[];
|
|
2225
2253
|
ephemeral?: boolean;
|
|
2254
|
+
flags?: number;
|
|
2226
2255
|
};
|
|
2227
2256
|
declare class BaseInteractionContext {
|
|
2228
2257
|
user: User;
|
|
@@ -3646,9 +3675,12 @@ declare function combinePermissions(...flags: bigint[]): bigint;
|
|
|
3646
3675
|
declare function listPermissions(permissions: string | bigint): string[];
|
|
3647
3676
|
|
|
3648
3677
|
declare class Chameleon {
|
|
3678
|
+
private static lastCpuUsage;
|
|
3679
|
+
private static lastCheck;
|
|
3649
3680
|
static get lifespan(): {
|
|
3650
|
-
|
|
3651
|
-
|
|
3681
|
+
ram: number;
|
|
3682
|
+
uptime: number;
|
|
3683
|
+
cpu: number;
|
|
3652
3684
|
};
|
|
3653
3685
|
}
|
|
3654
3686
|
|
|
@@ -3710,4 +3742,4 @@ declare class CShard extends EventEmitter {
|
|
|
3710
3742
|
broadcast(message: unknown): Promise<void[]>;
|
|
3711
3743
|
}
|
|
3712
3744
|
|
|
3713
|
-
export { AUDIT_LOG_EVENT_TYPES, ActionRow, ActionRowBuilder, Activity, type ActivityInstance, type ActivityLocation, ActivityLocationKind, type AnyCommandDef, type AnyCommandInput, type Application, type ApplicationCommand, type ApplicationCommandOption, type ApplicationCommandOptionChoice, ApplicationCommandOptionType, ApplicationCommandType, ApplicationEventWebhookStatus, ApplicationFlag, ApplicationIntegrationType, type ApplicationIntegrationTypeConfiguration, ApplicationManager, type ApplicationRoleConnection, type ApplicationRoleConnectionMetadata, ApplicationRoleConnectionMetadataType, type Attachment, AttachmentBuilder, type AttachmentData, AttachmentFlag, type AuditLog, type AuditLogChange, type AuditLogEntry, type AutoModerationAction, type AutoModerationActionMetadata, AutoModerationActionType, AutoModerationEventType, AutoModerationKeywordPresetType, AutoModerationManager, type AutoModerationRule, type AutoModerationTriggerMetadata, AutoModerationTriggerType, type AvatarDecorationData, type AwaitComponentOptions, type AwaitMessagesOptions, BaseInteractionContext, BaseManager, BitField, type BitFieldResolvable, Button, ButtonBuilder, type ButtonDef, ButtonStyle, type ButtonStyleString, CHAMELEON_SELF_MAP, CShard, Chameleon, type ChameleonAPIResult, type ChameleonEvent, type ChameleonEventHandler, ChameleonGateway, type ChameleonGatewayOptions, ChameleonREST, type ChameleonRESTOptions, type ChameleonSelfKey, type Channel, ChannelFlag, ChannelManager, type ChannelMention, type ChannelSelectDef, ChannelType, type ChoiceDef, type ChoiceValue, Client, type ClientOptions, type Collectibles, Collection, CollectorManager, Colors, CommandContext, type CommandDef, CommandDefinitionBuilder, CommandManager, ComponentContext, type ComponentHandler, ComponentManager, ComponentType, type Connection, Container, DISCORD_GATEWAY_OPCODES, DISCORD_PERMISSIONS, DefaultMessageNotificationLevel, type DefaultReaction, type Embed, type EmbedAuthor, EmbedBuilder, type EmbedField, type EmbedFooter, type EmbedImage, type EmbedProvider, EmbedType, type EmbedVideo, type Emoji, type Entitlement, EntitlementManager, EntitlementType, type EventMap, type ExecuteFunction, ExplicitContentFilterLevel, ForumLayoutType, type ForumTag, type GatewayPayload, type GatewayStatus, type Guild, GuildInviteFlag, GuildManager, GuildMemberFlag, GuildNSFWLevel, type GuildScheduledEvent, type GuildScheduledEventEntityMetadata, GuildScheduledEventEntityType, GuildScheduledEventPrivacyLevel, GuildScheduledEventStatus, type GuildScheduledEventUser, type GuildTemplate, type HttpMethod, type IncidentsData, type InstallParams, type Integration, type IntegrationAccount, IntegrationExpireBehavior, IntentBits, type IntentResolvable, type IntentString, Intents, IntentsBitField, type InteractionReplyOptions, type Invite, InviteManager, type InviteMetadata, type InviteStageInstance, InviteTargetType, InviteType, Label, type Lobby, type LobbyMember, LobbyMemberFlag, MFALevel, type Member, MemberManager, type MentionableSelectDef, type Message, type MessageActivity, MessageActivityType, type MessageCall, type MessageComponent, type MessageCreateOptions, MessageFlag, type MessageInteractionMetadata, MessageManager, type MessageReference, MessageReferenceType, type MessageSnapshot, MessageType, type MiddlewareFn, ModalBuilder, ModalContext, type ModalDef, ModalDefinitionBuilder, type ModalFieldDef, type ModalFieldType, type ModalHandler, type Nameplate, type OptionDef, type OptionType, type OptionalAuditEntryInfo, type Overwrite, type PartialChannel, type PartialGuild, type PermissionFlag, PermissionsBitField, type Poll, type PollAnswer, type PollAnswerCount, type PollCreateRequest, type PollMedia, type PollResults, PremiumTier, PremiumType, type Reaction, type ReactionCountDetails, type ResolveModalFieldType, type ResolveModalFields, type ResolveOption, type ResolveOptionType, type ResolveOptions, type Role, RoleManager, type RoleSelectDef, type RoleSubscriptionData, type RoleTags, ScheduledEventManager, Section, SelectMenuBuilder, type SelectOption, Separator, Shard, type ShardOptions, type SharedClientTheme, type Sku, SkuFlag, SkuType, SortOrderType, type SoundboardCreateOptions, type SoundboardEditOptions, SoundboardManager, type SoundboardSound, type StageInstance, StageInstanceManager, StagePrivacyLevel, type Sticker, StickerFormatType, type StickerItem, type StickerPack, StickerType, type StoreOptions, type StringSelectDef, type Subcommand, SubcommandDefinitionBuilder, type SubcommandGroup, SubcommandGroupDefinitionBuilder, type Subscription, SubscriptionStatus, SystemChannelFlag, type Team, type TeamMember, TemplateManager, TextDisplay, TextInputBuilder, type ThreadMember, type ThreadMetadata, Thumbnail, Tongue, TongueStore, type User, UserFlag, UserFlagsBitField, UserManager, type UserPrimaryGuild, type UserSelectDef, VerificationLevel, VideoQualityMode, VisibilityType, type Voice, type Webhook, WebhookManager, type WebhookMessageCreateOptions, WebhookType, type WelcomeScreen, type WelcomeScreenChannel, buildAutoModRule, buildChannel, buildEmoji, buildEntitlement, buildGuild, buildIntegration, buildInteraction, buildInvite, buildMember, buildMessage, buildRole, buildScheduledEvent, buildStageInstance, buildSticker, buildStickerItem, buildUser, buildVoiceState, buildWebhook, choice, choices, combinePermissions, command, computeBasePermissions, computeChannelPermissions, defineButton, defineChannelSelect, defineCommand, defineMentionableSelect, defineModal, defineRoleSelect, defineStringSelect, defineSubcommand, defineSubcommandGroup, defineUserSelect, field, hasAllPermissions, hasAnyPermission, hasPermission, listPermissions, modal, opt, resolveButtonStyle, resolveChannel, resolveGuild, resolveRole, resolveUser, serializeComponent, subcommand, subcommandGroup };
|
|
3745
|
+
export { AUDIT_LOG_EVENT_TYPES, ActionRow, ActionRowBuilder, Activity, type ActivityInstance, type ActivityLocation, ActivityLocationKind, type AnyCommandDef, type AnyCommandInput, type Application, type ApplicationCommand, type ApplicationCommandOption, type ApplicationCommandOptionChoice, ApplicationCommandOptionType, ApplicationCommandType, ApplicationEventWebhookStatus, ApplicationFlag, ApplicationIntegrationType, type ApplicationIntegrationTypeConfiguration, ApplicationManager, type ApplicationRoleConnection, type ApplicationRoleConnectionMetadata, ApplicationRoleConnectionMetadataType, type Attachment, AttachmentBuilder, type AttachmentData, AttachmentFlag, type AuditLog, type AuditLogChange, type AuditLogEntry, type AutoModerationAction, type AutoModerationActionMetadata, AutoModerationActionType, AutoModerationEventType, AutoModerationKeywordPresetType, AutoModerationManager, type AutoModerationRule, type AutoModerationTriggerMetadata, AutoModerationTriggerType, type AvatarDecorationData, type AwaitComponentOptions, type AwaitMessagesOptions, BaseInteractionContext, BaseManager, BitField, type BitFieldResolvable, Button, ButtonBuilder, type ButtonDef, ButtonStyle, type ButtonStyleString, CHAMELEON_SELF_MAP, CShard, Chameleon, type ChameleonAPIResult, type ChameleonEvent, type ChameleonEventHandler, ChameleonGateway, type ChameleonGatewayOptions, ChameleonREST, type ChameleonRESTOptions, type ChameleonSelfKey, type Channel, ChannelFlag, ChannelManager, type ChannelMention, type ChannelSelectDef, ChannelType, type ChoiceDef, type ChoiceValue, Client, type ClientOptions, type Collectibles, Collection, CollectorManager, Colors, CommandContext, type CommandDef, CommandDefinitionBuilder, CommandManager, ComponentContext, type ComponentHandler, ComponentManager, ComponentType, type Connection, Container, DISCORD_GATEWAY_OPCODES, DISCORD_PERMISSIONS, DefaultMessageNotificationLevel, type DefaultReaction, type Embed, type EmbedAuthor, EmbedBuilder, type EmbedField, type EmbedFooter, type EmbedImage, type EmbedProvider, EmbedType, type EmbedVideo, type Emoji, type Entitlement, EntitlementManager, EntitlementType, type EventMap, type ExecuteFunction, ExplicitContentFilterLevel, ForumLayoutType, type ForumTag, type GatewayPayload, type GatewayStatus, type Guild, GuildInviteFlag, GuildManager, GuildMemberFlag, GuildNSFWLevel, type GuildScheduledEvent, type GuildScheduledEventEntityMetadata, GuildScheduledEventEntityType, GuildScheduledEventPrivacyLevel, GuildScheduledEventStatus, type GuildScheduledEventUser, type GuildTemplate, type HttpMethod, type IncidentsData, type InstallParams, type Integration, type IntegrationAccount, IntegrationExpireBehavior, IntentBits, type IntentResolvable, type IntentString, Intents, IntentsBitField, type InteractionReplyOptions, type Invite, InviteManager, type InviteMetadata, type InviteStageInstance, InviteTargetType, InviteType, Label, type Lobby, type LobbyMember, LobbyMemberFlag, MFALevel, type Member, MemberManager, type MentionableSelectDef, type Message, type MessageActivity, MessageActivityType, type MessageCall, type MessageComponent, type MessageCreateOptions, MessageFlag, type MessageInteractionMetadata, MessageManager, type MessagePresence, type MessageReference, MessageReferenceType, type MessageSnapshot, type MessageSystemPresence, MessageType, type MiddlewareFn, ModalBuilder, ModalContext, type ModalDef, ModalDefinitionBuilder, type ModalFieldDef, type ModalFieldType, type ModalHandler, type Nameplate, type OptionDef, type OptionType, type OptionalAuditEntryInfo, type Overwrite, type PartialChannel, type PartialGuild, type PermissionFlag, PermissionsBitField, type Poll, type PollAnswer, type PollAnswerCount, type PollCreateRequest, type PollMedia, type PollResults, PremiumTier, PremiumType, type Reaction, type ReactionCountDetails, type ResolveModalFieldType, type ResolveModalFields, type ResolveOption, type ResolveOptionType, type ResolveOptions, type Role, RoleManager, type RoleSelectDef, type RoleSubscriptionData, type RoleTags, ScheduledEventManager, Section, SelectMenuBuilder, type SelectOption, Separator, Shard, type ShardOptions, type SharedClientTheme, type Sku, SkuFlag, SkuType, SortOrderType, type SoundboardCreateOptions, type SoundboardEditOptions, SoundboardManager, type SoundboardSound, type StageInstance, StageInstanceManager, StagePrivacyLevel, type Sticker, StickerFormatType, type StickerItem, type StickerPack, StickerType, type StoreOptions, type StringSelectDef, type Subcommand, SubcommandDefinitionBuilder, type SubcommandGroup, SubcommandGroupDefinitionBuilder, type Subscription, SubscriptionStatus, SystemChannelFlag, type Team, type TeamMember, TemplateManager, TextDisplay, TextInputBuilder, type ThreadMember, type ThreadMetadata, Thumbnail, Tongue, TongueStore, type User, UserFlag, UserFlagsBitField, UserManager, type UserPrimaryGuild, type UserSelectDef, VerificationLevel, VideoQualityMode, VisibilityType, type Voice, type Webhook, WebhookManager, type WebhookMessageCreateOptions, WebhookType, type WelcomeScreen, type WelcomeScreenChannel, buildAutoModRule, buildChannel, buildEmoji, buildEntitlement, buildGuild, buildIntegration, buildInteraction, buildInvite, buildMember, buildMessage, buildRole, buildScheduledEvent, buildStageInstance, buildSticker, buildStickerItem, buildUser, buildVoiceState, buildWebhook, choice, choices, combinePermissions, command, computeBasePermissions, computeChannelPermissions, defineButton, defineChannelSelect, defineCommand, defineMentionableSelect, defineModal, defineRoleSelect, defineStringSelect, defineSubcommand, defineSubcommandGroup, defineUserSelect, field, hasAllPermissions, hasAnyPermission, hasPermission, listPermissions, modal, opt, resolveButtonStyle, resolveChannel, resolveGuild, resolveRole, resolveUser, serializeComponent, subcommand, subcommandGroup };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActionRowBuilder,
|
|
3
|
+
AttachmentFlag,
|
|
3
4
|
ButtonBuilder,
|
|
4
5
|
ButtonStyle,
|
|
5
6
|
Colors,
|
|
6
7
|
ComponentType,
|
|
7
8
|
EmbedBuilder,
|
|
9
|
+
EmbedType,
|
|
10
|
+
MessageActivityType,
|
|
11
|
+
MessageFlag,
|
|
12
|
+
MessageReferenceType,
|
|
13
|
+
MessageType,
|
|
8
14
|
ModalBuilder,
|
|
9
15
|
SelectMenuBuilder,
|
|
10
16
|
TextInputBuilder,
|
|
@@ -33,7 +39,7 @@ import {
|
|
|
33
39
|
serializeComponent,
|
|
34
40
|
toCamelCase,
|
|
35
41
|
toSnakeCase
|
|
36
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-CGH3AKKX.js";
|
|
37
43
|
|
|
38
44
|
// src/types/user/index.ts
|
|
39
45
|
var UserFlag = {
|
|
@@ -153,88 +159,6 @@ var ForumLayoutType = {
|
|
|
153
159
|
GALLERY_VIEW: 2
|
|
154
160
|
};
|
|
155
161
|
|
|
156
|
-
// src/types/message/index.ts
|
|
157
|
-
var MessageType = {
|
|
158
|
-
DEFAULT: 0,
|
|
159
|
-
RECIPIENT_ADD: 1,
|
|
160
|
-
RECIPIENT_REMOVE: 2,
|
|
161
|
-
CALL: 3,
|
|
162
|
-
CHANNEL_NAME_CHANGE: 4,
|
|
163
|
-
CHANNEL_ICON_CHANGE: 5,
|
|
164
|
-
CHANNEL_PINNED_MESSAGE: 6,
|
|
165
|
-
USER_JOIN: 7,
|
|
166
|
-
GUILD_BOOST: 8,
|
|
167
|
-
GUILD_BOOST_TIER_1: 9,
|
|
168
|
-
GUILD_BOOST_TIER_2: 10,
|
|
169
|
-
GUILD_BOOST_TIER_3: 11,
|
|
170
|
-
CHANNEL_FOLLOW_ADD: 12,
|
|
171
|
-
GUILD_DISCOVERY_DISQUALIFIED: 14,
|
|
172
|
-
GUILD_DISCOVERY_REQUALIFIED: 15,
|
|
173
|
-
GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING: 16,
|
|
174
|
-
GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING: 17,
|
|
175
|
-
THREAD_CREATED: 18,
|
|
176
|
-
REPLY: 19,
|
|
177
|
-
CHAT_INPUT_COMMAND: 20,
|
|
178
|
-
THREAD_STARTER_MESSAGE: 21,
|
|
179
|
-
GUILD_INVITE_REMINDER: 22,
|
|
180
|
-
CONTEXT_MENU_COMMAND: 23,
|
|
181
|
-
AUTO_MODERATION_ACTION: 24,
|
|
182
|
-
ROLE_SUBSCRIPTION_PURCHASE: 25,
|
|
183
|
-
INTERACTION_PREMIUM_UPSELL: 26,
|
|
184
|
-
STAGE_START: 27,
|
|
185
|
-
STAGE_END: 28,
|
|
186
|
-
STAGE_SPEAKER: 29,
|
|
187
|
-
STAGE_TOPIC: 31,
|
|
188
|
-
GUILD_APPLICATION_PREMIUM_SUBSCRIPTION: 32,
|
|
189
|
-
GUILD_INCIDENT_ALERT_MODE_ENABLED: 36,
|
|
190
|
-
GUILD_INCIDENT_ALERT_MODE_DISABLED: 37,
|
|
191
|
-
GUILD_INCIDENT_REPORT_RAID: 38,
|
|
192
|
-
GUILD_INCIDENT_REPORT_FALSE_ALARM: 39,
|
|
193
|
-
PURCHASE_NOTIFICATION: 44,
|
|
194
|
-
POLL_RESULT: 46
|
|
195
|
-
};
|
|
196
|
-
var MessageActivityType = {
|
|
197
|
-
JOIN: 1,
|
|
198
|
-
SPECTATE: 2,
|
|
199
|
-
LISTEN: 3,
|
|
200
|
-
JOIN_REQUEST: 5
|
|
201
|
-
};
|
|
202
|
-
var MessageFlag = {
|
|
203
|
-
CROSSPOSTED: 1 << 0,
|
|
204
|
-
IS_CROSSPOST: 1 << 1,
|
|
205
|
-
SUPPRESS_EMBEDS: 1 << 2,
|
|
206
|
-
SOURCE_MESSAGE_DELETED: 1 << 3,
|
|
207
|
-
URGENT: 1 << 4,
|
|
208
|
-
HAS_THREAD: 1 << 5,
|
|
209
|
-
EPHEMERAL: 1 << 6,
|
|
210
|
-
LOADING: 1 << 7,
|
|
211
|
-
FAILED_TO_MENTION_SOME_ROLES_IN_THREAD: 1 << 8,
|
|
212
|
-
SUPPRESS_NOTIFICATIONS: 1 << 12,
|
|
213
|
-
IS_VOICE_MESSAGE: 1 << 13,
|
|
214
|
-
HAS_SNAPSHOT: 1 << 14,
|
|
215
|
-
IS_COMPONENTS_V2: 1 << 15
|
|
216
|
-
};
|
|
217
|
-
var MessageReferenceType = {
|
|
218
|
-
DEFAULT: 0,
|
|
219
|
-
FORWARD: 1
|
|
220
|
-
};
|
|
221
|
-
var EmbedType = {
|
|
222
|
-
RICH: "rich",
|
|
223
|
-
IMAGE: "image",
|
|
224
|
-
VIDEO: "video",
|
|
225
|
-
GIFV: "gifv",
|
|
226
|
-
ARTICLE: "article",
|
|
227
|
-
LINK: "link",
|
|
228
|
-
POLL_RESULT: "poll_result"
|
|
229
|
-
};
|
|
230
|
-
var AttachmentFlag = {
|
|
231
|
-
IS_CLIP: 1 << 0,
|
|
232
|
-
IS_THUMBNAIL: 1 << 1,
|
|
233
|
-
IS_REMIX: 1 << 2,
|
|
234
|
-
IS_SPOILER: 1 << 3,
|
|
235
|
-
IS_ANIMATED: 1 << 5
|
|
236
|
-
};
|
|
237
|
-
|
|
238
162
|
// src/types/application/index.ts
|
|
239
163
|
var ApplicationFlag = {
|
|
240
164
|
APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE: 1 << 6,
|
|
@@ -1342,7 +1266,7 @@ var ChameleonGateway = class {
|
|
|
1342
1266
|
// package.json
|
|
1343
1267
|
var package_default = {
|
|
1344
1268
|
name: "@impulsedev/chameleon",
|
|
1345
|
-
version: "3.
|
|
1269
|
+
version: "3.7.0",
|
|
1346
1270
|
description: "highly optimized, memory-efficient, and fully type-safe Discord API library",
|
|
1347
1271
|
main: "dist/index.js",
|
|
1348
1272
|
types: "dist/index.d.ts",
|
|
@@ -1806,7 +1730,9 @@ var BaseInteractionContext = class {
|
|
|
1806
1730
|
_resolvePayload(payload) {
|
|
1807
1731
|
const data = typeof payload === "string" ? { content: payload } : { ...payload };
|
|
1808
1732
|
if (typeof payload === "object") {
|
|
1809
|
-
if (payload.
|
|
1733
|
+
if (payload.flags !== void 0 || payload.ephemeral) {
|
|
1734
|
+
data.flags = (payload.flags ?? 0) | (payload.ephemeral ? MESSAGE_FLAGS.EPHEMERAL : 0);
|
|
1735
|
+
}
|
|
1810
1736
|
if (payload.embeds) {
|
|
1811
1737
|
data.embeds = payload.embeds.map((e) => {
|
|
1812
1738
|
if (e && typeof e.toJSON === "function") {
|
|
@@ -2899,7 +2825,7 @@ var UserManager = class extends BaseManager {
|
|
|
2899
2825
|
async createDM(userId) {
|
|
2900
2826
|
const result = await this.rest.post("/users/@me/channels", { recipient_id: userId });
|
|
2901
2827
|
if (!result.ok) return result;
|
|
2902
|
-
return { ok: true, data: (await import("./builders-
|
|
2828
|
+
return { ok: true, data: (await import("./builders-S6W5F64D.js")).buildChannel(result.data) };
|
|
2903
2829
|
}
|
|
2904
2830
|
async editCurrent(payload) {
|
|
2905
2831
|
const result = await this.rest.patch("/users/@me", toSnakeCase(payload));
|
|
@@ -5241,16 +5167,21 @@ function listPermissions(permissions) {
|
|
|
5241
5167
|
}
|
|
5242
5168
|
|
|
5243
5169
|
// src/utils/chameleon.ts
|
|
5244
|
-
import os from "os";
|
|
5245
5170
|
var Chameleon = class {
|
|
5171
|
+
static lastCpuUsage = process.cpuUsage();
|
|
5172
|
+
static lastCheck = process.hrtime.bigint();
|
|
5246
5173
|
static get lifespan() {
|
|
5174
|
+
const mem = process.memoryUsage();
|
|
5175
|
+
const now = process.hrtime.bigint();
|
|
5176
|
+
const usage = process.cpuUsage(this.lastCpuUsage);
|
|
5177
|
+
const elapsedUs = Number(now - this.lastCheck) / 1e3;
|
|
5178
|
+
const cpuPercent = (usage.user + usage.system) / elapsedUs * 100;
|
|
5179
|
+
this.lastCpuUsage = process.cpuUsage();
|
|
5180
|
+
this.lastCheck = now;
|
|
5247
5181
|
return {
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
get cpu() {
|
|
5252
|
-
return os.loadavg()[0];
|
|
5253
|
-
}
|
|
5182
|
+
ram: Math.round(mem.rss / 1024 / 1024),
|
|
5183
|
+
uptime: Math.round(process.uptime() * 1e3),
|
|
5184
|
+
cpu: Math.round(cpuPercent * 100) / 100
|
|
5254
5185
|
};
|
|
5255
5186
|
}
|
|
5256
5187
|
};
|