type interconnection (#610)
* fix: fsync asar write * ChannelStore: type and docs * unused import * revert: undo fsync asar write change * lint * fix types * type interconnection * t * revert, not gonna do this * type interconnection * fix * fix * fix * add remarks * fix * Update UserPermissions.tsx * add missing enums --------- Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com>
This commit is contained in:
parent
2b1675eda9
commit
84900008ed
47 changed files with 1497 additions and 384 deletions
|
|
@ -9,18 +9,15 @@ export const enum ActivityType {
|
|||
}
|
||||
|
||||
export const enum ActivityFlags {
|
||||
INSTANCE = 1 << 0,
|
||||
JOIN = 1 << 1,
|
||||
/** @deprecated */
|
||||
SPECTATE = 1 << 2,
|
||||
/** @deprecated */
|
||||
JOIN_REQUEST = 1 << 3,
|
||||
SYNC = 1 << 4,
|
||||
PLAY = 1 << 5,
|
||||
PARTY_PRIVACY_FRIENDS = 1 << 6,
|
||||
PARTY_PRIVACY_VOICE_CHANNEL = 1 << 7,
|
||||
EMBEDDED = 1 << 8,
|
||||
CONTEXTLESS = 1 << 9
|
||||
INSTANCE = 1,
|
||||
JOIN = 2,
|
||||
SYNC = 16,
|
||||
PLAY = 32,
|
||||
PARTY_PRIVACY_FRIENDS = 64,
|
||||
PARTY_PRIVACY_VOICE_CHANNEL = 128,
|
||||
EMBEDDED = 256,
|
||||
CONTEXTLESS = 512,
|
||||
SUPPORTS_GATEWAY_ACTIVITY_ACTION_JOIN = 1024,
|
||||
}
|
||||
|
||||
export const enum ActivityStatusDisplayType {
|
||||
|
|
@ -28,3 +25,26 @@ export const enum ActivityStatusDisplayType {
|
|||
STATE = 1,
|
||||
DETAILS = 2
|
||||
}
|
||||
|
||||
export const enum OrientationLockState {
|
||||
UNLOCKED = 1,
|
||||
PORTRAIT = 2,
|
||||
LANDSCAPE = 3,
|
||||
}
|
||||
|
||||
export const enum ActivityGameMode {
|
||||
PLAY = 0,
|
||||
SPECTATE = 1,
|
||||
}
|
||||
|
||||
export const enum ActivityLayout {
|
||||
FOCUSED = 0,
|
||||
PIP = 1,
|
||||
GRID = 2,
|
||||
}
|
||||
|
||||
export const enum ActivityLabelType {
|
||||
NONE = 0,
|
||||
NEW = 1,
|
||||
UPDATED = 2,
|
||||
}
|
||||
|
|
|
|||
43
packages/discord-types/enums/application.ts
Normal file
43
packages/discord-types/enums/application.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
export const enum ApplicationType {
|
||||
DEPRECATED_GAME = 1,
|
||||
TICKETED_EVENTS = 3,
|
||||
GUILD_ROLE_SUBSCRIPTIONS = 4,
|
||||
GAME = 5,
|
||||
NON_GAME_DETECTABLE = 6,
|
||||
}
|
||||
|
||||
export const enum LinkedGameType {
|
||||
LINKED = 1,
|
||||
OFFICIAL = 2,
|
||||
NVIDIA = 3,
|
||||
}
|
||||
|
||||
export const enum CarouselItemType {
|
||||
IMG = 1,
|
||||
YOUTUBE_VIDEO = 2,
|
||||
VIDEO = 3,
|
||||
}
|
||||
|
||||
export const enum ApplicationFlags {
|
||||
EMBEDDED_RELEASED = 2,
|
||||
EMBEDDED_IAP = 8,
|
||||
APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE = 64,
|
||||
GAME_PROFILE_DISABLED = 128,
|
||||
CONTEXTLESS_ACTIVITY = 512,
|
||||
SOCIAL_LAYER_INTEGRATION_LIMITED = 1024,
|
||||
CLOUD_GAMING_DEMO = 2048,
|
||||
GATEWAY_PRESENCE = 4096,
|
||||
GATEWAY_PRESENCE_LIMITED = 8192,
|
||||
GATEWAY_GUILD_MEMBERS = 16384,
|
||||
GATEWAY_GUILD_MEMBERS_LIMITED = 32768,
|
||||
EMBEDDED = 131072,
|
||||
GATEWAY_MESSAGE_CONTENT = 262144,
|
||||
GATEWAY_MESSAGE_CONTENT_LIMITED = 524288,
|
||||
EMBEDDED_FIRST_PARTY = 1048576,
|
||||
APPLICATION_COMMAND_BADGE = 8388608,
|
||||
SOCIAL_LAYER_INTEGRATION = 134217728,
|
||||
PROMOTED = 536870912,
|
||||
PARTNER = 1073741824,
|
||||
PARENT = 8589934592,
|
||||
DISABLE_RELATIONSHIPS_ACCESS = 17179869184,
|
||||
}
|
||||
|
|
@ -1,3 +1,58 @@
|
|||
export const enum PermissionOverwriteType {
|
||||
ROLE = 0,
|
||||
MEMBER = 1,
|
||||
OWNER = 2
|
||||
}
|
||||
|
||||
export const enum PermissionOverwriteRowType {
|
||||
EMPTY_STATE = 0,
|
||||
ADMINISTRATOR = 1,
|
||||
ROLE = 2,
|
||||
OWNER = 3,
|
||||
MEMBER = 4,
|
||||
USER = 5,
|
||||
GUILD = 6,
|
||||
}
|
||||
|
||||
export const enum PermissionOverwriteSectionType {
|
||||
ROLES = 0,
|
||||
MEMBERS = 1,
|
||||
USERS = 2,
|
||||
GUILDS = 3,
|
||||
}
|
||||
|
||||
export const enum ForumLayout {
|
||||
DEFAULT = 0,
|
||||
LIST = 1,
|
||||
GRID = 2,
|
||||
}
|
||||
|
||||
export const enum SafetyWarningType {
|
||||
STRANGER_DANGER = 1,
|
||||
INAPPROPRIATE_CONVERSATION_TIER_1 = 2,
|
||||
INAPPROPRIATE_CONVERSATION_TIER_2 = 3,
|
||||
LIKELY_ATO = 4,
|
||||
}
|
||||
|
||||
export const enum ChannelFlags {
|
||||
GUILD_FEED_REMOVED = 1,
|
||||
PINNED = 2,
|
||||
ACTIVE_CHANNELS_REMOVED = 4,
|
||||
REQUIRE_TAG = 16,
|
||||
IS_SPAM = 32,
|
||||
IS_GUILD_RESOURCE_CHANNEL = 128,
|
||||
CLYDE_AI = 256,
|
||||
IS_SCHEDULED_FOR_DELETION = 512,
|
||||
IS_MEDIA_CHANNEL = 1024,
|
||||
SUMMARIES_DISABLED = 2048,
|
||||
IS_ROLE_SUBSCRIPTION_TEMPLATE_PREVIEW_CHANNEL = 8192,
|
||||
IS_BROADCASTING = 16384,
|
||||
HIDE_MEDIA_DOWNLOAD_OPTIONS = 32768,
|
||||
IS_JOIN_REQUEST_INTERVIEW_CHANNEL = 65536,
|
||||
OBFUSCATED = 131072,
|
||||
IS_MODERATOR_REPORT_CHANNEL = 524288,
|
||||
}
|
||||
|
||||
export const enum ChannelType {
|
||||
GUILD_TEXT = 0,
|
||||
DM = 1,
|
||||
|
|
@ -5,11 +60,100 @@ export const enum ChannelType {
|
|||
GROUP_DM = 3,
|
||||
GUILD_CATEGORY = 4,
|
||||
GUILD_ANNOUNCEMENT = 5,
|
||||
GUILD_STORE = 6,
|
||||
ANNOUNCEMENT_THREAD = 10,
|
||||
PUBLIC_THREAD = 11,
|
||||
PRIVATE_THREAD = 12,
|
||||
GUILD_STAGE_VOICE = 13,
|
||||
GUILD_DIRECTORY = 14,
|
||||
GUILD_FORUM = 15,
|
||||
GUILD_MEDIA = 16
|
||||
GUILD_MEDIA = 16,
|
||||
LOBBY = 17,
|
||||
DM_SDK = 18,
|
||||
UNKNOWN = 10000,
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-defined Sets of channel types for grouping related channels.
|
||||
* Each property is a Set<ChannelType> containing channel type numbers.
|
||||
*/
|
||||
export interface ChannelTypesSets {
|
||||
/** DM and GROUP_DM, channels that support calling. */
|
||||
CALLABLE: Set<ChannelType>;
|
||||
/** Channels that support text messages. */
|
||||
TEXTUAL: Set<ChannelType>;
|
||||
/** Forum and media channels, threads only, no direct messages. */
|
||||
GUILD_THREADS_ONLY: Set<ChannelType>;
|
||||
/** Channels that support stickers. */
|
||||
STICKERS: Set<ChannelType>;
|
||||
/** Channels that can be read/viewed. */
|
||||
READABLE: Set<ChannelType>;
|
||||
/** All guild channel types including threads. */
|
||||
GUILD: Set<ChannelType>;
|
||||
/** Guild channels excluding threads. */
|
||||
GUILD_CHANNEL: Set<ChannelType>;
|
||||
/** All thread types (announcement, public, private). */
|
||||
THREADS: Set<ChannelType>;
|
||||
/** DM and GROUP_DM, private/non-guild channels. */
|
||||
PRIVATE_CHANNEL: Set<ChannelType>;
|
||||
/** Announcement and public threads only. */
|
||||
PUBLIC_THREADS: Set<ChannelType>;
|
||||
/** Guild channels that can have threads. */
|
||||
GUILD_THREADED: Set<ChannelType>;
|
||||
/** Guild channels that are persisted/stored. */
|
||||
GUILD_STORED: Set<ChannelType>;
|
||||
/** Guild channels with text capability. */
|
||||
GUILD_TEXTUAL: Set<ChannelType>;
|
||||
/** Guild voice and stage channels. */
|
||||
GUILD_VOCAL: Set<ChannelType>;
|
||||
/** Thread types that support voice. */
|
||||
VOCAL_THREAD: Set<ChannelType>;
|
||||
/** All channels with voice capability. */
|
||||
VOCAL: Set<ChannelType>;
|
||||
/** Channels that support voice effects. */
|
||||
VOICE_EFFECTS: Set<ChannelType>;
|
||||
/** Guild text-only channels (no voice). */
|
||||
GUILD_TEXT_ONLY: Set<ChannelType>;
|
||||
/** Channels with character-limited names. */
|
||||
LIMITED_CHANNEL_NAME: Set<ChannelType>;
|
||||
/** Channels that support message search. */
|
||||
SEARCHABLE: Set<ChannelType>;
|
||||
/** Guild channels with user-generated content. */
|
||||
GUILD_USER_CONTENT: Set<ChannelType>;
|
||||
/** Guild channels that can have topics. */
|
||||
GUILD_TOPICAL: Set<ChannelType>;
|
||||
/** Guild channels that support webhooks. */
|
||||
GUILD_WEBHOOKS: Set<ChannelType>;
|
||||
/** Guild channels usable as system message channel. */
|
||||
GUILD_SYSTEM_CHANNEL: Set<ChannelType>;
|
||||
/** Guild channels that can have a parent category. */
|
||||
GUILD_PARENTABLE: Set<ChannelType>;
|
||||
/** Guild channels subject to auto-moderation. */
|
||||
GUILD_AUTO_MODERATED: Set<ChannelType>;
|
||||
/** Basic guild channel types for creation. */
|
||||
GUILD_BASIC: Set<ChannelType>;
|
||||
/** Guild channel types that can be created. */
|
||||
CREATEABLE_GUILD_CHANNELS: Set<ChannelType>;
|
||||
/** GROUP_DM only, multi-user DMs. */
|
||||
MULTI_USER_DMS: Set<ChannelType>;
|
||||
/** DM and GROUP_DM. */
|
||||
ALL_DMS: Set<ChannelType>;
|
||||
/** Channels that support invites. */
|
||||
INVITABLE: Set<ChannelType>;
|
||||
/** Guild channels supporting feed-featurable messages. */
|
||||
GUILD_FEED_FEATURABLE_MESSAGES: Set<ChannelType>;
|
||||
/** Channels supporting role subscriptions. */
|
||||
ROLE_SUBSCRIPTIONS: Set<ChannelType>;
|
||||
/** Channels supporting icon emojis. */
|
||||
ICON_EMOJIS: Set<ChannelType>;
|
||||
/** Channels that can be summarized. */
|
||||
SUMMARIZEABLE: Set<ChannelType>;
|
||||
/** Channels supporting content entry embeds. */
|
||||
CONTENT_ENTRY_EMBEDS: Set<ChannelType>;
|
||||
/** Channels that support polls. */
|
||||
POLLS: Set<ChannelType>;
|
||||
/** Channels that can launch activities. */
|
||||
ACTIVITY_LAUNCHABLE: Set<ChannelType>;
|
||||
/** All known channel types. */
|
||||
ALL: Set<ChannelType>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,12 +21,23 @@ export const enum ApplicationCommandInputType {
|
|||
}
|
||||
|
||||
export const enum ApplicationCommandType {
|
||||
/**
|
||||
* @remarks Discord API calls this just CHAT
|
||||
*/
|
||||
CHAT_INPUT = 1,
|
||||
USER = 2,
|
||||
MESSAGE = 3,
|
||||
PRIMARY_ENTRY_POINT = 4,
|
||||
}
|
||||
|
||||
export const enum ApplicationIntegrationType {
|
||||
GUILD_INSTALL = 0,
|
||||
USER_INSTALL = 1
|
||||
USER_INSTALL = 1,
|
||||
}
|
||||
|
||||
export const enum InteractionType {
|
||||
APPLICATION_COMMAND = 2,
|
||||
MESSAGE_COMPONENT = 3,
|
||||
APPLICATION_COMMAND_AUTOCOMPLETE = 4,
|
||||
MODAL_SUBMIT = 5,
|
||||
}
|
||||
|
|
|
|||
103
packages/discord-types/enums/guild.ts
Normal file
103
packages/discord-types/enums/guild.ts
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
export const enum GuildScheduledEventStatus {
|
||||
SCHEDULED = 1,
|
||||
ACTIVE = 2,
|
||||
COMPLETED = 3,
|
||||
CANCELED = 4,
|
||||
}
|
||||
|
||||
export const enum GuildScheduledEventEntityType {
|
||||
NONE = 0,
|
||||
STAGE_INSTANCE = 1,
|
||||
VOICE = 2,
|
||||
EXTERNAL = 3,
|
||||
PRIME_TIME = 4,
|
||||
}
|
||||
|
||||
export const enum GuildScheduledEventPrivacyLevel {
|
||||
PUBLIC = 1,
|
||||
GUILD_ONLY = 2,
|
||||
}
|
||||
|
||||
export const enum GuildNSFWLevel {
|
||||
DEFAULT = 0,
|
||||
EXPLICIT = 1,
|
||||
SAFE = 2,
|
||||
AGE_RESTRICTED = 3,
|
||||
}
|
||||
|
||||
export const enum GuildVerificationLevel {
|
||||
NONE = 0,
|
||||
LOW = 1,
|
||||
MEDIUM = 2,
|
||||
HIGH = 3,
|
||||
VERY_HIGH = 4,
|
||||
}
|
||||
|
||||
export const enum GuildExplicitContentFilter {
|
||||
DISABLED = 0,
|
||||
MEMBERS_WITHOUT_ROLES = 1,
|
||||
ALL_MEMBERS = 2,
|
||||
}
|
||||
|
||||
export const enum GuildMFALevel {
|
||||
NONE = 0,
|
||||
ELEVATED = 1,
|
||||
}
|
||||
|
||||
export const enum GuildDefaultMessageNotifications {
|
||||
ALL_MESSAGES = 0,
|
||||
ONLY_MENTIONS = 1,
|
||||
}
|
||||
|
||||
export const enum GuildPremiumTier {
|
||||
NONE = 0,
|
||||
TIER_1 = 1,
|
||||
TIER_2 = 2,
|
||||
TIER_3 = 3,
|
||||
}
|
||||
|
||||
export const enum GuildSettingsFlags {
|
||||
UNREADS_ALL_MESSAGES = 2048,
|
||||
UNREADS_ONLY_MENTIONS = 4096,
|
||||
OPT_IN_CHANNELS_OFF = 8192,
|
||||
OPT_IN_CHANNELS_ON = 16384,
|
||||
}
|
||||
|
||||
export const enum SystemChannelFlags {
|
||||
SUPPRESS_JOIN_NOTIFICATIONS = 1,
|
||||
SUPPRESS_PREMIUM_SUBSCRIPTIONS = 2,
|
||||
SUPPRESS_GUILD_REMINDER_NOTIFICATIONS = 4,
|
||||
SUPPRESS_JOIN_NOTIFICATION_REPLIES = 8,
|
||||
SUPPRESS_ROLE_SUBSCRIPTION_PURCHASE_NOTIFICATIONS = 16,
|
||||
SUPPRESS_ROLE_SUBSCRIPTION_PURCHASE_NOTIFICATION_REPLIES = 32,
|
||||
SUPPRESS_CHANNEL_PROMPT_DEADCHAT = 128,
|
||||
SUPPRESS_UGC_ADDED_NOTIFICATIONS = 256,
|
||||
}
|
||||
|
||||
export const enum GuildMemberFlags {
|
||||
DID_REJOIN = 1,
|
||||
COMPLETED_ONBOARDING = 2,
|
||||
BYPASSES_VERIFICATION = 4,
|
||||
STARTED_ONBOARDING = 8,
|
||||
IS_GUEST = 16,
|
||||
STARTED_HOME_ACTIONS = 32,
|
||||
COMPLETED_HOME_ACTIONS = 64,
|
||||
AUTOMOD_QUARANTINED_USERNAME_OR_GUILD_NICKNAME = 128,
|
||||
AUTOMOD_QUARANTINED_BIO = 256,
|
||||
DM_SETTINGS_UPSELL_ACKNOWLEDGED = 512,
|
||||
AUTOMOD_QUARANTINED_SERVER_TAG = 1024,
|
||||
}
|
||||
|
||||
export const enum RoleFlags {
|
||||
IN_PROMPT = 1,
|
||||
}
|
||||
|
||||
export const enum RecurrenceRuleFrequency {
|
||||
YEARLY = 0,
|
||||
MONTHLY = 1,
|
||||
WEEKLY = 2,
|
||||
DAILY = 3,
|
||||
HOURLY = 4,
|
||||
MINUTELY = 5,
|
||||
SECONDLY = 6,
|
||||
}
|
||||
|
|
@ -1,6 +1,10 @@
|
|||
export * from "./activity";
|
||||
export * from "./application";
|
||||
export * from "./channel";
|
||||
export * from "./commands";
|
||||
export * from "./guild";
|
||||
export * from "./messages";
|
||||
export * from "./misc";
|
||||
export * from "./settings";
|
||||
export * from "./user";
|
||||
export * from "./voice";
|
||||
|
|
|
|||
|
|
@ -1,3 +1,54 @@
|
|||
export const enum ComponentType {
|
||||
UNKNOWN = -1,
|
||||
ACTION_ROW = 1,
|
||||
BUTTON = 2,
|
||||
STRING_SELECT = 3,
|
||||
TEXT_INPUT = 4,
|
||||
USER_SELECT = 5,
|
||||
ROLE_SELECT = 6,
|
||||
MENTIONABLE_SELECT = 7,
|
||||
CHANNEL_SELECT = 8,
|
||||
SECTION = 9,
|
||||
TEXT_DISPLAY = 10,
|
||||
THUMBNAIL = 11,
|
||||
MEDIA_GALLERY = 12,
|
||||
FILE = 13,
|
||||
SEPARATOR = 14,
|
||||
CONTENT_INVENTORY_ENTRY = 16,
|
||||
CONTAINER = 17,
|
||||
LABEL = 18,
|
||||
FILE_UPLOAD = 19,
|
||||
CHECKPOINT_CARD = 20,
|
||||
}
|
||||
|
||||
export const enum ButtonStyle {
|
||||
PRIMARY = 1,
|
||||
SECONDARY = 2,
|
||||
SUCCESS = 3,
|
||||
DESTRUCTIVE = 4,
|
||||
LINK = 5,
|
||||
PREMIUM = 6,
|
||||
}
|
||||
|
||||
export const enum MessageReferenceType {
|
||||
DEFAULT = 0,
|
||||
FORWARD = 1,
|
||||
}
|
||||
|
||||
export const enum PollLayoutType {
|
||||
UNKNOWN = 0,
|
||||
DEFAULT = 1,
|
||||
IMAGE_ONLY_ANSWERS = 2
|
||||
}
|
||||
|
||||
export const enum MessageActivityType {
|
||||
JOIN = 1,
|
||||
LISTEN = 3,
|
||||
WATCH = 4,
|
||||
JOIN_REQUEST = 5,
|
||||
STREAM_REQUEST = 6,
|
||||
}
|
||||
|
||||
export const enum StickerType {
|
||||
/** an official sticker in a pack */
|
||||
STANDARD = 1,
|
||||
|
|
@ -92,6 +143,8 @@ export const enum MessageType {
|
|||
* Name: PREMIUM_GUILD_SUBSCRIPTION
|
||||
* Rendered Content: "{author} just boosted the server{content ? " {content} times"}!"
|
||||
* Deletable: true
|
||||
*
|
||||
* @remarks Discord API calls this GUILD_BOOST
|
||||
*/
|
||||
PREMIUM_GUILD_SUBSCRIPTION = 8,
|
||||
/**
|
||||
|
|
@ -101,6 +154,8 @@ export const enum MessageType {
|
|||
* Name: PREMIUM_GUILD_SUBSCRIPTION_TIER_1
|
||||
* Rendered Content: "{author} just boosted the server{content ? " {content} times"}! {guild} has achieved Level 1! "
|
||||
* Deletable: true
|
||||
*
|
||||
* @remarks Discord API calls this GUILD_BOOST_TIER_1
|
||||
*/
|
||||
PREMIUM_GUILD_SUBSCRIPTION_TIER_1 = 9,
|
||||
/**
|
||||
|
|
@ -110,6 +165,8 @@ export const enum MessageType {
|
|||
* Name: PREMIUM_GUILD_SUBSCRIPTION_TIER_2
|
||||
* Rendered Content: "{author} just boosted the server{content ? " {content} times"}! {guild} has achieved Level 2! "
|
||||
* Deletable: true
|
||||
*
|
||||
* @remarks Discord API calls this GUILD_BOOST_TIER_2
|
||||
*/
|
||||
PREMIUM_GUILD_SUBSCRIPTION_TIER_2 = 10,
|
||||
/**
|
||||
|
|
@ -119,6 +176,8 @@ export const enum MessageType {
|
|||
* Name: PREMIUM_GUILD_SUBSCRIPTION_TIER_3
|
||||
* Rendered Content: "{author} just boosted the server{content ? " {content} times"}! {guild} has achieved Level 3! "
|
||||
* Deletable: true
|
||||
*
|
||||
* @remarks Discord API calls this GUILD_BOOST_TIER_3
|
||||
*/
|
||||
PREMIUM_GUILD_SUBSCRIPTION_TIER_3 = 11,
|
||||
/**
|
||||
|
|
@ -130,6 +189,14 @@ export const enum MessageType {
|
|||
* Deletable: true
|
||||
*/
|
||||
CHANNEL_FOLLOW_ADD = 12,
|
||||
/**
|
||||
* A message sent when a user starts a stream in a guild.
|
||||
*
|
||||
* Value: 13
|
||||
* Name: GUILD_STREAM
|
||||
* Deletable: true
|
||||
*/
|
||||
GUILD_STREAM = 13,
|
||||
/**
|
||||
* A message sent when a guild is disqualified from discovery
|
||||
*
|
||||
|
|
@ -301,6 +368,22 @@ export const enum MessageType {
|
|||
* Deletable: true
|
||||
*/
|
||||
GUILD_APPLICATION_PREMIUM_SUBSCRIPTION = 32,
|
||||
/**
|
||||
* A message sent when an integration is added to a private channel
|
||||
*
|
||||
* Value: 33
|
||||
* Name: PRIVATE_CHANNEL_INTEGRATION_ADDED
|
||||
* Deletable: true
|
||||
*/
|
||||
PRIVATE_CHANNEL_INTEGRATION_ADDED = 33,
|
||||
/**
|
||||
* A message sent when an integration is removed from a private channel
|
||||
*
|
||||
* Value: 34
|
||||
* Name: PRIVATE_CHANNEL_INTEGRATION_REMOVED
|
||||
* Deletable: true
|
||||
*/
|
||||
PRIVATE_CHANNEL_INTEGRATION_REMOVED = 34,
|
||||
/**
|
||||
* A message sent when a user gifts a premium (Nitro) referral
|
||||
*
|
||||
|
|
@ -380,6 +463,14 @@ export const enum MessageType {
|
|||
* Deletable: true
|
||||
*/
|
||||
PURCHASE_NOTIFICATION = 44,
|
||||
/**
|
||||
* A message sent as a voice hangout invite
|
||||
*
|
||||
* Value: 45
|
||||
* Name: VOICE_HANGOUT_INVITE
|
||||
* Deletable: true
|
||||
*/
|
||||
VOICE_HANGOUT_INVITE = 45,
|
||||
/**
|
||||
* A message sent when a poll is finalized
|
||||
*
|
||||
|
|
@ -470,6 +561,22 @@ export const enum MessageType {
|
|||
* Deletable: true
|
||||
*/
|
||||
HD_STREAMING_UPGRADED = 55,
|
||||
/**
|
||||
* A message sent when a chat wallpaper is set
|
||||
*
|
||||
* Value: 56
|
||||
* Name: CHAT_WALLPAPER_SET
|
||||
* Deletable: true
|
||||
*/
|
||||
CHAT_WALLPAPER_SET = 56,
|
||||
/**
|
||||
* A message sent when a chat wallpaper is removed
|
||||
*
|
||||
* Value: 57
|
||||
* Name: CHAT_WALLPAPER_REMOVED
|
||||
* Deletable: true
|
||||
*/
|
||||
CHAT_WALLPAPER_REMOVED = 57,
|
||||
/**
|
||||
* A message sent when a user resolves a moderation report by deleting the offending message
|
||||
*
|
||||
|
|
@ -524,6 +631,14 @@ export const enum MessageType {
|
|||
* Deletable: true
|
||||
*/
|
||||
EMOJI_ADDED = 63,
|
||||
/**
|
||||
* A message sent as a premium group invite
|
||||
*
|
||||
* Value: 64
|
||||
* Name: PREMIUM_GROUP_INVITE
|
||||
* Deletable: true
|
||||
*/
|
||||
PREMIUM_GROUP_INVITE = 64,
|
||||
}
|
||||
|
||||
export const enum MessageFlags {
|
||||
|
|
|
|||
|
|
@ -11,42 +11,7 @@ export const enum DraftType {
|
|||
Poll = 4,
|
||||
SlashCommand = 5,
|
||||
ForwardContextMessage = 6,
|
||||
}
|
||||
|
||||
export const enum GuildScheduledEventStatus {
|
||||
SCHEDULED = 1,
|
||||
ACTIVE = 2,
|
||||
COMPLETED = 3,
|
||||
CANCELED = 4,
|
||||
}
|
||||
|
||||
export const enum GuildScheduledEventEntityType {
|
||||
STAGE_INSTANCE = 1,
|
||||
VOICE = 2,
|
||||
EXTERNAL = 3,
|
||||
}
|
||||
|
||||
export const enum GuildScheduledEventPrivacyLevel {
|
||||
GUILD_ONLY = 2,
|
||||
}
|
||||
|
||||
export const enum ParticipantType {
|
||||
STREAM = 0,
|
||||
HIDDEN_STREAM = 1,
|
||||
USER = 2,
|
||||
ACTIVITY = 3,
|
||||
}
|
||||
|
||||
export const enum RTCPlatform {
|
||||
DESKTOP = 0,
|
||||
MOBILE = 1,
|
||||
XBOX = 2,
|
||||
PLAYSTATION = 3,
|
||||
}
|
||||
|
||||
export const enum VideoSourceType {
|
||||
VIDEO = 0,
|
||||
CAMERA_PREVIEW = 1,
|
||||
InteractionModal = 7,
|
||||
}
|
||||
|
||||
export const enum EmojiIntention {
|
||||
|
|
@ -75,29 +40,15 @@ export const enum LoadState {
|
|||
ERROR = 3,
|
||||
}
|
||||
|
||||
export const enum ConnectionStatsFlags {
|
||||
TRANSPORT = 1,
|
||||
OUTBOUND = 2,
|
||||
INBOUND = 4,
|
||||
ALL = 7,
|
||||
export const enum InviteTargetType {
|
||||
STREAM = 1,
|
||||
EMBEDDED_APPLICATION = 2,
|
||||
ROLE_SUBSCRIPTIONS_PURCHASE = 3,
|
||||
}
|
||||
|
||||
export const enum SpeakingFlags {
|
||||
export const enum PremiumType {
|
||||
NONE = 0,
|
||||
VOICE = 1,
|
||||
SOUNDSHARE = 2,
|
||||
PRIORITY = 4,
|
||||
HIDDEN = 8,
|
||||
}
|
||||
|
||||
export const enum GoLiveQualityMode {
|
||||
AUTO = 1,
|
||||
FULL = 2,
|
||||
}
|
||||
|
||||
export const enum VoiceProcessingStateReason {
|
||||
CPU_OVERUSE = 1,
|
||||
FAILED = 2,
|
||||
VAD_CPU_OVERUSE = 3,
|
||||
INITIALIZED = 4,
|
||||
TIER_1 = 1,
|
||||
TIER_2 = 2,
|
||||
TIER_0 = 3,
|
||||
}
|
||||
|
|
|
|||
42
packages/discord-types/enums/settings.ts
Normal file
42
packages/discord-types/enums/settings.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
export const enum Theme {
|
||||
UNSET = 0,
|
||||
DARK = 1,
|
||||
LIGHT = 2,
|
||||
DARKER = 3,
|
||||
MIDNIGHT = 4,
|
||||
}
|
||||
|
||||
export const enum UIDensity {
|
||||
UNSET = 0,
|
||||
COMPACT = 1,
|
||||
COZY = 2,
|
||||
RESPONSIVE = 3,
|
||||
DEFAULT = 4,
|
||||
}
|
||||
|
||||
export const enum StickerAnimationSetting {
|
||||
ALWAYS = 0,
|
||||
ON_INTERACTION = 1,
|
||||
NEVER = 2,
|
||||
}
|
||||
|
||||
export const enum UserNotificationSetting {
|
||||
ALL_MESSAGES = 0,
|
||||
ONLY_MENTIONS = 1,
|
||||
NO_MESSAGES = 2,
|
||||
}
|
||||
|
||||
export const enum ChannelOverrideFlags {
|
||||
UNREADS_ONLY_MENTIONS = 512,
|
||||
UNREADS_ALL_MESSAGES = 1024,
|
||||
FAVORITED = 2048,
|
||||
OPT_IN_ENABLED = 4096,
|
||||
NEW_FORUM_THREADS_OFF = 8192,
|
||||
NEW_FORUM_THREADS_ON = 16384,
|
||||
}
|
||||
|
||||
export const enum NotifyHighlights {
|
||||
NULL = 0,
|
||||
DISABLED = 1,
|
||||
ENABLED = 2,
|
||||
}
|
||||
|
|
@ -2,10 +2,16 @@ export const enum RelationshipType {
|
|||
NONE = 0,
|
||||
FRIEND = 1,
|
||||
BLOCKED = 2,
|
||||
/**
|
||||
* @remarks Discord API calls this PENDING_INCOMING
|
||||
*/
|
||||
INCOMING_REQUEST = 3,
|
||||
/**
|
||||
* @remarks Discord API calls this PENDING_OUTGOING
|
||||
*/
|
||||
OUTGOING_REQUEST = 4,
|
||||
IMPLICIT = 5,
|
||||
SUGGESTION = 6
|
||||
SUGGESTION = 6,
|
||||
}
|
||||
|
||||
export enum GiftIntentType {
|
||||
|
|
@ -20,3 +26,28 @@ export const enum ReadStateType {
|
|||
GUILD_ONBOARDING_QUESTION = 4,
|
||||
MESSAGE_REQUESTS = 5,
|
||||
}
|
||||
|
||||
export const enum UserFlags {
|
||||
STAFF = 1,
|
||||
PARTNER = 2,
|
||||
HYPESQUAD = 4,
|
||||
BUG_HUNTER_LEVEL_1 = 8,
|
||||
MFA_SMS = 16,
|
||||
PREMIUM_PROMO_DISMISSED = 32,
|
||||
HYPESQUAD_ONLINE_HOUSE_1 = 64,
|
||||
HYPESQUAD_ONLINE_HOUSE_2 = 128,
|
||||
HYPESQUAD_ONLINE_HOUSE_3 = 256,
|
||||
PREMIUM_EARLY_SUPPORTER = 512,
|
||||
HAS_UNREAD_URGENT_MESSAGES = 8192,
|
||||
BUG_HUNTER_LEVEL_2 = 16384,
|
||||
VERIFIED_BOT = 65536,
|
||||
VERIFIED_DEVELOPER = 131072,
|
||||
CERTIFIED_MODERATOR = 262144,
|
||||
BOT_HTTP_INTERACTIONS = 524288,
|
||||
SPAMMER = 1048576,
|
||||
DISABLE_PREMIUM = 2097152,
|
||||
PROVISIONAL_ACCOUNT = 8388608,
|
||||
QUARANTINED = 17592186044416,
|
||||
COLLABORATOR = 1125899906842624,
|
||||
RESTRICTED_COLLABORATOR = 2251799813685248,
|
||||
}
|
||||
|
|
|
|||
50
packages/discord-types/enums/voice.ts
Normal file
50
packages/discord-types/enums/voice.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
export const enum ParticipantType {
|
||||
STREAM = 0,
|
||||
HIDDEN_STREAM = 1,
|
||||
USER = 2,
|
||||
ACTIVITY = 3,
|
||||
}
|
||||
|
||||
export const enum RTCPlatform {
|
||||
DESKTOP = 0,
|
||||
MOBILE = 1,
|
||||
XBOX = 2,
|
||||
PLAYSTATION = 3,
|
||||
}
|
||||
|
||||
export const enum VideoSourceType {
|
||||
VIDEO = 0,
|
||||
CAMERA_PREVIEW = 1,
|
||||
}
|
||||
|
||||
export const enum ConnectionStatsFlags {
|
||||
TRANSPORT = 1,
|
||||
OUTBOUND = 2,
|
||||
INBOUND = 4,
|
||||
ALL = 7,
|
||||
}
|
||||
|
||||
export const enum SpeakingFlags {
|
||||
NONE = 0,
|
||||
VOICE = 1,
|
||||
SOUNDSHARE = 2,
|
||||
PRIORITY = 4,
|
||||
HIDDEN = 8,
|
||||
}
|
||||
|
||||
export const enum GoLiveQualityMode {
|
||||
AUTO = 1,
|
||||
FULL = 2,
|
||||
}
|
||||
|
||||
export const enum VoiceProcessingStateReason {
|
||||
CPU_OVERUSE = 1,
|
||||
FAILED = 2,
|
||||
VAD_CPU_OVERUSE = 3,
|
||||
INITIALIZED = 4,
|
||||
}
|
||||
|
||||
export const enum VideoQualityMode {
|
||||
AUTO = 1,
|
||||
FULL = 2,
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
import { ActivityFlags, ActivityStatusDisplayType, ActivityType } from "../../enums";
|
||||
|
||||
export type ActivityPlatform = "desktop" | "mobile" | "web" | "embedded" | "xbox" | "playstation" | "samsung" | "ios" | "android";
|
||||
|
||||
export interface ActivityAssets {
|
||||
large_image?: string;
|
||||
large_text?: string;
|
||||
|
|
@ -18,8 +20,10 @@ export interface Activity {
|
|||
created_at?: number;
|
||||
id?: string;
|
||||
name: string;
|
||||
application_id: string;
|
||||
application_id?: string;
|
||||
type: ActivityType;
|
||||
session_id?: string;
|
||||
sync_id?: string;
|
||||
emoji?: {
|
||||
animated: boolean;
|
||||
id: string;
|
||||
|
|
@ -41,7 +45,7 @@ export interface Activity {
|
|||
metadata?: {
|
||||
button_urls?: Array<string>;
|
||||
};
|
||||
platform?: string;
|
||||
platform?: ActivityPlatform;
|
||||
party?: {
|
||||
id?: string;
|
||||
size?: [number, number];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,36 @@
|
|||
import { ActivityLabelType, ApplicationFlags, ApplicationType, CarouselItemType, LinkedGameType, OrientationLockState } from "../../enums";
|
||||
import { Guild } from "./Guild";
|
||||
import { User } from "./User";
|
||||
|
||||
export type EmbeddedActivityPlatform = "ios" | "android" | "web";
|
||||
|
||||
export interface EmbeddedActivityPlatformConfig {
|
||||
label_type: ActivityLabelType;
|
||||
label_from: string | null;
|
||||
label_until: string | null;
|
||||
release_phase: string;
|
||||
omit_badge_from_surfaces: string[];
|
||||
}
|
||||
|
||||
export interface EmbeddedActivityConfig {
|
||||
application_id: string;
|
||||
activity_preview_video_asset_id: string | null;
|
||||
supported_platforms: EmbeddedActivityPlatform[];
|
||||
default_orientation_lock_state: OrientationLockState;
|
||||
tablet_default_orientation_lock_state: OrientationLockState;
|
||||
requires_age_gate: boolean;
|
||||
legacy_responsive_aspect_ratio: boolean;
|
||||
premium_tier_requirement: number | null;
|
||||
free_period_starts_at: string | null;
|
||||
free_period_ends_at: string | null;
|
||||
client_platform_config: Partial<Record<EmbeddedActivityPlatform, EmbeddedActivityPlatformConfig>>;
|
||||
shelf_rank: number;
|
||||
has_csp_exception: boolean;
|
||||
displays_advertisements: boolean;
|
||||
blocked_locales: string[];
|
||||
supported_locales: string[];
|
||||
}
|
||||
|
||||
export interface ApplicationExecutable {
|
||||
os: "win32" | "darwin" | "linux";
|
||||
name: string;
|
||||
|
|
@ -23,12 +53,23 @@ export interface ApplicationInstallParams {
|
|||
scopes: string[];
|
||||
}
|
||||
|
||||
export interface ApplicationIntegrationTypeConfig {
|
||||
oauth2InstallParams: ApplicationInstallParams;
|
||||
}
|
||||
|
||||
export interface ApplicationDirectoryEntry {
|
||||
guild_count?: number;
|
||||
detailed_description?: string;
|
||||
supported_locales?: string[];
|
||||
carousel_items?: { asset_id: string; type: CarouselItemType; }[];
|
||||
}
|
||||
|
||||
export interface Application {
|
||||
id: string;
|
||||
name: string;
|
||||
icon: string | null;
|
||||
description: string;
|
||||
type: number | null;
|
||||
type: ApplicationType | null;
|
||||
coverImage: string | null;
|
||||
primarySkuId: string | undefined;
|
||||
bot: User | null;
|
||||
|
|
@ -54,24 +95,30 @@ export interface Application {
|
|||
hashes: string[];
|
||||
eulaId: string | undefined;
|
||||
slug: string | undefined;
|
||||
flags: number;
|
||||
maxParticipants: number | undefined;
|
||||
flags: ApplicationFlags;
|
||||
maxParticipants: number | null;
|
||||
tags: string[];
|
||||
embeddedActivityConfig: Record<string, unknown> | undefined;
|
||||
embeddedActivityConfig: EmbeddedActivityConfig | undefined;
|
||||
team: ApplicationTeam | undefined;
|
||||
integrationTypesConfig: Record<string, Record<string, unknown>>;
|
||||
integrationTypesConfig: Record<string, ApplicationIntegrationTypeConfig>;
|
||||
storefront_available: boolean;
|
||||
termsOfServiceUrl: string | undefined;
|
||||
privacyPolicyUrl: string | undefined;
|
||||
isDiscoverable: boolean;
|
||||
customInstallUrl: string | undefined;
|
||||
installParams: ApplicationInstallParams | undefined;
|
||||
directoryEntry: Record<string, unknown> | undefined;
|
||||
directoryEntry: ApplicationDirectoryEntry | undefined;
|
||||
categories: string[] | undefined;
|
||||
linkedGames: string[] | undefined;
|
||||
linkedGames: ApplicationLinkedGame[] | undefined;
|
||||
deepLinkUri: string | undefined;
|
||||
}
|
||||
|
||||
export interface ApplicationLinkedGame {
|
||||
id: string;
|
||||
type: LinkedGameType;
|
||||
application?: Application;
|
||||
}
|
||||
|
||||
export interface ApplicationTeam {
|
||||
id: string;
|
||||
name: string;
|
||||
|
|
|
|||
378
packages/discord-types/src/common/Channel.d.ts
vendored
378
packages/discord-types/src/common/Channel.d.ts
vendored
|
|
@ -1,84 +1,368 @@
|
|||
import { ChannelFlags, ChannelType, ForumLayout, PermissionOverwriteType, SafetyWarningType, UserFlags, VideoQualityMode } from "../../enums";
|
||||
import { DiscordRecord } from "./Record";
|
||||
|
||||
/** Permission overwrite for a role or member. */
|
||||
export interface PermissionOverwrite {
|
||||
id: string;
|
||||
/** 0 = role, 1 = member. */
|
||||
type: PermissionOverwriteType;
|
||||
deny: bigint;
|
||||
allow: bigint;
|
||||
}
|
||||
|
||||
/** Avatar decoration data for user profiles. */
|
||||
export interface AvatarDecorationData {
|
||||
asset: string;
|
||||
expires_at: string | null;
|
||||
sku_id: string;
|
||||
}
|
||||
|
||||
/** Clan identity information. */
|
||||
export interface ClanData {
|
||||
badge: string;
|
||||
identity_enabled: boolean;
|
||||
identity_guild_id: string;
|
||||
tag: string;
|
||||
}
|
||||
|
||||
/** Display name style configuration. */
|
||||
export interface DisplayNameStyles {
|
||||
colors: number[];
|
||||
effect_id: number;
|
||||
font_id: number;
|
||||
}
|
||||
|
||||
/** Collectible item data. */
|
||||
export interface CollectibleItem {
|
||||
asset: string;
|
||||
expires_at: string | null;
|
||||
label: string;
|
||||
palette: string;
|
||||
sku_id: string;
|
||||
}
|
||||
|
||||
/** User collectibles configuration. */
|
||||
export interface Collectibles {
|
||||
nameplate?: CollectibleItem;
|
||||
}
|
||||
|
||||
/** Raw recipient data from API. */
|
||||
export interface RawRecipient {
|
||||
id: string;
|
||||
avatar: string | null;
|
||||
avatar_decoration_data: AvatarDecorationData | null;
|
||||
bot: boolean;
|
||||
clan: ClanData | null;
|
||||
collectibles: Collectibles | null;
|
||||
discriminator: string;
|
||||
display_name: string | null;
|
||||
display_name_styles: DisplayNameStyles | null;
|
||||
global_name: string | null;
|
||||
primary_guild: ClanData | null;
|
||||
public_flags: UserFlags;
|
||||
username: string;
|
||||
}
|
||||
|
||||
/** Thread metadata for thread channels. */
|
||||
export interface ThreadMetadata {
|
||||
archived: boolean;
|
||||
autoArchiveDuration: number;
|
||||
archiveTimestamp: string | undefined;
|
||||
createTimestamp: string | undefined;
|
||||
locked: boolean;
|
||||
invitable: boolean;
|
||||
}
|
||||
|
||||
/** Icon emoji for channels that support it. */
|
||||
export interface ChannelIconEmoji {
|
||||
id: string | null;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** Thread member info, present when user has joined a thread. */
|
||||
export interface ThreadMember {
|
||||
flags: number;
|
||||
joinTimestamp: string;
|
||||
muted: boolean;
|
||||
muteConfig: {
|
||||
end_time: string | null;
|
||||
selected_time_window: number;
|
||||
} | null;
|
||||
}
|
||||
|
||||
/** Available tag for forum/media channels. */
|
||||
export interface ForumTag {
|
||||
id: string;
|
||||
name: string;
|
||||
emojiId: string | null;
|
||||
emojiName: string | null;
|
||||
moderated: boolean;
|
||||
color: number | null;
|
||||
}
|
||||
|
||||
/** Default reaction emoji for forum/media channels. */
|
||||
export interface DefaultReactionEmoji {
|
||||
emojiId: string | null;
|
||||
emojiName: string;
|
||||
}
|
||||
|
||||
/** Linked lobby for voice channels. */
|
||||
export interface LinkedLobby {
|
||||
application_id: string;
|
||||
lobby_id: string;
|
||||
linked_by: string;
|
||||
linked_at: string;
|
||||
require_application_authorization: boolean;
|
||||
}
|
||||
|
||||
/** Safety warning for DM spam detection. */
|
||||
export interface SafetyWarning {
|
||||
id: string;
|
||||
type: SafetyWarningType;
|
||||
expiry: string;
|
||||
dismiss_timestamp: string | null;
|
||||
}
|
||||
|
||||
/** Sort order for forum/media channels. */
|
||||
export type ForumSortOrder = 0 | 1;
|
||||
|
||||
/** Tag setting for forum/media channels. */
|
||||
export type ForumTagSetting = "match_all" | "match_some";
|
||||
|
||||
/** Discord channel object. */
|
||||
export class Channel extends DiscordRecord {
|
||||
constructor(channel: object);
|
||||
application_id: number | undefined;
|
||||
bitrate: number;
|
||||
|
||||
/** Application ID for bot-created channels. */
|
||||
application_id: string | undefined;
|
||||
/** Applied tag IDs. Threads in forum/media channels only. */
|
||||
appliedTags: string[] | undefined;
|
||||
/** Available tags for forum/media channels. */
|
||||
availableTags: ForumTag[] | undefined;
|
||||
/** Internal, use bitrate getter. Voice channels only. */
|
||||
bitrate_: number | undefined;
|
||||
/** Whether blocked user warning was dismissed. */
|
||||
blockedUserWarningDismissed: boolean | undefined;
|
||||
/** Default auto-archive duration for threads in minutes. Guild text channels only. */
|
||||
defaultAutoArchiveDuration: number | undefined;
|
||||
flags: number;
|
||||
/** Default layout for forum/media channels. */
|
||||
defaultForumLayout: ForumLayout | undefined;
|
||||
/** Default reaction emoji for forum/media channels. */
|
||||
defaultReactionEmoji: DefaultReactionEmoji | undefined;
|
||||
/** Default sort order for forum/media channels. */
|
||||
defaultSortOrder: ForumSortOrder | undefined;
|
||||
/** Default tag setting for forum/media channels. */
|
||||
defaultTagSetting: ForumTagSetting | undefined;
|
||||
/** Default slowmode for new threads. Guild text channels only. */
|
||||
defaultThreadRateLimitPerUser: number | undefined;
|
||||
/** Internal, use flags getter. */
|
||||
flags_: ChannelFlags;
|
||||
/** Guild ID. */
|
||||
guild_id: string;
|
||||
icon: string;
|
||||
/** User ID who purchased HD streaming. */
|
||||
hdStreamingBuyerId: string | undefined;
|
||||
/** HD streaming end timestamp. */
|
||||
hdStreamingUntil: string | undefined;
|
||||
/** Icon hash for group DMs. */
|
||||
icon: string | undefined;
|
||||
/** Icon emoji for channels that support it. */
|
||||
iconEmoji: ChannelIconEmoji | undefined;
|
||||
/** Channel snowflake ID. */
|
||||
id: string;
|
||||
lastMessageId: string;
|
||||
/** For DMs, whether this is a message request. */
|
||||
isMessageRequest: boolean;
|
||||
/** Timestamp when message request was created. */
|
||||
isMessageRequestTimestamp: string | null;
|
||||
/** Whether the DM is flagged as spam. */
|
||||
isSpam: boolean;
|
||||
/** ID of the last message in the channel. */
|
||||
lastMessageId: string | null;
|
||||
/** ISO timestamp of the last pinned message. */
|
||||
lastPinTimestamp: string | undefined;
|
||||
member: unknown;
|
||||
/** Linked lobby for voice channels. */
|
||||
linkedLobby: LinkedLobby | null;
|
||||
/** Thread member info if user joined thread. Threads only. */
|
||||
member: ThreadMember | undefined;
|
||||
/** Approximate member count. Threads only. */
|
||||
memberCount: number | undefined;
|
||||
/** Preview of member IDs in the thread. Threads only. */
|
||||
memberIdsPreview: string[] | undefined;
|
||||
memberListId: unknown;
|
||||
/** Member list ID for guild channels. */
|
||||
memberListId: string | undefined;
|
||||
/** Approximate message count. Threads only. */
|
||||
messageCount: number | undefined;
|
||||
/** Channel name. */
|
||||
name: string;
|
||||
nicks: Record<string, unknown>;
|
||||
nsfw: boolean;
|
||||
originChannelId: unknown;
|
||||
ownerId: string;
|
||||
/** Custom nicknames in group DMs, keyed by user ID. */
|
||||
nicks: Record<string, string>;
|
||||
/** Internal, use nsfw getter. Guild channels only. */
|
||||
nsfw_: boolean;
|
||||
/** Origin channel ID for crossposted messages. */
|
||||
originChannelId: string | undefined;
|
||||
/** Owner ID for group DMs and threads. */
|
||||
ownerId: string | undefined;
|
||||
/** Parent category or channel ID. */
|
||||
parent_id: string;
|
||||
permissionOverwrites: {
|
||||
[role: string]: {
|
||||
id: string;
|
||||
type: number;
|
||||
deny: bigint;
|
||||
allow: bigint;
|
||||
};
|
||||
};
|
||||
position: number;
|
||||
rateLimitPerUser: number;
|
||||
rawRecipients: {
|
||||
id: string;
|
||||
avatar: string;
|
||||
username: string;
|
||||
public_flags: number;
|
||||
discriminator: string;
|
||||
}[];
|
||||
/** Parent channel type for threads. */
|
||||
parentChannelThreadType: ChannelType | undefined;
|
||||
/** Internal, use permissionOverwrites getter. Guild channels only. */
|
||||
permissionOverwrites_: Record<string, PermissionOverwrite>;
|
||||
/** Internal, use position getter. Guild channels only. */
|
||||
position_: number;
|
||||
/** Internal, use rateLimitPerUser getter. */
|
||||
rateLimitPerUser_: number;
|
||||
/** Raw recipient data from API. DMs and group DMs. */
|
||||
rawRecipients: RawRecipient[];
|
||||
/** Recipient flags for DMs. */
|
||||
recipientFlags: number;
|
||||
/** Recipient user IDs. DMs and group DMs. */
|
||||
recipients: string[];
|
||||
rtcRegion: string;
|
||||
threadMetadata: {
|
||||
locked: boolean;
|
||||
archived: boolean;
|
||||
invitable: boolean;
|
||||
createTimestamp: string | undefined;
|
||||
autoArchiveDuration: number;
|
||||
archiveTimestamp: string | undefined;
|
||||
};
|
||||
topic: string;
|
||||
type: number;
|
||||
userLimit: number;
|
||||
videoQualityMode: undefined;
|
||||
/** RTC region for voice channels, null for automatic. Voice channels only. */
|
||||
rtcRegion: string | null;
|
||||
/** Safety warnings for DM spam detection. */
|
||||
safetyWarnings: SafetyWarning[];
|
||||
/** Template string. */
|
||||
template: string | undefined;
|
||||
/** Theme color for group DMs. */
|
||||
themeColor: number | undefined;
|
||||
/** Thread metadata. Threads only. */
|
||||
threadMetadata: ThreadMetadata | undefined;
|
||||
/** Internal, use topic getter. */
|
||||
topic_: string | null;
|
||||
/** Total messages sent in thread. Threads only. */
|
||||
totalMessageSent: number | undefined;
|
||||
/** Channel type from ChannelType enum. */
|
||||
type: ChannelType;
|
||||
/** Internal, use userLimit getter. Voice channels only. */
|
||||
userLimit_: number | undefined;
|
||||
/** Channel version number. */
|
||||
version: number | undefined;
|
||||
/** Video quality mode for voice channels. Voice channels only. */
|
||||
videoQualityMode: VideoQualityMode | undefined;
|
||||
|
||||
/** Computed access permissions for the current user. */
|
||||
get accessPermissions(): bigint;
|
||||
get lastActiveTimestamp(): number;
|
||||
/** Bitrate in bits per second. Voice channels only. */
|
||||
get bitrate(): number;
|
||||
/** Channel flags bitmask. */
|
||||
get flags(): ChannelFlags;
|
||||
/** Whether HD streaming splash is active. */
|
||||
get isHDStreamSplashed(): boolean;
|
||||
/** Whether the channel is marked as NSFW. */
|
||||
get nsfw(): boolean;
|
||||
/** Permission overwrites keyed by role or user ID. */
|
||||
get permissionOverwrites(): Record<string, PermissionOverwrite>;
|
||||
/** Channel position in the channel list. */
|
||||
get position(): number;
|
||||
/** Slowmode delay in seconds. */
|
||||
get rateLimitPerUser(): number;
|
||||
/** Channel topic or description. */
|
||||
get topic(): string;
|
||||
/** Maximum users allowed in voice channel. 0 = unlimited. */
|
||||
get userLimit(): number;
|
||||
|
||||
computeLurkerPermissionsAllowList(): unknown;
|
||||
getApplicationId(): unknown;
|
||||
/** Computes allowed permissions for lurkers. */
|
||||
computeLurkerPermissionsAllowList(): bigint | undefined;
|
||||
/** Gets the application ID for bot-created channels. */
|
||||
getApplicationId(): string | undefined;
|
||||
/** Gets the default layout for forum channels. */
|
||||
getDefaultLayout(): ForumLayout;
|
||||
/** Gets the default sort order for forum channels. */
|
||||
getDefaultSortOrder(): ForumSortOrder;
|
||||
/** Gets the default tag setting for forum channels. */
|
||||
getDefaultTagSetting(): ForumTagSetting;
|
||||
/** Gets the guild ID this channel belongs to. */
|
||||
getGuildId(): string;
|
||||
getRecipientId(): unknown;
|
||||
/** Gets the recipient user ID for DMs. */
|
||||
getRecipientId(): string | undefined;
|
||||
/** Checks if the channel has a specific flag. */
|
||||
hasFlag(flag: number): boolean;
|
||||
/** Returns a new Channel with the given properties merged. */
|
||||
merge(props: Record<string, unknown>): this;
|
||||
/** Returns a new Channel with the given property set. */
|
||||
set(key: string, value: unknown): this;
|
||||
/** Converts the channel to a plain JavaScript object. */
|
||||
toJS(): Record<string, unknown>;
|
||||
/** Whether this is an active (non-archived) thread. */
|
||||
isActiveThread(): boolean;
|
||||
/** Whether this is an announcement thread. */
|
||||
isAnnouncementThread(): boolean;
|
||||
/** Whether this is an archived and locked thread. */
|
||||
isArchivedLockedThread(): boolean;
|
||||
/** Whether this is an archived thread. */
|
||||
isArchivedThread(): boolean;
|
||||
/** Whether this is a category channel. */
|
||||
isCategory(): boolean;
|
||||
/** Whether this is a DM channel. */
|
||||
isDM(): boolean;
|
||||
/** Whether this is a directory channel. */
|
||||
isDirectory(): boolean;
|
||||
/** Whether this is a forum channel. */
|
||||
isForumChannel(): boolean;
|
||||
/** Whether this is a forum-like channel (forum or media). */
|
||||
isForumLikeChannel(): boolean;
|
||||
/** Whether this is a forum post thread. */
|
||||
isForumPost(): boolean;
|
||||
/** Whether this is a group DM. */
|
||||
isGroupDM(): boolean;
|
||||
/** Whether this is a stage voice channel. */
|
||||
isGuildStageVoice(): boolean;
|
||||
isGuildVoice(): boolean;
|
||||
/** Whether this is a guild voice or stage channel. */
|
||||
isGuildVocal(): boolean;
|
||||
/** Whether this is a guild vocal channel or vocal thread. */
|
||||
isGuildVocalOrThread(): boolean;
|
||||
/** Whether this is a guild voice channel. */
|
||||
isGuildVoice(): boolean;
|
||||
/** Whether this is a guild voice channel or voice thread. */
|
||||
isGuildVoiceOrThread(): boolean;
|
||||
/** Whether this channel supports listen mode. */
|
||||
isListenModeCapable(): boolean;
|
||||
/** Whether this is a locked thread. */
|
||||
isLockedThread(): boolean;
|
||||
/** Whether this channel is managed by an integration. */
|
||||
isManaged(): boolean;
|
||||
/** Whether this is a media channel. */
|
||||
isMediaChannel(): boolean;
|
||||
/** Whether this is a media post thread. */
|
||||
isMediaPost(): boolean;
|
||||
/** Whether this is a moderator report channel. */
|
||||
isModeratorReportChannel(): boolean;
|
||||
/** Whether this is a multi-user DM (group DM). */
|
||||
isMultiUserDM(): boolean;
|
||||
/** Whether the channel is marked as NSFW. */
|
||||
isNSFW(): boolean;
|
||||
isOwner(): boolean;
|
||||
/**
|
||||
* Checks if the given user is the channel owner.
|
||||
* @param userId User ID to check.
|
||||
*/
|
||||
isOwner(userId: string): boolean;
|
||||
/** Whether this is a private channel (DM or group DM). */
|
||||
isPrivate(): boolean;
|
||||
/** Whether this channel supports ringing. */
|
||||
isRingable(): boolean;
|
||||
/** Whether this is a role subscription template preview channel. */
|
||||
isRoleSubscriptionTemplatePreviewChannel(): boolean;
|
||||
/** Whether this channel is scheduled for deletion. */
|
||||
isScheduledForDeletion(): boolean;
|
||||
/** Whether this is a system DM (from Discord). */
|
||||
isSystemDM(): boolean;
|
||||
/** Whether this is any type of thread. */
|
||||
isThread(): boolean;
|
||||
/** Whether this channel supports voice. */
|
||||
isVocal(): boolean;
|
||||
/** Whether this is a vocal thread. */
|
||||
isVocalThread(): boolean;
|
||||
|
||||
/**
|
||||
* Adds a recipient to a group DM.
|
||||
* @param userId User ID to add.
|
||||
* @param nick Optional nickname for the user.
|
||||
* @param currentUserId Current user's ID.
|
||||
*/
|
||||
addRecipient(userId: string, nick?: string | null, currentUserId?: string): this;
|
||||
/**
|
||||
* Removes a recipient from a group DM.
|
||||
* @param userId User ID to remove.
|
||||
*/
|
||||
removeRecipient(userId: string): this;
|
||||
}
|
||||
|
|
|
|||
50
packages/discord-types/src/common/Guild.d.ts
vendored
50
packages/discord-types/src/common/Guild.d.ts
vendored
|
|
@ -1,9 +1,18 @@
|
|||
import { Role } from './Role';
|
||||
import { DiscordRecord } from './Record';
|
||||
import {
|
||||
GuildDefaultMessageNotifications,
|
||||
GuildExplicitContentFilter,
|
||||
GuildMFALevel,
|
||||
GuildNSFWLevel,
|
||||
GuildPremiumTier,
|
||||
GuildVerificationLevel,
|
||||
PermissionOverwriteType,
|
||||
SystemChannelFlags,
|
||||
} from "../../enums";
|
||||
|
||||
// copy(Object.keys(findByProps("CREATOR_MONETIZABLE")).map(JSON.stringify).join("|"))
|
||||
export type GuildFeatures =
|
||||
"INVITE_SPLASH" | "VIP_REGIONS" | "VANITY_URL" | "MORE_EMOJI" | "MORE_STICKERS" | "MORE_SOUNDBOARD" | "VERIFIED" | "COMMERCE" | "DISCOVERABLE" | "COMMUNITY" | "FEATURABLE" | "NEWS" | "HUB" | "PARTNERED" | "ANIMATED_ICON" | "BANNER" | "ENABLED_DISCOVERABLE_BEFORE" | "WELCOME_SCREEN_ENABLED" | "MEMBER_VERIFICATION_GATE_ENABLED" | "PREVIEW_ENABLED" | "ROLE_SUBSCRIPTIONS_ENABLED" | "ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE" | "CREATOR_MONETIZABLE" | "CREATOR_MONETIZABLE_PROVISIONAL" | "CREATOR_MONETIZABLE_WHITEGLOVE" | "CREATOR_MONETIZABLE_DISABLED" | "CREATOR_MONETIZABLE_RESTRICTED" | "CREATOR_STORE_PAGE" | "CREATOR_MONETIZABLE_PENDING_NEW_OWNER_ONBOARDING" | "PRODUCTS_AVAILABLE_FOR_PURCHASE" | "GUILD_WEB_PAGE_VANITY_URL" | "THREADS_ENABLED" | "THREADS_ENABLED_TESTING" | "NEW_THREAD_PERMISSIONS" | "ROLE_ICONS" | "TEXT_IN_STAGE_ENABLED" | "TEXT_IN_VOICE_ENABLED" | "HAS_DIRECTORY_ENTRY" | "ANIMATED_BANNER" | "LINKED_TO_HUB" | "EXPOSED_TO_ACTIVITIES_WTP_EXPERIMENT" | "GUILD_HOME_DEPRECATION_OVERRIDE" | "GUILD_HOME_TEST" | "GUILD_HOME_OVERRIDE" | "GUILD_ONBOARDING" | "GUILD_ONBOARDING_EVER_ENABLED" | "GUILD_ONBOARDING_HAS_PROMPTS" | "GUILD_SERVER_GUIDE" | "INTERNAL_EMPLOYEE_ONLY" | "AUTO_MODERATION" | "INVITES_DISABLED" | "BURST_REACTIONS" | "SOUNDBOARD" | "SHARD" | "ACTIVITY_FEED_ENABLED_BY_USER" | "ACTIVITY_FEED_DISABLED_BY_USER" | "SUMMARIES_ENABLED_GA" | "LEADERBOARD_ENABLED" | "SUMMARIES_ENABLED_BY_USER" | "SUMMARIES_OPT_OUT_EXPERIENCE" | "CHANNEL_ICON_EMOJIS_GENERATED" | "NON_COMMUNITY_RAID_ALERTS" | "RAID_ALERTS_DISABLED" | "AUTOMOD_TRIGGER_USER_PROFILE" | "ENABLED_MODERATION_EXPERIENCE_FOR_NON_COMMUNITY" | "GUILD_PRODUCTS_ALLOW_ARCHIVED_FILE" | "CLAN" | "MEMBER_VERIFICATION_MANUAL_APPROVAL" | "FORWARDING_DISABLED" | "MEMBER_VERIFICATION_ROLLOUT_TEST" | "AUDIO_BITRATE_128_KBPS" | "AUDIO_BITRATE_256_KBPS" | "AUDIO_BITRATE_384_KBPS" | "VIDEO_BITRATE_ENHANCED" | "MAX_FILE_SIZE_50_MB" | "MAX_FILE_SIZE_100_MB" | "GUILD_TAGS" | "ENHANCED_ROLE_COLORS" | "PREMIUM_TIER_3_OVERRIDE" | "REPORT_TO_MOD_PILOT" | "TIERLESS_BOOSTING_SYSTEM_MESSAGE";
|
||||
"ACTIVITY_FEED_DISABLED_BY_USER" | "ACTIVITY_FEED_ENABLED_BY_USER" | "AGE_VERIFICATION_LARGE_GUILD" | "ANIMATED_BANNER" | "ANIMATED_ICON" | "AUDIO_BITRATE_128_KBPS" | "AUDIO_BITRATE_256_KBPS" | "AUDIO_BITRATE_384_KBPS" | "AUTOMOD_TRIGGER_USER_PROFILE" | "AUTO_MODERATION" | "BANNER" | "BURST_REACTIONS" | "BYPASS_SLOWMODE_PERMISSION_MIGRATION_COMPLETE" | "CHANNEL_ICON_EMOJIS_GENERATED" | "CLAN" | "COMMERCE" | "COMMUNITY" | "CREATOR_MONETIZABLE" | "CREATOR_MONETIZABLE_DISABLED" | "CREATOR_MONETIZABLE_PENDING_NEW_OWNER_ONBOARDING" | "CREATOR_MONETIZABLE_PROVISIONAL" | "CREATOR_MONETIZABLE_RESTRICTED" | "CREATOR_MONETIZABLE_WHITEGLOVE" | "CREATOR_STORE_PAGE" | "DISCOVERABLE" | "ENABLED_DISCOVERABLE_BEFORE" | "ENABLED_MODERATION_EXPERIENCE_FOR_NON_COMMUNITY" | "ENHANCED_ROLE_COLORS" | "EXPOSED_TO_ACTIVITIES_WTP_EXPERIMENT" | "FEATURABLE" | "FORWARDING_DISABLED" | "GAME_SERVERS" | "GUILD_HOME_DEPRECATION_OVERRIDE" | "GUILD_HOME_OVERRIDE" | "GUILD_HOME_TEST" | "GUILD_ONBOARDING" | "GUILD_ONBOARDING_EVER_ENABLED" | "GUILD_ONBOARDING_HAS_PROMPTS" | "GUILD_PRODUCTS_ALLOW_ARCHIVED_FILE" | "GUILD_SERVER_GUIDE" | "GUILD_TAGS" | "GUILD_TAGS_BADGE_PACK_FLEX" | "GUILD_TAGS_BADGE_PACK_PETS" | "GUILD_WEB_PAGE_VANITY_URL" | "HAS_DIRECTORY_ENTRY" | "HUB" | "INTERNAL_EMPLOYEE_ONLY" | "INVITES_DISABLED" | "INVITE_SPLASH" | "LINKED_TO_HUB" | "MAX_FILE_SIZE_100_MB" | "MAX_FILE_SIZE_50_MB" | "MEMBER_VERIFICATION_GATE_ENABLED" | "MEMBER_VERIFICATION_MANUAL_APPROVAL" | "MEMBER_VERIFICATION_ROLLOUT_TEST" | "MORE_EMOJI" | "MORE_SOUNDBOARD" | "MORE_STICKERS" | "NEWS" | "NEW_THREAD_PERMISSIONS" | "NON_COMMUNITY_RAID_ALERTS" | "PARTNERED" | "PIN_PERMISSION_MIGRATION_COMPLETE" | "PREMIUM_TIER_3_OVERRIDE" | "PREVIEW_ENABLED" | "PRODUCTS_AVAILABLE_FOR_PURCHASE" | "RAID_ALERTS_DISABLED" | "RELAY_ENABLED" | "REPORT_TO_MOD_PILOT" | "REPORT_TO_MOD_SURVEY" | "ROLE_ICONS" | "ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE" | "ROLE_SUBSCRIPTIONS_ENABLED" | "SOCIAL_LAYER_STOREFRONT" | "SOUNDBOARD" | "SUMMARIES_ENABLED_BY_USER" | "SUMMARIES_ENABLED_GA" | "SUMMARIES_OPT_OUT_EXPERIENCE" | "TEXT_IN_STAGE_ENABLED" | "TEXT_IN_VOICE_ENABLED" | "THREADS_ENABLED" | "THREADS_ENABLED_TESTING" | "TIERLESS_BOOSTING_SYSTEM_MESSAGE" | "VANITY_URL" | "VERIFIED" | "VIDEO_BITRATE_ENHANCED" | "VIP_REGIONS" | "WELCOME_SCREEN_ENABLED";
|
||||
export type GuildPremiumFeatures =
|
||||
"ANIMATED_ICON" | "STAGE_CHANNEL_VIEWERS_150" | "ROLE_ICONS" | "GUILD_TAGS" | "BANNER" | "MAX_FILE_SIZE_50_MB" | "VIDEO_QUALITY_720_60FPS" | "STAGE_CHANNEL_VIEWERS_50" | "VIDEO_QUALITY_1080_60FPS" | "MAX_FILE_SIZE_100_MB" | "VANITY_URL" | "VIDEO_BITRATE_ENHANCED" | "STAGE_CHANNEL_VIEWERS_300" | "AUDIO_BITRATE_128_KBPS" | "ANIMATED_BANNER" | "TIERLESS_BOOSTING" | "ENHANCED_ROLE_COLORS" | "INVITE_SPLASH" | "AUDIO_BITRATE_256_KBPS" | "AUDIO_BITRATE_384_KBPS";
|
||||
|
||||
|
|
@ -11,20 +20,15 @@ export class Guild extends DiscordRecord {
|
|||
constructor(guild: object);
|
||||
afkChannelId: string | undefined;
|
||||
afkTimeout: number;
|
||||
applicationCommandCounts: {
|
||||
0: number;
|
||||
1: number;
|
||||
2: number;
|
||||
};
|
||||
application_id: unknown;
|
||||
application_id: string | null;
|
||||
banner: string | undefined;
|
||||
defaultMessageNotifications: number;
|
||||
defaultMessageNotifications: GuildDefaultMessageNotifications;
|
||||
description: string | undefined;
|
||||
discoverySplash: string | undefined;
|
||||
explicitContentFilter: number;
|
||||
explicitContentFilter: GuildExplicitContentFilter;
|
||||
features: Set<GuildFeatures>;
|
||||
homeHeader: string | undefined;
|
||||
hubType: unknown;
|
||||
hubType: number | null;
|
||||
icon: string | undefined;
|
||||
id: string;
|
||||
joinedAt: Date;
|
||||
|
|
@ -32,10 +36,13 @@ export class Guild extends DiscordRecord {
|
|||
maxMembers: number;
|
||||
maxStageVideoChannelUsers: number;
|
||||
maxVideoChannelUsers: number;
|
||||
mfaLevel: number;
|
||||
moderatorReporting: unknown;
|
||||
mfaLevel: GuildMFALevel;
|
||||
moderatorReporting: {
|
||||
moderatorReportingEnabled: boolean;
|
||||
moderatorReportChannelId: string;
|
||||
} | null;
|
||||
name: string;
|
||||
nsfwLevel: number;
|
||||
nsfwLevel: GuildNSFWLevel;
|
||||
ownerConfiguredContentLevel: number;
|
||||
ownerId: string;
|
||||
preferredLocale: string;
|
||||
|
|
@ -47,18 +54,25 @@ export class Guild extends DiscordRecord {
|
|||
};
|
||||
premiumProgressBarEnabled: boolean;
|
||||
premiumSubscriberCount: number;
|
||||
premiumTier: 0 | 1 | 2 | 3;
|
||||
premiumTier: GuildPremiumTier;
|
||||
profile: {
|
||||
badge: string | undefined;
|
||||
tag: string | undefined;
|
||||
} | undefined;
|
||||
publicUpdatesChannelId: string | undefined;
|
||||
roles: Record<string, Role>;
|
||||
rulesChannelId: string | undefined;
|
||||
safetyAlertsChannelId: string | undefined;
|
||||
splash: string | undefined;
|
||||
systemChannelFlags: number;
|
||||
systemChannelFlags: SystemChannelFlags;
|
||||
systemChannelId: string | undefined;
|
||||
vanityURLCode: string | undefined;
|
||||
verificationLevel: number;
|
||||
verificationLevel: GuildVerificationLevel;
|
||||
}
|
||||
|
||||
export interface RoleOrUserPermission {
|
||||
type: PermissionOverwriteType;
|
||||
id?: string;
|
||||
permissions?: bigint;
|
||||
overwriteAllow?: bigint;
|
||||
overwriteDeny?: bigint;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,30 @@
|
|||
import { GuildMemberFlags } from "../../enums";
|
||||
import { Collectibles, DisplayNameStyles } from "./Channel";
|
||||
|
||||
export interface GuildMember {
|
||||
avatar: string | undefined;
|
||||
avatarDecoration: string | undefined;
|
||||
banner: string | undefined;
|
||||
bio: string;
|
||||
avatar: string | null | undefined;
|
||||
avatarDecoration: string | null | undefined;
|
||||
collectibles: Collectibles | null;
|
||||
colorRoleId: string | undefined;
|
||||
colorString: string;
|
||||
colorString: string | undefined;
|
||||
colorStrings: {
|
||||
primaryColor: string | undefined;
|
||||
secondaryColor: string | undefined;
|
||||
tertiaryColor: string | undefined;
|
||||
};
|
||||
communicationDisabledUntil: string | undefined;
|
||||
flags: number;
|
||||
fullProfileLoadedTimestamp: number;
|
||||
} | null;
|
||||
communicationDisabledUntil: string | null | undefined;
|
||||
displayNameStyles: DisplayNameStyles | null;
|
||||
flags: GuildMemberFlags;
|
||||
fullProfileLoadedTimestamp: number | undefined;
|
||||
guildId: string;
|
||||
highestRoleId: string;
|
||||
hoistRoleId: string;
|
||||
iconRoleId: string;
|
||||
highestRoleId: string | undefined;
|
||||
hoistRoleId: string | undefined;
|
||||
iconRoleId: string | undefined;
|
||||
isPending: boolean | undefined;
|
||||
joinedAt: string | undefined;
|
||||
nick: string | undefined;
|
||||
premiumSince: string | undefined;
|
||||
nick: string | null | undefined;
|
||||
premiumSince: string | null | undefined;
|
||||
roles: string[];
|
||||
unusualDMActivityUntil: string | undefined;
|
||||
userId: string;
|
||||
}
|
||||
|
|
|
|||
24
packages/discord-types/src/common/Role.d.ts
vendored
24
packages/discord-types/src/common/Role.d.ts
vendored
|
|
@ -1,3 +1,5 @@
|
|||
import { RoleFlags } from "../../enums";
|
||||
|
||||
export interface Role {
|
||||
color: number;
|
||||
colorString: string | undefined;
|
||||
|
|
@ -11,23 +13,25 @@ export interface Role {
|
|||
secondary_color: number | undefined;
|
||||
tertiary_color: number | undefined;
|
||||
};
|
||||
flags: number;
|
||||
description: string | null;
|
||||
flags: RoleFlags;
|
||||
guildId: string;
|
||||
hoist: boolean;
|
||||
icon: string | undefined;
|
||||
icon: string | null;
|
||||
id: string;
|
||||
managed: boolean;
|
||||
mentionable: boolean;
|
||||
name: string;
|
||||
originalPosition: number;
|
||||
permissions: bigint;
|
||||
position: number;
|
||||
/**
|
||||
* probably incomplete
|
||||
*/
|
||||
tags: {
|
||||
bot_id: string;
|
||||
integration_id: string;
|
||||
premium_subscriber: unknown;
|
||||
bot_id?: string;
|
||||
integration_id?: string;
|
||||
premium_subscriber?: null;
|
||||
subscription_listing_id?: string;
|
||||
available_for_purchase?: null;
|
||||
guild_connections?: null;
|
||||
} | undefined;
|
||||
unicodeEmoji: string | undefined;
|
||||
unicodeEmoji: string | null;
|
||||
version: number | undefined;
|
||||
}
|
||||
|
|
|
|||
53
packages/discord-types/src/common/User.d.ts
vendored
53
packages/discord-types/src/common/User.d.ts
vendored
|
|
@ -1,66 +1,85 @@
|
|||
// TODO: a lot of optional params can also be null, not just undef
|
||||
|
||||
import { DiscordRecord } from "./Record";
|
||||
import { AvatarDecorationData, ClanData, Collectibles, DisplayNameStyles } from "./Channel";
|
||||
import { PremiumType, UserFlags } from "../../enums";
|
||||
|
||||
export class User extends DiscordRecord {
|
||||
constructor(user: object);
|
||||
accentColor: number;
|
||||
ageVerificationStatus: number;
|
||||
avatar: string;
|
||||
avatarDecorationData: AvatarDecorationData | null;
|
||||
banner: string | null | undefined;
|
||||
bio: string;
|
||||
bot: boolean;
|
||||
collectibles: Collectibles | null;
|
||||
desktop: boolean;
|
||||
discriminator: string;
|
||||
displayNameStyles: DisplayNameStyles | null;
|
||||
email: string | undefined;
|
||||
flags: number;
|
||||
flags: UserFlags;
|
||||
globalName: string | undefined;
|
||||
guildMemberAvatars: Record<string, string>;
|
||||
hasBouncedEmail: boolean;
|
||||
id: string;
|
||||
mfaEnabled: boolean;
|
||||
mobile: boolean;
|
||||
nsfwAllowed: boolean | undefined;
|
||||
personalConnectionId: string | null;
|
||||
phone: string | undefined;
|
||||
premiumType: number | undefined;
|
||||
premiumState: { subscriptionId: string; } | null;
|
||||
premiumType: PremiumType | undefined;
|
||||
premiumUsageFlags: number;
|
||||
publicFlags: number;
|
||||
primaryGuild: ClanData | null;
|
||||
publicFlags: UserFlags;
|
||||
purchasedFlags: number;
|
||||
system: boolean;
|
||||
username: string;
|
||||
verified: boolean;
|
||||
|
||||
get avatarDecoration(): AvatarDecorationData | null;
|
||||
get createdAt(): Date;
|
||||
get hasPremiumPerks(): boolean;
|
||||
get isProvisional(): boolean;
|
||||
get nameplate(): { asset: string; sku_id: string; } | null;
|
||||
get premiumGroupRole(): { id: string; name: string; color: number; } | null;
|
||||
get tag(): string;
|
||||
get usernameNormalized(): string;
|
||||
|
||||
addGuildAvatarHash(guildId: string, avatarHash: string): User;
|
||||
getAvatarSource(guildId: string, canAnimate?: boolean): { uri: string; };
|
||||
getAvatarURL(guildId?: string | null, t?: unknown, canAnimate?: boolean): string;
|
||||
addGuildAvatarHash(guildId: string, avatarHash: string): this;
|
||||
getAvatarSource(guildId: string): { uri: string; };
|
||||
getAvatarURL(guildId?: string | null, size?: number, canAnimate?: boolean, format?: string): string;
|
||||
hadPremiumSubscription(): boolean;
|
||||
hasAvatarForGuild(guildId: string): boolean;
|
||||
hasDisabledPremium(): boolean;
|
||||
hasFlag(flag: number): boolean;
|
||||
hasFlag(flag: UserFlags): boolean;
|
||||
hasFreePremium(): boolean;
|
||||
hasHadSKU(e: unknown): boolean;
|
||||
hasHadPremium(): boolean;
|
||||
hasHadSKU(sku: string): boolean;
|
||||
hasPremiumUsageFlag(flag: number): boolean;
|
||||
hasPurchasedFlag(flag: number): boolean;
|
||||
hasUniqueUsername(): boolean;
|
||||
hasUrgentMessages(): boolean;
|
||||
hasVerifiedEmailOrPhone(): boolean;
|
||||
isClaimed(): boolean;
|
||||
isFractionalPremiumWithNoSubscription(): boolean;
|
||||
isLocalBot(): boolean;
|
||||
isNonUserBot(): boolean;
|
||||
isPhoneVerified(): boolean;
|
||||
isStaff(): boolean;
|
||||
isPremiumGroupMember(): boolean;
|
||||
isPremiumGroupPrimary(): boolean;
|
||||
isPremiumWithFractionalPremiumOnly(): boolean;
|
||||
isPremiumWithPremiumGroup(): boolean;
|
||||
isSystemUser(): boolean;
|
||||
isVerifiedBot(): boolean;
|
||||
removeGuildAvatarHash(guildId: string): User;
|
||||
removeGuildAvatarHash(guildId: string): this;
|
||||
toJS(): object;
|
||||
toString(): string;
|
||||
update(props: Partial<User>): this;
|
||||
}
|
||||
|
||||
export interface UserJSON {
|
||||
avatar: string;
|
||||
avatarDecoration: unknown | undefined;
|
||||
avatarDecoration: AvatarDecorationData | null;
|
||||
discriminator: string;
|
||||
id: string;
|
||||
publicFlags: number;
|
||||
publicFlags: UserFlags;
|
||||
username: string;
|
||||
globalName: string | undefined;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +1,74 @@
|
|||
export type EmbedType =
|
||||
| "image"
|
||||
| "video"
|
||||
| "link"
|
||||
| "article"
|
||||
| "tweet"
|
||||
| "rich"
|
||||
| "gifv"
|
||||
| "application_news"
|
||||
| "auto_moderation_message"
|
||||
| "auto_moderation_notification"
|
||||
| "text"
|
||||
| "post_preview"
|
||||
| "gift"
|
||||
| "safety_policy_notice"
|
||||
| "safety_system_notification"
|
||||
| "age_verification_system_notification"
|
||||
| "voice_channel"
|
||||
| "gaming_profile"
|
||||
| "poll_result";
|
||||
|
||||
export interface EmbedMedia {
|
||||
height: number;
|
||||
width: number;
|
||||
url: string;
|
||||
proxyURL: string;
|
||||
placeholder: string;
|
||||
placeholderVersion: number;
|
||||
description: string;
|
||||
srcIsAnimated: boolean;
|
||||
flags: number;
|
||||
contentType: string;
|
||||
}
|
||||
|
||||
export interface EmbedField {
|
||||
rawName: string;
|
||||
rawValue: string;
|
||||
inline: boolean;
|
||||
}
|
||||
|
||||
export interface Embed {
|
||||
id: string;
|
||||
url: string;
|
||||
type: EmbedType;
|
||||
rawTitle: string;
|
||||
rawDescription: string;
|
||||
referenceId: string | undefined;
|
||||
flags: number | undefined;
|
||||
contentScanVersion: number;
|
||||
author?: {
|
||||
name: string;
|
||||
url: string;
|
||||
iconURL: string | undefined;
|
||||
iconProxyURL: string | undefined;
|
||||
};
|
||||
color: string;
|
||||
fields: [];
|
||||
id: string;
|
||||
image?: {
|
||||
height: number;
|
||||
width: number;
|
||||
url: string;
|
||||
proxyURL: string;
|
||||
footer?: {
|
||||
text: string;
|
||||
iconURL: string | undefined;
|
||||
iconProxyURL: string | undefined;
|
||||
};
|
||||
provider?: {
|
||||
name: string;
|
||||
url: string | undefined;
|
||||
};
|
||||
rawDescription: string;
|
||||
rawTitle: string;
|
||||
referenceId: unknown;
|
||||
timestamp: string;
|
||||
thumbnail?: {
|
||||
height: number;
|
||||
proxyURL: string | undefined;
|
||||
url: string;
|
||||
width: number;
|
||||
};
|
||||
type: string;
|
||||
url: string | undefined;
|
||||
video?: {
|
||||
height: number;
|
||||
width: number;
|
||||
url: string;
|
||||
proxyURL: string | undefined;
|
||||
};
|
||||
timestamp?: Date;
|
||||
color: string;
|
||||
thumbnail?: EmbedMedia;
|
||||
image?: EmbedMedia;
|
||||
images?: EmbedMedia[];
|
||||
video?: EmbedMedia;
|
||||
fields: EmbedField[];
|
||||
}
|
||||
|
||||
export interface EmbedJSON {
|
||||
|
|
@ -48,7 +81,7 @@ export interface EmbedJSON {
|
|||
title: string;
|
||||
color: string;
|
||||
description: string;
|
||||
type: string;
|
||||
type: EmbedType;
|
||||
url: string | undefined;
|
||||
provider?: {
|
||||
name: string;
|
||||
|
|
|
|||
|
|
@ -2,60 +2,135 @@ import { CommandOption } from './Commands';
|
|||
import { User, UserJSON } from '../User';
|
||||
import { Embed, EmbedJSON } from './Embed';
|
||||
import { DiscordRecord } from "../Record";
|
||||
import { ApplicationIntegrationType, MessageFlags, MessageType, StickerFormatType } from "../../../enums";
|
||||
import { ApplicationCommandOptionType, ApplicationCommandType, ApplicationIntegrationType, ButtonStyle, ComponentType, InteractionType, MessageActivityType, MessageFlags, MessageReferenceType, MessageType, PollLayoutType, StickerFormatType } from "../../../enums";
|
||||
|
||||
export type MessageState = "SENT" | "SENDING" | "SEND_FAILED";
|
||||
|
||||
export type CodedLinkType =
|
||||
| "INVITE"
|
||||
| "TEMPLATE"
|
||||
| "BUILD_OVERRIDE"
|
||||
| "MANUAL_BUILD_OVERRIDE"
|
||||
| "EXPERIMENT"
|
||||
| "EVENT"
|
||||
| "CHANNEL_LINK"
|
||||
| "APP_DIRECTORY_PROFILE"
|
||||
| "APP_DIRECTORY_STOREFRONT"
|
||||
| "APP_DIRECTORY_STOREFRONT_SKU"
|
||||
| "APP_OAUTH2_LINK"
|
||||
| "ACTIVITY_BOOKMARK"
|
||||
| "EMBEDDED_ACTIVITY_INVITE"
|
||||
| "GUILD_PRODUCT"
|
||||
| "SERVER_SHOP"
|
||||
| "SOCIAL_LAYER_STOREFRONT"
|
||||
| "QUESTS_EMBED"
|
||||
| "COLLECTIBLES_SHOP";
|
||||
|
||||
export interface MessageActivity {
|
||||
type: MessageActivityType;
|
||||
party_id?: string;
|
||||
}
|
||||
|
||||
export interface PollMedia {
|
||||
text?: string;
|
||||
emoji?: ReactionEmoji;
|
||||
}
|
||||
|
||||
export interface PollAnswer {
|
||||
answer_id: number;
|
||||
poll_media: PollMedia;
|
||||
}
|
||||
|
||||
export interface Poll {
|
||||
question: PollMedia;
|
||||
answers: PollAnswer[];
|
||||
expiry: string;
|
||||
allow_multiselect: boolean;
|
||||
layout_type: PollLayoutType;
|
||||
}
|
||||
|
||||
export interface RoleSubscriptionData {
|
||||
role_subscription_listing_id: string;
|
||||
tier_name: string;
|
||||
total_months_subscribed: number;
|
||||
is_renewal: boolean;
|
||||
}
|
||||
|
||||
export interface MessageComponent {
|
||||
type: ComponentType;
|
||||
id?: string;
|
||||
custom_id?: string;
|
||||
disabled?: boolean;
|
||||
style?: ButtonStyle;
|
||||
label?: string;
|
||||
emoji?: ReactionEmoji;
|
||||
url?: string;
|
||||
options?: { label: string; value: string; description?: string; emoji?: ReactionEmoji; default?: boolean; }[];
|
||||
placeholder?: string;
|
||||
min_values?: number;
|
||||
max_values?: number;
|
||||
components?: MessageComponent[];
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: looks like discord has moved over to Date instead of Moment;
|
||||
*/
|
||||
export class Message extends DiscordRecord {
|
||||
constructor(message: object);
|
||||
activity: unknown;
|
||||
application: unknown;
|
||||
applicationId: string | unknown;
|
||||
activity: MessageActivity | null;
|
||||
activityInstance: { applicationId: string; instanceId: string; } | null;
|
||||
application: { id: string; name: string; icon: string | null; } | null;
|
||||
applicationId: string | null;
|
||||
attachments: MessageAttachment[];
|
||||
author: User;
|
||||
blocked: boolean;
|
||||
bot: boolean;
|
||||
call: {
|
||||
duration: moment.Duration;
|
||||
endedTimestamp: moment.Moment;
|
||||
duration: number | null;
|
||||
endedTimestamp: Date | null;
|
||||
participants: string[];
|
||||
};
|
||||
} | null;
|
||||
changelogId: string | null;
|
||||
channel_id: string;
|
||||
/**
|
||||
* NOTE: not fully typed
|
||||
*/
|
||||
codedLinks: {
|
||||
code?: string;
|
||||
type: string;
|
||||
type: CodedLinkType;
|
||||
}[];
|
||||
colorString: unknown;
|
||||
components: unknown[];
|
||||
colorString: string | null;
|
||||
components: MessageComponent[];
|
||||
content: string;
|
||||
customRenderedContent: unknown;
|
||||
editedTimestamp: Date;
|
||||
customRenderedContent: {
|
||||
content: React.ReactNode;
|
||||
[key: string]: unknown;
|
||||
} | null;
|
||||
editedTimestamp: Date | null;
|
||||
embeds: Embed[];
|
||||
flags: MessageFlags;
|
||||
giftCodes: string[];
|
||||
giftInfo: { sku_id: string; slug: string; } | null;
|
||||
giftingPrompt: { recipientUserId: string; } | null;
|
||||
id: string;
|
||||
interaction: {
|
||||
id: string;
|
||||
name: string;
|
||||
type: number;
|
||||
type: InteractionType;
|
||||
user: User;
|
||||
}[] | undefined;
|
||||
}[] | null;
|
||||
interactionData: {
|
||||
application_command: {
|
||||
application_id: string;
|
||||
default_member_permissions: unknown;
|
||||
default_member_permissions: string | null;
|
||||
default_permission: boolean;
|
||||
description: string;
|
||||
dm_permission: unknown;
|
||||
dm_permission: boolean | null;
|
||||
id: string;
|
||||
name: string;
|
||||
options: CommandOption[];
|
||||
permissions: unknown[];
|
||||
type: number;
|
||||
permissions: string[];
|
||||
type: ApplicationCommandType;
|
||||
version: string;
|
||||
};
|
||||
attachments: MessageAttachment[];
|
||||
|
|
@ -63,19 +138,19 @@ export class Message extends DiscordRecord {
|
|||
id: string;
|
||||
name: string;
|
||||
options: {
|
||||
focused: unknown;
|
||||
focused: boolean | undefined;
|
||||
name: string;
|
||||
type: number;
|
||||
type: ApplicationCommandOptionType;
|
||||
value: string;
|
||||
}[];
|
||||
type: number;
|
||||
type: InteractionType;
|
||||
version: string;
|
||||
}[];
|
||||
interactionMetadata?: {
|
||||
}[] | null;
|
||||
interactionMetadata: {
|
||||
id: string;
|
||||
type: number;
|
||||
type: InteractionType;
|
||||
name?: string;
|
||||
command_type?: number;
|
||||
command_type?: ApplicationCommandType;
|
||||
ephemerality_reason?: number;
|
||||
user: User;
|
||||
authorizing_integration_owners: Record<ApplicationIntegrationType, string>;
|
||||
|
|
@ -83,16 +158,20 @@ export class Message extends DiscordRecord {
|
|||
interacted_message_id?: string;
|
||||
target_user?: User;
|
||||
target_message_id?: string;
|
||||
};
|
||||
interactionError: unknown[];
|
||||
} | null;
|
||||
interactionError: string[] | null;
|
||||
ignored: boolean;
|
||||
isSearchHit: boolean;
|
||||
loggingName: unknown;
|
||||
isUnsupported: boolean;
|
||||
loggingName: string | null;
|
||||
mentionChannels: string[];
|
||||
mentionEveryone: boolean;
|
||||
mentionGames: { id: string; name: string; }[];
|
||||
mentionRoles: string[];
|
||||
mentioned: boolean;
|
||||
mentions: string[];
|
||||
messageReference: {
|
||||
type?: MessageReferenceType;
|
||||
guild_id?: string;
|
||||
channel_id: string;
|
||||
message_id: string;
|
||||
|
|
@ -100,18 +179,26 @@ export class Message extends DiscordRecord {
|
|||
messageSnapshots: {
|
||||
message: Message;
|
||||
}[];
|
||||
nick: unknown; // probably a string
|
||||
nick: string | null;
|
||||
nonce: string | undefined;
|
||||
pinned: boolean;
|
||||
poll: Poll | null;
|
||||
potions: { id: string; expiresAt: string; }[];
|
||||
premiumGroupInviteId: string | null;
|
||||
purchaseNotification: { type: number; guild_product_purchase?: { product_name: string; }; } | null;
|
||||
reactions: MessageReaction[];
|
||||
state: string;
|
||||
referralTrialOfferId: string | null;
|
||||
roleSubscriptionData: RoleSubscriptionData | null;
|
||||
sharedClientTheme: { primary_color: number; secondary_color: number; } | null;
|
||||
soundboardSounds: { sound_id: string; volume: number; emoji_id?: string; emoji_name?: string; }[];
|
||||
state: MessageState;
|
||||
stickerItems: {
|
||||
format_type: StickerFormatType;
|
||||
id: string;
|
||||
name: string;
|
||||
}[];
|
||||
stickers: unknown[];
|
||||
timestamp: moment.Moment;
|
||||
stickers: { id: string; name: string; format_type: StickerFormatType; }[];
|
||||
timestamp: Date;
|
||||
tts: boolean;
|
||||
type: MessageType;
|
||||
webhookId: string | undefined;
|
||||
|
|
@ -134,10 +221,18 @@ export class Message extends DiscordRecord {
|
|||
removeReaction(emoji: ReactionEmoji, fromCurrentUser: boolean): Message;
|
||||
|
||||
getChannelId(): string;
|
||||
getContentMessage(): Message;
|
||||
hasFlag(flag: MessageFlags): boolean;
|
||||
hasPotions(): boolean;
|
||||
isCommandType(): boolean;
|
||||
isEdited(): boolean;
|
||||
isFirstMessageInForumPost(channel: unknown): boolean;
|
||||
isInteractionPlaceholder(): boolean;
|
||||
isPoll(): boolean;
|
||||
isSystemDM(): boolean;
|
||||
canDeleteOwnMessage(userId: string): boolean;
|
||||
userHasReactedWithEmoji(emoji: ReactionEmoji, burst?: boolean): boolean;
|
||||
addReactionBatch(reactions: { emoji: ReactionEmoji; users: string[]; }[], burstReactions: { emoji: ReactionEmoji; users: string[]; }[]): Message;
|
||||
|
||||
/** Vencord added */
|
||||
deleted?: boolean;
|
||||
|
|
@ -148,14 +243,14 @@ export interface MessageJSON {
|
|||
attachments: MessageAttachment[];
|
||||
author: UserJSON;
|
||||
channel_id: string;
|
||||
components: unknown[];
|
||||
components: MessageComponent[];
|
||||
content: string;
|
||||
edited_timestamp: string;
|
||||
embeds: EmbedJSON[];
|
||||
flags: number;
|
||||
flags: MessageFlags;
|
||||
guild_id: string | undefined;
|
||||
id: string;
|
||||
loggingName: unknown;
|
||||
loggingName: string | null;
|
||||
member: {
|
||||
avatar: string | undefined;
|
||||
communication_disabled_until: string | undefined;
|
||||
|
|
@ -180,10 +275,10 @@ export interface MessageJSON {
|
|||
nonce: string | undefined;
|
||||
pinned: boolean;
|
||||
referenced_message: MessageJSON | undefined;
|
||||
state: string;
|
||||
state: MessageState;
|
||||
timestamp: string;
|
||||
tts: boolean;
|
||||
type: number;
|
||||
type: MessageType;
|
||||
}
|
||||
|
||||
export interface MessageAttachment {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { StickerFormatType, StickerType } from "../../../enums";
|
||||
|
||||
interface BaseSticker {
|
||||
asset: string;
|
||||
asset?: string;
|
||||
available: boolean;
|
||||
description: string;
|
||||
format_type: StickerFormatType;
|
||||
|
|
|
|||
|
|
@ -4,17 +4,20 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { GuildMemberFlags } from "../enums";
|
||||
import { VoiceState } from "./stores";
|
||||
|
||||
export type PassiveUpdateType = "PASSIVE_UPDATE_V2";
|
||||
|
||||
export interface PassiveUpdateState {
|
||||
type: string;
|
||||
type: PassiveUpdateType;
|
||||
guildId: string;
|
||||
members?: ({
|
||||
user: {
|
||||
avatar: null | string;
|
||||
communication_disabled_until: null | string;
|
||||
deaf: boolean;
|
||||
flags: number;
|
||||
flags: GuildMemberFlags;
|
||||
joined_at: string;
|
||||
mute: boolean;
|
||||
nick: string;
|
||||
|
|
@ -27,7 +30,7 @@ export interface PassiveUpdateState {
|
|||
nick: string | null;
|
||||
mute: boolean;
|
||||
joined_at: string;
|
||||
flags: number;
|
||||
flags: GuildMemberFlags;
|
||||
deaf: boolean;
|
||||
communication_disabled_until: null | string;
|
||||
avatar: null | string;
|
||||
|
|
|
|||
|
|
@ -4,12 +4,13 @@ export type ReducedMotionPreference = "auto" | "reduce" | "no-preference";
|
|||
export type ForcedColorsPreference = "none" | "active";
|
||||
export type ContrastPreference = "no-preference" | "more" | "less" | "custom";
|
||||
export type RoleStyle = "username" | "dot" | "hidden";
|
||||
export type ContrastMode = "default" | "high";
|
||||
|
||||
export interface AccessibilityState {
|
||||
fontSize: number;
|
||||
zoom: number;
|
||||
keyboardModeEnabled: boolean;
|
||||
contrastMode: string;
|
||||
contrastMode: ContrastMode;
|
||||
colorblindMode: boolean;
|
||||
lowContrastMode: boolean;
|
||||
saturation: number;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { Application, FluxStore } from "..";
|
||||
import { ApplicationType } from "../../enums";
|
||||
|
||||
export interface ApplicationStoreState {
|
||||
botUserIdToAppUsage: Record<string, ApplicationUsage>;
|
||||
|
|
@ -10,11 +11,12 @@ export interface ApplicationUsage {
|
|||
}
|
||||
|
||||
export class ApplicationStore extends FluxStore {
|
||||
_getAllApplications(): Application[];
|
||||
getState(): ApplicationStoreState;
|
||||
getApplication(applicationId: string): Application;
|
||||
getApplicationByName(name: string): Application | undefined;
|
||||
getApplicationLastUpdated(applicationId: string): number | undefined;
|
||||
getGuildApplication(guildId: string, type: number): Application | undefined;
|
||||
getGuildApplication(guildId: string, type: ApplicationType): Application | undefined;
|
||||
getGuildApplicationIds(guildId: string): string[];
|
||||
getAppIdForBotUserId(botUserId: string): string | undefined;
|
||||
getFetchingOrFailedFetchingIds(): string[];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { FluxStore, User, VoiceState } from "..";
|
||||
import { ParticipantType, RTCPlatform } from "../../enums";
|
||||
import { AvatarDecorationData, FluxStore, User, VoiceState } from "..";
|
||||
import { ActivityType, ParticipantType, RTCPlatform } from "../../enums";
|
||||
import { StreamType } from "./FriendsStore";
|
||||
|
||||
export type RTCLayout = "normal" | "minimum" | "no-chat" | "full-screen" | "haven";
|
||||
export type RTCMode = "video" | "voice";
|
||||
|
|
@ -15,7 +16,7 @@ export interface Stream {
|
|||
channelId: string;
|
||||
guildId: string | null;
|
||||
ownerId: string;
|
||||
streamType: string;
|
||||
streamType: StreamType;
|
||||
}
|
||||
|
||||
export interface BaseParticipant {
|
||||
|
|
@ -36,8 +37,7 @@ export interface UserParticipant extends BaseParticipant {
|
|||
soundsharing: boolean;
|
||||
ringing: boolean;
|
||||
userNick: string;
|
||||
// TODO: type
|
||||
userAvatarDecoration: any | null;
|
||||
userAvatarDecoration: AvatarDecorationData | null;
|
||||
localVideoDisabled: boolean;
|
||||
userVideo?: boolean;
|
||||
streamId?: string;
|
||||
|
|
@ -57,7 +57,7 @@ export interface StreamParticipant extends BaseParticipant {
|
|||
export interface ActivityParticipant extends BaseParticipant {
|
||||
type: ParticipantType.ACTIVITY;
|
||||
applicationId: string;
|
||||
activityType: number;
|
||||
activityType: ActivityType;
|
||||
activityUrl: string;
|
||||
participants: string[];
|
||||
guildId: string | null;
|
||||
|
|
|
|||
|
|
@ -1,31 +1,111 @@
|
|||
import { Channel, FluxStore } from "..";
|
||||
|
||||
/** Debug info for channel store state. */
|
||||
export interface ChannelStoreDebugInfo {
|
||||
/** Guild IDs that have been loaded. */
|
||||
loadedGuildIds: string[];
|
||||
/** Guild IDs currently being loaded. */
|
||||
pendingGuildLoads: string[];
|
||||
/** String descriptions of guild channel counts. */
|
||||
guildSizes: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Flux store managing all channel data including guild channels,
|
||||
* threads, DMs, and group DMs.
|
||||
*/
|
||||
export class ChannelStore extends FluxStore {
|
||||
/**
|
||||
* Gets a channel by ID.
|
||||
* @param channelId Channel ID to look up.
|
||||
*/
|
||||
getChannel(channelId: string): Channel;
|
||||
/**
|
||||
* Gets basic channel info by ID, returns undefined if not found.
|
||||
* @param channelId Channel ID to look up.
|
||||
*/
|
||||
getBasicChannel(channelId: string): Channel | undefined;
|
||||
/**
|
||||
* Checks if a channel exists in the store.
|
||||
* @param channelId Channel ID to check.
|
||||
*/
|
||||
hasChannel(channelId: string): boolean;
|
||||
|
||||
/**
|
||||
* Gets all channel IDs, optionally filtered by guild.
|
||||
* @param guildId Guild ID to filter by, or null/undefined for all channels.
|
||||
*/
|
||||
getChannelIds(guildId?: string | null): string[];
|
||||
/**
|
||||
* Gets basic guild channels as a mutable record.
|
||||
* @param guildId Guild ID to get channels for.
|
||||
* @returns Record keyed by channel ID.
|
||||
*/
|
||||
getMutableBasicGuildChannelsForGuild(guildId: string): Record<string, Channel>;
|
||||
/**
|
||||
* Gets all guild channels as a mutable record.
|
||||
* @param guildId Guild ID to get channels for.
|
||||
* @returns Record keyed by channel ID.
|
||||
*/
|
||||
getMutableGuildChannelsForGuild(guildId: string): Record<string, Channel>;
|
||||
/**
|
||||
* Gets all threads for a guild.
|
||||
* @param guildId Guild ID to get threads for.
|
||||
*/
|
||||
getAllThreadsForGuild(guildId: string): Channel[];
|
||||
getAllThreadsForParent(channelId: string): Channel[];
|
||||
/**
|
||||
* Gets all threads under a parent channel.
|
||||
* @param parentChannelId Parent channel ID.
|
||||
*/
|
||||
getAllThreadsForParent(parentChannelId: string): Channel[];
|
||||
/**
|
||||
* Gets sorted linked channels for a guild, such as stage instances and events.
|
||||
* @param guildId Guild ID.
|
||||
*/
|
||||
getSortedLinkedChannelsForGuild(guildId: string): Channel[];
|
||||
|
||||
getDMFromUserId(userId: string): string;
|
||||
/**
|
||||
* Gets DM channel ID for a user.
|
||||
* @param userId User ID to get DM for.
|
||||
* @returns Channel ID, not the channel object.
|
||||
*/
|
||||
getDMFromUserId(userId: string): string | undefined;
|
||||
/**
|
||||
* Gets DM channel object for a user.
|
||||
* @param userId User ID to get DM for.
|
||||
*/
|
||||
getDMChannelFromUserId(userId: string): Channel | undefined;
|
||||
/** Gets all user IDs that have DM channels. */
|
||||
getDMUserIds(): string[];
|
||||
/**
|
||||
* Gets mutable map of user ID to DM channel ID.
|
||||
* @returns Record keyed by user ID.
|
||||
*/
|
||||
getMutableDMsByUserIds(): Record<string, string>;
|
||||
/**
|
||||
* Gets mutable map of all private channels.
|
||||
* @returns Record keyed by channel ID.
|
||||
*/
|
||||
getMutablePrivateChannels(): Record<string, Channel>;
|
||||
/** Gets private channels sorted by last message. */
|
||||
getSortedPrivateChannels(): Channel[];
|
||||
|
||||
/**
|
||||
* Gets version number for guild channels, incremented on changes.
|
||||
* @param guildId Guild ID.
|
||||
*/
|
||||
getGuildChannelsVersion(guildId: string): number;
|
||||
/** Gets version number for private channels, incremented on changes. */
|
||||
getPrivateChannelsVersion(): number;
|
||||
/**
|
||||
* Gets initial channel state for overlay rendering.
|
||||
* @returns Record keyed by channel ID.
|
||||
*/
|
||||
getInitialOverlayState(): Record<string, Channel>;
|
||||
|
||||
getDebugInfo(): {
|
||||
loadedGuildIds: string[];
|
||||
pendingGuildLoads: string[];
|
||||
guildSizes: string[];
|
||||
};
|
||||
/** Gets debug info about store state. */
|
||||
getDebugInfo(): ChannelStoreDebugInfo;
|
||||
|
||||
/** Loads all guild and private channels from disk cache. */
|
||||
loadAllGuildAndPrivateChannelsFromDisk(): Promise<void>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,13 @@ export type FriendsSection = "ADD_FRIEND" | "ALL" | "ONLINE" | "PENDING" | "PEND
|
|||
|
||||
export type StatusType = "online" | "offline" | "idle" | "dnd" | "invisible" | "streaming" | "unknown";
|
||||
|
||||
export type StreamType = "call" | "guild";
|
||||
|
||||
export interface ApplicationStream {
|
||||
channelId: string;
|
||||
guildId: string | null;
|
||||
ownerId: string;
|
||||
streamType: string;
|
||||
streamType: StreamType;
|
||||
}
|
||||
|
||||
export interface FriendsRow {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { FluxStore } from "..";
|
||||
import { GuildScheduledEventEntityType, GuildScheduledEventPrivacyLevel, GuildScheduledEventStatus } from "../../enums";
|
||||
import { GuildScheduledEventEntityType, GuildScheduledEventPrivacyLevel, GuildScheduledEventStatus, RecurrenceRuleFrequency } from "../../enums";
|
||||
|
||||
export interface GuildScheduledEventEntityMetadata {
|
||||
location?: string;
|
||||
|
|
@ -8,7 +8,7 @@ export interface GuildScheduledEventEntityMetadata {
|
|||
export interface GuildScheduledEventRecurrenceRule {
|
||||
start: string;
|
||||
end: string | null;
|
||||
frequency: number;
|
||||
frequency: RecurrenceRuleFrequency;
|
||||
interval: number;
|
||||
byWeekday: number[] | null;
|
||||
byNWeekday: { n: number; day: number; }[] | null;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,17 @@
|
|||
import { Channel, FluxStore, Guild, User } from "..";
|
||||
import { Application } from "../common/Application";
|
||||
import { GuildScheduledEvent } from "./GuildScheduledEventStore";
|
||||
import { GuildScheduledEventPrivacyLevel, InviteTargetType } from "../../enums";
|
||||
|
||||
export interface StageInstance {
|
||||
id: string;
|
||||
guild_id: string;
|
||||
channel_id: string;
|
||||
topic: string;
|
||||
privacy_level: GuildScheduledEventPrivacyLevel;
|
||||
discoverable_disabled: boolean;
|
||||
guild_scheduled_event_id: string | null;
|
||||
}
|
||||
|
||||
export interface Invite {
|
||||
code: string;
|
||||
|
|
@ -9,12 +22,11 @@ export interface Invite {
|
|||
approximate_presence_count?: number;
|
||||
expires_at?: string | null;
|
||||
flags?: number;
|
||||
target_type?: number;
|
||||
target_type?: InviteTargetType;
|
||||
target_user?: User;
|
||||
// TODO: type these
|
||||
target_application?: any;
|
||||
stage_instance?: any;
|
||||
guild_scheduled_event?: any;
|
||||
target_application?: Application;
|
||||
stage_instance?: StageInstance;
|
||||
guild_scheduled_event?: GuildScheduledEvent;
|
||||
}
|
||||
|
||||
export class InviteStore extends FluxStore {
|
||||
|
|
|
|||
|
|
@ -675,7 +675,7 @@ export interface MediaEngineConnection {
|
|||
/** whether QoS is enabled. */
|
||||
qos: boolean;
|
||||
/** current input mode. */
|
||||
inputMode: string;
|
||||
inputMode: VoiceMode;
|
||||
/** VAD threshold in dB, default -60. */
|
||||
vadThreshold: number;
|
||||
/** whether VAD auto threshold is enabled, default true. */
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
import { FluxStore } from "..";
|
||||
import { PremiumType } from "../../enums";
|
||||
|
||||
export interface OverridePremiumTypeState {
|
||||
createdAtOverride: Date | undefined;
|
||||
premiumTypeActual: number | null;
|
||||
premiumTypeOverride: number | undefined;
|
||||
premiumTypeActual: PremiumType | null;
|
||||
premiumTypeOverride: PremiumType | undefined;
|
||||
}
|
||||
|
||||
export class OverridePremiumTypeStore extends FluxStore {
|
||||
getState(): OverridePremiumTypeState;
|
||||
getCreatedAtOverride(): Date | undefined;
|
||||
getPremiumTypeActual(): number | null;
|
||||
getPremiumTypeOverride(): number | undefined;
|
||||
get premiumType(): number | undefined;
|
||||
getPremiumTypeActual(): PremiumType | null;
|
||||
getPremiumTypeOverride(): PremiumType | undefined;
|
||||
get premiumType(): PremiumType | undefined;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ export interface VoiceStateStats {
|
|||
}
|
||||
|
||||
export interface SecureFramesState {
|
||||
state: string;
|
||||
version: number;
|
||||
epochAuthenticator: string;
|
||||
}
|
||||
|
||||
export interface SecureFramesRosterMapEntry {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { FluxStore } from "..";
|
||||
import { Message, MessageJSON } from "../common/messages";
|
||||
import { RelationshipType } from "../../enums";
|
||||
|
||||
export class RelationshipStore extends FluxStore {
|
||||
|
|
@ -24,18 +25,18 @@ export class RelationshipStore extends FluxStore {
|
|||
getVersion(): number;
|
||||
|
||||
isBlocked(userId: string): boolean;
|
||||
isBlockedForMessage(userId: string): boolean;
|
||||
isBlockedForMessage(message: Message | MessageJSON): boolean;
|
||||
|
||||
/**
|
||||
* @see {@link isBlocked}
|
||||
* @see {@link isIgnored}
|
||||
*/
|
||||
isBlockedOrIgnored(userId: string): boolean;
|
||||
isBlockedOrIgnoredForMessage(userId: string): boolean;
|
||||
isBlockedOrIgnoredForMessage(message: Message | MessageJSON): boolean;
|
||||
|
||||
isFriend(userId: string): boolean;
|
||||
isIgnored(userId: string): boolean;
|
||||
isIgnoredForMessage(userId: string): boolean;
|
||||
isIgnoredForMessage(message: Message | MessageJSON): boolean;
|
||||
isSpam(userId: string): boolean;
|
||||
isStranger(userId: string): boolean;
|
||||
isUnfilteredPendingIncoming(userId: string): boolean;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,10 @@ export interface GameOverlayStatus {
|
|||
enabledOOP: boolean;
|
||||
}
|
||||
|
||||
export type SystemServiceState = "unknown" | "running" | "stopped" | "error";
|
||||
|
||||
export interface SystemServiceStatus {
|
||||
state: string;
|
||||
state: SystemServiceState;
|
||||
}
|
||||
|
||||
export class RunningGameStore extends FluxStore {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
import { FluxStore } from "..";
|
||||
import { ActivityFlags } from "../../enums";
|
||||
|
||||
export type SpotifyDeviceType = "computer" | "smartphone" | "speaker" | "tv" | "game_console" | "automobile" | "unknown";
|
||||
export type SpotifyMediaType = "track" | "episode";
|
||||
export type SpotifyAlbumType = "album" | "single" | "compilation";
|
||||
|
||||
export interface SpotifyDevice {
|
||||
id: string;
|
||||
|
|
@ -7,7 +12,7 @@ export interface SpotifyDevice {
|
|||
is_restricted: boolean;
|
||||
name: string;
|
||||
supports_volume: boolean;
|
||||
type: string;
|
||||
type: SpotifyDeviceType;
|
||||
volume_percent: number;
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +43,7 @@ export interface SpotifyImage {
|
|||
export interface SpotifyAlbum {
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
type: SpotifyAlbumType;
|
||||
image: SpotifyImage | null;
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +52,7 @@ export interface SpotifyTrack {
|
|||
name: string;
|
||||
duration: number;
|
||||
isLocal: boolean;
|
||||
type: string;
|
||||
type: SpotifyMediaType;
|
||||
album: SpotifyAlbum;
|
||||
artists: SpotifyArtist[];
|
||||
}
|
||||
|
|
@ -74,12 +79,12 @@ export interface SpotifyActivity {
|
|||
id: string;
|
||||
};
|
||||
sync_id?: string;
|
||||
flags?: number;
|
||||
flags?: ActivityFlags;
|
||||
metadata?: {
|
||||
context_uri: string | undefined;
|
||||
album_id: string;
|
||||
artist_ids: string[];
|
||||
type: string;
|
||||
type: SpotifyMediaType;
|
||||
button_urls: string[];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { FluxStore, GuildSticker, PremiumStickerPack, Sticker } from "..";
|
||||
import { LoadState } from "../../enums";
|
||||
|
||||
export type StickerGuildMap = Map<string, GuildSticker[]>;
|
||||
export type StickerPackMap = Map<string, Sticker[]>;
|
||||
|
|
@ -34,19 +35,23 @@ export interface StickerCategoryType {
|
|||
iconUrl?: string;
|
||||
}
|
||||
|
||||
export interface StickerMetadataEntry {
|
||||
type: number;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class StickersStore extends FluxStore {
|
||||
hasLoadedStickerPacks: boolean;
|
||||
isFetchingStickerPacks: boolean;
|
||||
isLoaded: boolean;
|
||||
loadState: number;
|
||||
loadState: LoadState;
|
||||
|
||||
getAllGuildStickers(): StickerGuildMap;
|
||||
getAllPackStickers(): StickerPackMap;
|
||||
getPremiumPacks(): PremiumStickerPack[];
|
||||
getRawStickersByGuild(): StickerGuildMap;
|
||||
getStickerById(id: string): Sticker | undefined;
|
||||
// TODO: type
|
||||
getStickerMetadataArrays(): any[];
|
||||
getStickerMetadataArrays(): [Record<string, StickerMetadataEntry[]>, Record<string, StickerMetadataEntry[]>];
|
||||
getStickerPack(id: string): PremiumStickerPack | undefined;
|
||||
getStickersByGuildId(guildId: string): Sticker[] | undefined;
|
||||
isPremiumPack(id: string): boolean;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { Channel, FluxStore } from "..";
|
||||
import { Channel, FluxStore, Guild } from "..";
|
||||
import { ChannelOverrideFlags, GuildSettingsFlags, NotifyHighlights, UserNotificationSetting } from "../../enums";
|
||||
|
||||
export interface MuteConfig {
|
||||
selected_time_window: number;
|
||||
|
|
@ -8,8 +9,8 @@ export interface MuteConfig {
|
|||
export interface ChannelOverride {
|
||||
muted: boolean;
|
||||
mute_config: MuteConfig | null;
|
||||
message_notifications: number;
|
||||
flags: number;
|
||||
message_notifications: UserNotificationSetting;
|
||||
flags: ChannelOverrideFlags;
|
||||
collapsed: boolean;
|
||||
channel_id: string;
|
||||
}
|
||||
|
|
@ -20,10 +21,10 @@ export interface GuildSettings {
|
|||
mute_scheduled_events: boolean;
|
||||
mobile_push: boolean;
|
||||
muted: boolean;
|
||||
message_notifications: number;
|
||||
flags: number;
|
||||
message_notifications: UserNotificationSetting;
|
||||
flags: GuildSettingsFlags;
|
||||
channel_overrides: Record<string, ChannelOverride>;
|
||||
notify_highlights: number;
|
||||
notify_highlights: NotifyHighlights;
|
||||
hide_muted_channels: boolean;
|
||||
version: number;
|
||||
mute_config: MuteConfig | null;
|
||||
|
|
@ -43,26 +44,26 @@ export class UserGuildSettingsStore extends FluxStore {
|
|||
get mentionOnAllMessages(): boolean;
|
||||
get useNewNotifications(): boolean;
|
||||
|
||||
allowAllMessages(guildId: string): boolean;
|
||||
allowNoMessages(guildId: string): boolean;
|
||||
allowAllMessages(channel: Channel): boolean;
|
||||
allowNoMessages(channel: Channel): boolean;
|
||||
getAddedToMessages(): string[];
|
||||
// TODO: finish typing
|
||||
getAllSettings(): { userGuildSettings: Record<string, GuildSettings>; };
|
||||
getChannelFlags(channel: Channel): number;
|
||||
getChannelIdFlags(guildId: string, channelId: string): number;
|
||||
getChannelMessageNotifications(guildId: string, channelId: string): number | null;
|
||||
getChannelFlags(channel: Channel): ChannelOverrideFlags;
|
||||
getChannelIdFlags(guildId: string, channelId: string): ChannelOverrideFlags;
|
||||
getChannelMessageNotifications(guildId: string, channelId: string): UserNotificationSetting | null;
|
||||
getChannelMuteConfig(guildId: string, channelId: string): MuteConfig | null;
|
||||
getChannelOverrides(guildId: string): Record<string, ChannelOverride>;
|
||||
getChannelRecordUnreadSetting(channel: Channel): number;
|
||||
getChannelUnreadSetting(guildId: string, channelId: string): number;
|
||||
getGuildFavorites(guildId: string): string[];
|
||||
getGuildFlags(guildId: string): number;
|
||||
getGuildFlags(guildId: string): GuildSettingsFlags;
|
||||
getGuildUnreadSetting(guildId: string): number;
|
||||
getMessageNotifications(guildId: string): number;
|
||||
getMessageNotifications(guildId: string): UserNotificationSetting;
|
||||
getMuteConfig(guildId: string): MuteConfig | null;
|
||||
getMutedChannels(guildId: string): string[];
|
||||
getNewForumThreadsCreated(guildId: string): boolean;
|
||||
getNotifyHighlights(guildId: string): number;
|
||||
getNewForumThreadsCreated(channel: Channel): boolean;
|
||||
getNotifyHighlights(guildId: string): NotifyHighlights;
|
||||
getOptedInChannels(guildId: string): string[];
|
||||
// TODO: finish typing these
|
||||
getOptedInChannelsWithPendingUpdates(guildId: string): Record<string, any>;
|
||||
|
|
@ -85,7 +86,7 @@ export class UserGuildSettingsStore extends FluxStore {
|
|||
isSuppressEveryoneEnabled(guildId: string): boolean;
|
||||
isSuppressRolesEnabled(guildId: string): boolean;
|
||||
isTemporarilyMuted(guildId: string): boolean;
|
||||
resolveGuildUnreadSetting(guildId: string): number;
|
||||
resolveGuildUnreadSetting(guild: Guild): number;
|
||||
resolveUnreadSetting(channel: Channel): number;
|
||||
resolvedMessageNotifications(guildId: string): number;
|
||||
resolvedMessageNotifications(channel: Channel): UserNotificationSetting;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { FluxStore, Guild, User, Application, ApplicationInstallParams } from "..";
|
||||
import { ApplicationIntegrationType } from "../../enums";
|
||||
import { ApplicationFlags, ApplicationIntegrationType } from "../../enums";
|
||||
|
||||
export interface MutualFriend {
|
||||
/**
|
||||
|
|
@ -54,7 +54,7 @@ export interface ProfileApplication {
|
|||
id: string;
|
||||
customInstallUrl: string | undefined;
|
||||
installParams: ApplicationInstallParams | undefined;
|
||||
flags: number;
|
||||
flags: ApplicationFlags;
|
||||
popularApplicationCommandIds?: string[];
|
||||
integrationTypesConfig: Record<ApplicationIntegrationType, Partial<{
|
||||
oauth2_install_params: ApplicationInstallParams;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
import { FluxStore } from "..";
|
||||
import { StickerAnimationSetting, Theme, UIDensity } from "../../enums";
|
||||
|
||||
export type UserStatus = "online" | "idle" | "dnd" | "invisible";
|
||||
|
||||
export interface GuildFolder {
|
||||
guildIds: string[];
|
||||
|
|
@ -68,7 +71,7 @@ export interface TextAndImagesSettings {
|
|||
renderEmbeds: boolean;
|
||||
renderReactions: boolean;
|
||||
animateEmoji: boolean;
|
||||
animateStickers: number;
|
||||
animateStickers: StickerAnimationSetting;
|
||||
enableTtsCommand: boolean;
|
||||
messageDisplayCompact: boolean;
|
||||
explicitContentFilter: number;
|
||||
|
|
@ -122,7 +125,7 @@ export interface GameLibrarySettings {
|
|||
|
||||
export interface StatusSettings {
|
||||
statusExpiresAtMs: string;
|
||||
status: { status: string; } | null;
|
||||
status: { value: UserStatus; } | null;
|
||||
showCurrentGame: boolean;
|
||||
statusCreatedAtMs: string;
|
||||
}
|
||||
|
|
@ -133,12 +136,12 @@ export interface LocalizationSettings {
|
|||
}
|
||||
|
||||
export interface AppearanceSettings {
|
||||
theme: number;
|
||||
theme: Theme;
|
||||
developerMode: boolean;
|
||||
mobileRedesignDisabled: boolean;
|
||||
timestampHourCycle: number;
|
||||
launchPadMode: number;
|
||||
uiDensity: number;
|
||||
uiDensity: UIDensity;
|
||||
swipeRightToLeftMode: number;
|
||||
// TODO: type
|
||||
clientThemeSettings: any;
|
||||
|
|
|
|||
14
packages/discord-types/src/utils.d.ts
vendored
14
packages/discord-types/src/utils.d.ts
vendored
|
|
@ -3,6 +3,7 @@ import type { ReactNode } from "react";
|
|||
import { LiteralUnion } from "type-fest";
|
||||
|
||||
import type { FluxEvents } from "./fluxEvents";
|
||||
import { ApplicationCommandOptionType, ChannelType, PremiumType } from "../enums";
|
||||
|
||||
export { FluxEvents };
|
||||
|
||||
|
|
@ -86,6 +87,8 @@ export type Permissions = "CREATE_INSTANT_INVITE"
|
|||
| "VIEW_GUILD_ANALYTICS"
|
||||
| "VIEW_CREATOR_MONETIZATION_ANALYTICS"
|
||||
| "MODERATE_MEMBERS"
|
||||
| "USE_EMBEDDED_ACTIVITIES"
|
||||
| "USE_EXTERNAL_APPS"
|
||||
| "SEND_MESSAGES"
|
||||
| "SEND_TTS_MESSAGES"
|
||||
| "MANAGE_MESSAGES"
|
||||
|
|
@ -102,6 +105,9 @@ export type Permissions = "CREATE_INSTANT_INVITE"
|
|||
| "USE_EXTERNAL_STICKERS"
|
||||
| "SEND_MESSAGES_IN_THREADS"
|
||||
| "SEND_VOICE_MESSAGES"
|
||||
| "SEND_POLLS"
|
||||
| "PIN_MESSAGES"
|
||||
| "BYPASS_SLOWMODE"
|
||||
| "CONNECT"
|
||||
| "SPEAK"
|
||||
| "MUTE_MEMBERS"
|
||||
|
|
@ -110,9 +116,9 @@ export type Permissions = "CREATE_INSTANT_INVITE"
|
|||
| "USE_VAD"
|
||||
| "PRIORITY_SPEAKER"
|
||||
| "STREAM"
|
||||
| "USE_EMBEDDED_ACTIVITIES"
|
||||
| "USE_SOUNDBOARD"
|
||||
| "USE_EXTERNAL_SOUNDS"
|
||||
| "SET_VOICE_CHANNEL_STATUS"
|
||||
| "REQUEST_TO_SPEAK"
|
||||
| "MANAGE_EVENTS"
|
||||
| "CREATE_EVENTS";
|
||||
|
|
@ -292,7 +298,7 @@ export class DisplayProfile {
|
|||
canEditThemes: boolean;
|
||||
premiumGuildSince: Date | null;
|
||||
premiumSince: Date | null;
|
||||
premiumType?: number;
|
||||
premiumType?: PremiumType;
|
||||
primaryColor?: number;
|
||||
|
||||
getBadges(): Array<{
|
||||
|
|
@ -324,7 +330,7 @@ export interface DateUtils {
|
|||
}
|
||||
|
||||
export interface CommandOptions {
|
||||
type: number;
|
||||
type: ApplicationCommandOptionType;
|
||||
name: string;
|
||||
description: string;
|
||||
required?: boolean;
|
||||
|
|
@ -333,7 +339,7 @@ export interface CommandOptions {
|
|||
values: string | number;
|
||||
}[];
|
||||
options?: CommandOptions[];
|
||||
channel_types?: number[];
|
||||
channel_types?: ChannelType[];
|
||||
min_value?: number;
|
||||
max_value?: number;
|
||||
autocomplete?: boolean;
|
||||
|
|
|
|||
|
|
@ -221,7 +221,6 @@ export default definePlugin({
|
|||
useEffect(() => {
|
||||
if (!channel) return;
|
||||
|
||||
// @ts-expect-error
|
||||
if (channel.isForumLikeChannel()) {
|
||||
requireForumView().then(() => {
|
||||
setViewComponent(
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import definePlugin, { OptionType, Patch } from "@utils/types";
|
|||
import type { Emoji, Message, Sticker } from "@vencord/discord-types";
|
||||
import { StickerFormatType } from "@vencord/discord-types/enums";
|
||||
import { findByCodeLazy, findByPropsLazy, proxyLazyWebpack } from "@webpack";
|
||||
import { Alerts, ChannelStore, DraftType, EmojiStore, FluxDispatcher, GuildMemberStore, lodash, OverridePremiumTypeStore, Parser, PermissionsBits, PermissionStore, StickersStore, UploadHandler, UserSettingsActionCreators, UserSettingsProtoStore, UserStore } from "@webpack/common";
|
||||
import { Alerts, ChannelStore, DraftType, EmojiStore, FluxDispatcher, GuildMemberStore, lodash, OverridePremiumTypeStore, Parser, PermissionsBits, PermissionStore, StickersStore, UploadHandler, UserSettingsActionCreators, UserSettingsProtoStore } from "@webpack/common";
|
||||
import { applyPalette, GIFEncoder, quantize } from "gifenc";
|
||||
import type { ReactElement, ReactNode } from "react";
|
||||
|
||||
|
|
|
|||
|
|
@ -24,27 +24,14 @@ import { cl, getGuildPermissionSpecMap } from "@plugins/permissionsViewer/utils"
|
|||
import { copyToClipboard } from "@utils/clipboard";
|
||||
import { getIntlMessage, getUniqueUsername } from "@utils/discord";
|
||||
import { ModalCloseButton, ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
||||
import { Guild, Role, UnicodeEmoji, User } from "@vencord/discord-types";
|
||||
import { Guild, Role, RoleOrUserPermission, UnicodeEmoji, User } from "@vencord/discord-types";
|
||||
import { PermissionOverwriteType } from "@vencord/discord-types/enums";
|
||||
import { findByCodeLazy } from "@webpack";
|
||||
import { ContextMenuApi, FluxDispatcher, GuildMemberStore, GuildRoleStore, i18n, Menu, PermissionsBits, ScrollerThin, Tooltip, useEffect, useMemo, UserStore, useState, useStateFromStores } from "@webpack/common";
|
||||
|
||||
import { settings } from "..";
|
||||
import { PermissionAllowedIcon, PermissionDefaultIcon, PermissionDeniedIcon } from "./icons";
|
||||
|
||||
export const enum PermissionType {
|
||||
Role = 0,
|
||||
User = 1,
|
||||
Owner = 2
|
||||
}
|
||||
|
||||
export interface RoleOrUserPermission {
|
||||
type: PermissionType;
|
||||
id?: string;
|
||||
permissions?: bigint;
|
||||
overwriteAllow?: bigint;
|
||||
overwriteDeny?: bigint;
|
||||
}
|
||||
|
||||
type GetRoleIconData = (role: Role, size: number) => { customIconSrc?: string; unicodeEmoji?: UnicodeEmoji; };
|
||||
const getRoleIconData: GetRoleIconData = findByCodeLazy("convertSurrogateToName", "customIconSrc", "unicodeEmoji");
|
||||
|
||||
|
|
@ -72,7 +59,7 @@ function RolesAndUsersPermissionsComponent({ permissions, guild, modalProps, hea
|
|||
|
||||
useEffect(() => {
|
||||
const usersToRequest = permissions
|
||||
.filter(p => p.type === PermissionType.User && !GuildMemberStore.isMember(guild.id, p.id!))
|
||||
.filter(p => p.type === PermissionOverwriteType.MEMBER && !GuildMemberStore.isMember(guild.id, p.id!))
|
||||
.map(({ id }) => id);
|
||||
|
||||
FluxDispatcher.dispatch({
|
||||
|
|
@ -123,7 +110,7 @@ function RolesAndUsersPermissionsComponent({ permissions, guild, modalProps, hea
|
|||
<div
|
||||
className={cl("modal-list-item", { "modal-list-item-active": selectedItemIndex === index })}
|
||||
onContextMenu={e => {
|
||||
if (permission.type === PermissionType.Role)
|
||||
if (permission.type === PermissionOverwriteType.ROLE)
|
||||
ContextMenuApi.openContextMenu(e, () => (
|
||||
<RoleContextMenu
|
||||
guild={guild}
|
||||
|
|
@ -131,7 +118,7 @@ function RolesAndUsersPermissionsComponent({ permissions, guild, modalProps, hea
|
|||
onClose={modalProps.onClose}
|
||||
/>
|
||||
));
|
||||
else if (permission.type === PermissionType.User) {
|
||||
else if (permission.type === PermissionOverwriteType.MEMBER) {
|
||||
ContextMenuApi.openContextMenu(e, () => (
|
||||
<UserContextMenu
|
||||
userId={permission.id!}
|
||||
|
|
@ -140,19 +127,19 @@ function RolesAndUsersPermissionsComponent({ permissions, guild, modalProps, hea
|
|||
}
|
||||
}}
|
||||
>
|
||||
{(permission.type === PermissionType.Role || permission.type === PermissionType.Owner) && (
|
||||
{(permission.type === PermissionOverwriteType.ROLE || permission.type === PermissionOverwriteType.OWNER) && (
|
||||
<span
|
||||
className={cl("modal-role-circle")}
|
||||
style={{ backgroundColor: role?.colorString ?? "var(--primary-300)" }}
|
||||
/>
|
||||
)}
|
||||
{permission.type === PermissionType.Role && roleIconSrc != null && (
|
||||
{permission.type === PermissionOverwriteType.ROLE && roleIconSrc != null && (
|
||||
<img
|
||||
className={cl("modal-role-image")}
|
||||
src={roleIconSrc}
|
||||
/>
|
||||
)}
|
||||
{permission.type === PermissionType.User && user != null && (
|
||||
{permission.type === PermissionOverwriteType.MEMBER && user != null && (
|
||||
<img
|
||||
className={cl("modal-user-img")}
|
||||
src={user.getAvatarURL(void 0, void 0, false)}
|
||||
|
|
@ -160,9 +147,9 @@ function RolesAndUsersPermissionsComponent({ permissions, guild, modalProps, hea
|
|||
)}
|
||||
<BaseText size="md" className={cl("modal-list-item-text")}>
|
||||
{
|
||||
permission.type === PermissionType.Role
|
||||
permission.type === PermissionOverwriteType.ROLE
|
||||
? role?.name ?? "Unknown Role"
|
||||
: permission.type === PermissionType.User
|
||||
: permission.type === PermissionOverwriteType.MEMBER
|
||||
? (user != null && getUniqueUsername(user)) ?? "Unknown User"
|
||||
: (
|
||||
<Flex gap="0.2em">
|
||||
|
|
|
|||
|
|
@ -22,12 +22,13 @@ import { HeadingTertiary } from "@components/Heading";
|
|||
import { cl, getGuildPermissionSpecMap, getSortedRolesForMember, sortUserRoles } from "@plugins/permissionsViewer/utils";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import { classes } from "@utils/misc";
|
||||
import type { Guild, GuildMember } from "@vencord/discord-types";
|
||||
import type { Guild, GuildMember, RoleOrUserPermission } from "@vencord/discord-types";
|
||||
import { PermissionOverwriteType } from "@vencord/discord-types/enums";
|
||||
import { filters, findBulk, proxyLazyWebpack } from "@webpack";
|
||||
import { PermissionsBits, Tooltip, useMemo, UserStore } from "@webpack/common";
|
||||
|
||||
import { PermissionsSortOrder, settings } from "..";
|
||||
import openRolesAndUsersPermissionsModal, { PermissionType, type RoleOrUserPermission } from "./RolesAndUsersPermissions";
|
||||
import openRolesAndUsersPermissionsModal from "./RolesAndUsersPermissions";
|
||||
|
||||
interface UserPermission {
|
||||
permission: string;
|
||||
|
|
@ -100,13 +101,13 @@ function UserPermissionsComponent({ guild, guildMember, closePopout }: { guild:
|
|||
const userRoles = getSortedRolesForMember(guild, guildMember);
|
||||
|
||||
const rolePermissions: Array<RoleOrUserPermission> = userRoles.map(role => ({
|
||||
type: PermissionType.Role,
|
||||
type: PermissionOverwriteType.ROLE,
|
||||
...role
|
||||
}));
|
||||
|
||||
if (guild.ownerId === guildMember.userId) {
|
||||
rolePermissions.push({
|
||||
type: PermissionType.Owner,
|
||||
type: PermissionOverwriteType.OWNER,
|
||||
permissions: Object.values(PermissionsBits).reduce((prev, curr) => prev | curr, 0n)
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -26,16 +26,16 @@ import { TooltipContainer } from "@components/TooltipContainer";
|
|||
import { Devs } from "@utils/constants";
|
||||
import { classes } from "@utils/misc";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import type { Guild, GuildMember } from "@vencord/discord-types";
|
||||
import { type Guild, type GuildMember, RoleOrUserPermission } from "@vencord/discord-types";
|
||||
import { PermissionOverwriteType } from "@vencord/discord-types/enums";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { Button, ChannelStore, Dialog, GuildMemberStore, GuildRoleStore, GuildStore, match, Menu, PermissionsBits, Popout, useRef, UserStore } from "@webpack/common";
|
||||
|
||||
import openRolesAndUsersPermissionsModal, { PermissionType, RoleOrUserPermission } from "./components/RolesAndUsersPermissions";
|
||||
import openRolesAndUsersPermissionsModal from "./components/RolesAndUsersPermissions";
|
||||
import UserPermissions from "./components/UserPermissions";
|
||||
import { getSortedRolesForMember, sortPermissionOverwrites } from "./utils";
|
||||
|
||||
const PopoutClasses = findByPropsLazy("container", "scroller", "list");
|
||||
const RoleButtonClasses = findByPropsLazy("button", "icon");
|
||||
|
||||
export const enum PermissionsSortOrder {
|
||||
HighestRole,
|
||||
|
|
@ -76,13 +76,13 @@ function MenuItem(guildId: string, id?: string, type?: MenuItemParentType) {
|
|||
|
||||
const permissions: RoleOrUserPermission[] = getSortedRolesForMember(guild, member)
|
||||
.map(role => ({
|
||||
type: PermissionType.Role,
|
||||
type: PermissionOverwriteType.ROLE,
|
||||
...role
|
||||
}));
|
||||
|
||||
if (guild.ownerId === id) {
|
||||
permissions.push({
|
||||
type: PermissionType.Owner,
|
||||
type: PermissionOverwriteType.OWNER,
|
||||
permissions: Object.values(PermissionsBits).reduce((prev, curr) => prev | curr, 0n)
|
||||
});
|
||||
}
|
||||
|
|
@ -96,7 +96,7 @@ function MenuItem(guildId: string, id?: string, type?: MenuItemParentType) {
|
|||
const channel = ChannelStore.getChannel(id!);
|
||||
|
||||
const permissions = sortPermissionOverwrites(Object.values(channel.permissionOverwrites).map(({ id, allow, deny, type }) => ({
|
||||
type: type as PermissionType,
|
||||
type,
|
||||
id,
|
||||
overwriteAllow: allow,
|
||||
overwriteDeny: deny
|
||||
|
|
@ -109,7 +109,7 @@ function MenuItem(guildId: string, id?: string, type?: MenuItemParentType) {
|
|||
})
|
||||
.otherwise(() => {
|
||||
const permissions = GuildRoleStore.getSortedRoles(guild.id).map(role => ({
|
||||
type: PermissionType.Role,
|
||||
type: PermissionOverwriteType.ROLE,
|
||||
...role
|
||||
}));
|
||||
|
||||
|
|
|
|||
|
|
@ -18,12 +18,11 @@
|
|||
|
||||
import { classNameFactory } from "@utils/css";
|
||||
import { Guild, GuildMember, Role } from "@vencord/discord-types";
|
||||
import { PermissionOverwriteType } from "@vencord/discord-types/enums";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { GuildRoleStore } from "@webpack/common";
|
||||
|
||||
import { PermissionsSortOrder, settings } from ".";
|
||||
import { PermissionType } from "./components/RolesAndUsersPermissions";
|
||||
|
||||
export const { getGuildPermissionSpecMap } = findByPropsLazy("getGuildPermissionSpecMap");
|
||||
|
||||
export const cl = classNameFactory("vc-permviewer-");
|
||||
|
|
@ -50,7 +49,7 @@ export function sortPermissionOverwrites<T extends { id: string; type: number; }
|
|||
const roles = GuildRoleStore.getRolesSnapshot(guildId);
|
||||
|
||||
return overwrites.sort((a, b) => {
|
||||
if (a.type !== PermissionType.Role || b.type !== PermissionType.Role) return 0;
|
||||
if (a.type !== PermissionOverwriteType.ROLE || b.type !== PermissionOverwriteType.ROLE) return 0;
|
||||
|
||||
const roleA = roles[a.id];
|
||||
const roleB = roles[b.id];
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ import { Settings } from "@api/Settings";
|
|||
import { BaseText } from "@components/BaseText";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import PermissionsViewerPlugin from "@plugins/permissionsViewer";
|
||||
import openRolesAndUsersPermissionsModal, { PermissionType, RoleOrUserPermission } from "@plugins/permissionsViewer/components/RolesAndUsersPermissions";
|
||||
import openRolesAndUsersPermissionsModal from "@plugins/permissionsViewer/components/RolesAndUsersPermissions";
|
||||
import { sortPermissionOverwrites } from "@plugins/permissionsViewer/utils";
|
||||
import { classes } from "@utils/misc";
|
||||
import { formatDuration } from "@utils/text";
|
||||
import type { Channel } from "@vencord/discord-types";
|
||||
import type { Channel, RoleOrUserPermission } from "@vencord/discord-types";
|
||||
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||
import { EmojiStore, FluxDispatcher, GuildMemberStore, GuildStore, Parser, PermissionsBits, PermissionStore, SnowflakeUtils, Timestamp, Tooltip, useEffect, useState } from "@webpack/common";
|
||||
|
||||
|
|
@ -47,22 +47,6 @@ interface DefaultReaction {
|
|||
emojiName: string | null;
|
||||
}
|
||||
|
||||
interface Tag {
|
||||
id: string;
|
||||
name: string;
|
||||
emojiId: string | null;
|
||||
emojiName: string | null;
|
||||
moderated: boolean;
|
||||
}
|
||||
|
||||
interface ExtendedChannel extends Channel {
|
||||
defaultThreadRateLimitPerUser?: number;
|
||||
defaultSortOrder?: SortOrderTypes | null;
|
||||
defaultForumLayout?: ForumLayoutTypes;
|
||||
defaultReactionEmoji?: DefaultReaction | null;
|
||||
availableTags?: Array<Tag>;
|
||||
}
|
||||
|
||||
const enum ChannelTypes {
|
||||
GUILD_TEXT = 0,
|
||||
GUILD_VOICE = 2,
|
||||
|
|
@ -116,7 +100,7 @@ const VideoQualityModesToNames = {
|
|||
// Icon from the modal when clicking a message link you don't have access to view
|
||||
const HiddenChannelLogo = "/assets/433e3ec4319a9d11b0cbe39342614982.svg";
|
||||
|
||||
function HiddenChannelLockScreen({ channel }: { channel: ExtendedChannel; }) {
|
||||
function HiddenChannelLockScreen({ channel }: { channel: Channel; }) {
|
||||
const { defaultAllowedUsersAndRolesDropdownState } = settings.use(["defaultAllowedUsersAndRolesDropdownState"]);
|
||||
const [permissions, setPermissions] = useState<RoleOrUserPermission[]>([]);
|
||||
|
||||
|
|
@ -162,7 +146,7 @@ function HiddenChannelLockScreen({ channel }: { channel: ExtendedChannel; }) {
|
|||
|
||||
if (Settings.plugins.PermissionsViewer.enabled) {
|
||||
setPermissions(sortPermissionOverwrites(Object.values(permissionOverwrites).map(overwrite => ({
|
||||
type: overwrite.type as PermissionType,
|
||||
type: overwrite.type,
|
||||
id: overwrite.id,
|
||||
overwriteAllow: overwrite.allow,
|
||||
overwriteDeny: overwrite.deny
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue