Skip to content

Commit

Permalink
🏷️ feat: (hopefully) fully update types
Browse files Browse the repository at this point in the history
  • Loading branch information
Helloyunho committed May 1, 2024
1 parent ebeca64 commit bd8f7d0
Show file tree
Hide file tree
Showing 43 changed files with 589 additions and 356 deletions.
8 changes: 4 additions & 4 deletions types/src/applications/application.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { UserPayload } from "../users/user.ts";
import { TeamPayload } from "../teams/team.ts";
import { snowflake } from "../common.ts";

export interface ApplicationPayload {
id: string;
id: snowflake;
name: string;
icon: string | null;
description: string;
Expand All @@ -16,8 +17,8 @@ export interface ApplicationPayload {
summary: string;
verify_key: string;
team: TeamPayload | null;
guild_id?: string;
primary_sku_id?: string;
guild_id?: snowflake;
primary_sku_id?: snowflake;
slug?: string;
cover_image?: string;
/** Use it with ApplicationFlags. */
Expand All @@ -29,7 +30,6 @@ export interface ApplicationPayload {
install_params?: ApplicationInstallParams;
custom_install_url?: string;
role_connections_verification_url?: string;
integration_types?: ApplicationIntegrationType[];
integration_types_config?: Record<
keyof ApplicationIntegrationType,
ApplicationIntegrationTypeConfig
Expand Down
21 changes: 11 additions & 10 deletions types/src/auditLogs/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ import { UserPayload } from "../users/user.ts";
import { WebhookPayload } from "../webhooks/webhook.ts";
import { ChannelPayload } from "../channels/base.ts";
import { GuildMemberPayload } from "../guilds/member.ts";
import { InvitePayload } from "../invites/intive.ts";
import { InvitePayload } from "../invites/invite.ts";
import { EmojiPayload } from "../emojis/emoij.ts";
import { snowflake } from "../common.ts";

export interface AuditLogPayload {
application_commands: ApplicationCommandPayload[];
Expand All @@ -42,8 +43,8 @@ export interface AuditLogPayload {
export interface AuditLogEntryPayload {
target_id: string | null;
changes?: AuditLogChangePayload[];
user_id: string | null;
id: string;
user_id: snowflake | null;
id: snowflake;
action_type: AuditLogEvents;
options?: AuditLogEntryInfoPayload;
reason?: string;
Expand Down Expand Up @@ -109,15 +110,15 @@ export enum AuditLogEvents {
}

export interface AuditLogEntryInfoPayload {
application_id?: string;
application_id?: snowflake;
auto_moderation_rule_name?: string;
auto_moderation_rule_trigger_type?: string;
channel_id?: string;
channel_id?: snowflake;
count?: string;
delete_member_days?: string;
id?: string;
id?: snowflake;
members_removed?: string;
message_id?: string;
message_id?: snowflake;
role_name?: string;
type?: string;
integration_type?: string;
Expand Down Expand Up @@ -154,9 +155,9 @@ export interface AuditLogChangePayload {
}

export interface GetAuditLogParams {
user_id?: string;
user_id?: snowflake;
action_type?: AuditLogEvents;
before?: string;
after?: string;
before?: snowflake;
after?: snowflake;
limit?: number;
}
22 changes: 12 additions & 10 deletions types/src/autoMod/autoMod.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { snowflake } from "../common.ts";

export interface AutoModerationRulePayload {
id: string;
guild_id: string;
id: snowflake;
guild_id: snowflake;
name: string;
creator_id: string;
creator_id: snowflake;
event_type: AutoModerationRuleEventType;
trigger_type: AutoModerationRuleTriggerType;
trigger_metadata: AutoModerationRuleTriggerMetadata;
actions: AutoModerationRuleAction[];
enabled: boolean;
exempt_roles: string[];
exempt_channels: string[];
exempt_roles: snowflake[];
exempt_channels: snowflake[];
}

export enum AutoModerationRuleEventType {
Expand Down Expand Up @@ -50,7 +52,7 @@ export enum AutoModerationRuleActionType {
}

export interface AutoModerationRuleActionMetadata {
channel_id: string;
channel_id: snowflake;
duration_seconds: number;
custom_message?: string;
}
Expand All @@ -62,8 +64,8 @@ export interface AutoModerationRuleCreatePayload {
trigger_metadata?: AutoModerationRuleTriggerMetadata;
actions: AutoModerationRuleAction[];
enabled?: boolean;
exempt_roles?: string[];
exempt_channels?: string[];
exempt_roles?: snowflake[];
exempt_channels?: snowflake[];
}

export interface AutoModerationRuleUpdatePayload {
Expand All @@ -72,6 +74,6 @@ export interface AutoModerationRuleUpdatePayload {
trigger_metadata?: AutoModerationRuleTriggerMetadata;
actions?: AutoModerationRuleAction[];
enabled?: boolean;
exempt_roles?: string[];
exempt_channels?: string[];
exempt_roles?: snowflake[];
exempt_channels?: snowflake[];
}
14 changes: 8 additions & 6 deletions types/src/channels/base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { InviteTargetType } from "../invites/intive.ts";
import { snowflake } from "../common.ts";
import { Reasonable } from "../etc/reasonable.ts";
import { InviteTargetType } from "../invites/invite.ts";

// https://discord.com/developers/docs/resources/channel#channel-object-channel-types
export enum ChannelType {
Expand All @@ -19,7 +21,7 @@ export enum ChannelType {

/** @link https://discord.com/developers/docs/resources/channel#channel-object */
export interface ChannelPayload {
id: string;
id: snowflake;
type: ChannelType;
flags?: number;
}
Expand All @@ -32,15 +34,15 @@ export enum ChannelFlags {

export interface TextChannelPayload extends ChannelPayload {
last_pin_timestamp: string | null;
last_message_id: string | null;
last_message_id: snowflake | null;
}

export interface CreateChannelInvitePayload {
export interface CreateChannelInvitePayload extends Reasonable {
max_age?: number;
max_uses?: number;
temporary?: boolean;
unique?: boolean;
target_type?: InviteTargetType;
target_user_id?: string;
target_applicaton_id?: string;
target_user_id?: snowflake;
target_applicaton_id?: snowflake;
}
10 changes: 8 additions & 2 deletions types/src/channels/dm.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { snowflake } from "../common.ts";
import { Reasonable } from "../etc/reasonable.ts";
import { UserPayload } from "../users/user.ts";
import { ChannelType, TextChannelPayload } from "./base.ts";
Expand All @@ -16,8 +17,8 @@ export interface GroupDMChannelPayload extends DMBasedChannelPayload {
type: ChannelType.GROUP_DM;
name: string;
icon: string | null;
owner_id: string;
application_id?: string;
owner_id: snowflake;
application_id?: snowflake;
managed: boolean;
}

Expand All @@ -26,3 +27,8 @@ export interface EditGroupDMChannelPayload extends Reasonable {
name?: string;
icon?: string;
}

export interface GroupDMAddRecipientPayload {
access_token: string;
nick?: string;
}
12 changes: 6 additions & 6 deletions types/src/channels/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ export enum EmbedType {

/** @link https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure */
export interface EmbedVideoPayload {
url?: string;
url: string;
proxy_url?: string;
height?: number;
width?: number;
}

/** @link https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure */
export interface EmbedImagePayload {
url?: string;
url: string;
proxy_url?: string;
height?: number;
width?: number;
Expand All @@ -35,23 +35,23 @@ export interface EmbedProviderPayload {

/** @link https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure */
export interface EmbedAuthorPayload {
name?: string;
name: string;
url?: string;
icon_url?: string;
proxy_icon_url?: string;
}

/** @link https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure */
export interface EmbedFooterPayload {
text?: string;
text: string;
icon_url?: string;
proxy_icon_url?: string;
}

/** @link https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure */
export interface EmbedFieldPayload {
name?: string;
value?: string;
name: string;
value: string;
inline?: boolean;
}

Expand Down
10 changes: 6 additions & 4 deletions types/src/channels/etc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { snowflake } from "../common.ts";

/** @link https://discord.com/developers/docs/resources/channel#followed-channel-object-followed-channel-structure */
export interface FollowedChannelPayload {
channel_id: string;
webhook_id: string;
channel_id: snowflake;
webhook_id: snowflake;
}

/** @link https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mention-types */
Expand All @@ -14,7 +16,7 @@ export enum AllowedMentionType {
/** @link https://discord.com/developers/docs/resources/channel#allowed-mentions-object-allowed-mentions-structure */
export interface AllowedMentionsPayload {
parse: AllowedMentionType[];
roles: string[];
users: string[];
roles: snowflake[];
users: snowflake[];
replied_user: boolean;
}
25 changes: 15 additions & 10 deletions types/src/channels/guild.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Thread channels are seperated to a different file.
import { snowflake } from "../common.ts";
import { Reasonable } from "../etc/reasonable.ts";
import { ChannelPayload, ChannelType, TextChannelPayload } from "./base.ts";

Expand All @@ -10,17 +11,17 @@ export enum OverwriteType {

/** @link https://discord.com/developers/docs/resources/channel#overwrite-object-overwrite-structure */
export interface OverwritePayload {
id: string;
id: snowflake;
type: OverwriteType;
allow: string;
deny: string;
}

export interface GuildForumTagPayload {
id: string;
id: snowflake;
name: string;
moderated: boolean;
emoji_id: string | null;
emoji_id: snowflake | null;
emoji_name: string | null;
}

Expand All @@ -42,12 +43,12 @@ export interface GuildThreadAvailableChannelPayload
}

export interface GuildChannelPayload extends ChannelPayload {
guild_id: string;
guild_id: snowflake;
name: string;
position: number;
permission_overwrites: OverwritePayload[];
nsfw: boolean;
parent_id: string | null;
parent_id: snowflake | null;
topic: string | null;
}

Expand All @@ -72,7 +73,7 @@ export enum ForumLayout {
}

export interface ForumDefaultReactionPayload {
emoji_id: string | null;
emoji_id: snowflake | null;
emoji_name: string | null;
}

Expand Down Expand Up @@ -124,15 +125,15 @@ export interface EditGuildAnnouncementChannelPayload
extends EditGuildChannelPayload {
type?: ChannelType.GUILD_TEXT | ChannelType.GUILD_ANNOUNCEMENT;
topic?: string | null;
parent_id?: string | null;
parent_id?: snowflake | null;
default_auto_archive_duration?: number | null;
nsfw?: boolean | null;
}

export interface EditGuildTextChannelPayload extends EditGuildChannelPayload {
type?: ChannelType.GUILD_TEXT | ChannelType.GUILD_ANNOUNCEMENT;
topic?: string | null;
parent_id?: string | null;
parent_id?: snowflake | null;
rate_limit_per_user?: number | null;
default_thread_rate_limit_per_user?: number;
default_auto_archive_duration?: number | null;
Expand All @@ -144,7 +145,7 @@ export interface EditGuildVoiceChannelPayload extends EditGuildChannelPayload {
user_limit?: number | null;
rtc_region?: string | null;
video_quality_mode?: VideoQualityModes | null;
parent_id?: string | null;
parent_id?: snowflake | null;
nsfw?: boolean | null;
}

Expand All @@ -157,7 +158,7 @@ export interface EditGuildForumChannelPayload extends EditGuildChannelPayload {
default_thread_rate_limit_per_user?: number;
default_sort_order?: ForumSortOrder | null;
default_forum_layout?: ForumLayout;
parent_id?: string | null;
parent_id?: snowflake | null;
nsfw?: boolean | null;
topic?: string | null;
rate_limit_per_user?: number | null;
Expand All @@ -169,3 +170,7 @@ export interface EditChannelPermissionsPayload extends Reasonable {
deny?: string;
type: OverwriteType;
}

export interface FollowAnnouncementChannelPayload {
webhook_channel_id: snowflake;
}
Loading

0 comments on commit bd8f7d0

Please sign in to comment.