Skip to content

Commit

Permalink
👽️ feat: 'small' type update(not finished)
Browse files Browse the repository at this point in the history
  • Loading branch information
Helloyunho committed Apr 29, 2024
1 parent 36f3b21 commit ebeca64
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 18 deletions.
29 changes: 28 additions & 1 deletion types/src/applications/application.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UserPayload } from "../users/user.ts";
import { TeamPayload } from "./team.ts";
import { TeamPayload } from "../teams/team.ts";

export interface ApplicationPayload {
id: string;
Expand All @@ -22,18 +22,29 @@ export interface ApplicationPayload {
cover_image?: string;
/** Use it with ApplicationFlags. */
flags?: number;
approximate_guild_count?: number;
redirect_uris?: string[];
interactions_endpoint_url?: string;
tags?: string[];
install_params?: ApplicationInstallParams;
custom_install_url?: string;
role_connections_verification_url?: string;
integration_types?: ApplicationIntegrationType[];
integration_types_config?: Record<
keyof ApplicationIntegrationType,
ApplicationIntegrationTypeConfig
>;
}

export enum ApplicationIntegrationType {
GUILD_INSTALL = 0,
USER_INSTALL = 1,
}

export interface ApplicationIntegrationTypeConfig {
oauth2_install_params?: ApplicationInstallParams;
}

export interface ApplicationInstallParams {
scopes: string[];
permissions: string;
Expand All @@ -51,3 +62,19 @@ export enum ApplicationFlags {
GATEWAY_MESSAGE_CONTENT_LIMITED = 1 << 19,
APPLICATION_COMMAND_BADGE = 1 << 23,
}

export interface EditApplicationPayload {
custom_install_url?: string;
description?: string;
role_connections_verification_url?: string;
install_params?: ApplicationInstallParams;
integration_types_config?: Record<
keyof ApplicationIntegrationType,
ApplicationIntegrationTypeConfig
>;
flags?: number;
icon?: string | null;
cover_image?: string | null;
interactions_endpoint_url?: string;
tags?: string[];
}
2 changes: 1 addition & 1 deletion types/src/applications/mod.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "./application.ts";
export * from "./team.ts";
export * from "./roleConnectionMetadata.ts";
4 changes: 2 additions & 2 deletions types/src/applications/roleConnectionMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ export interface ApplicationRoleConnectionMetadata {
type: ApplicationRoleConnectionMetadataType;
key: string;
name: string;
name_localization: Record<Locales, string>;
name_localization?: Record<Locales, string>;
description: string;
description_localization: Record<Locales, string>;
description_localization?: Record<Locales, string>;
}

export enum ApplicationRoleConnectionMetadataType {
Expand Down
40 changes: 35 additions & 5 deletions types/src/auditLogs/log.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
import { AutoModerationRulePayload } from "../autoMod/autoMod.ts";
import { OverwritePayload } from "../channels/guild.ts";
import { GuildThreadChannelPayload } from "../channels/thread.ts";
import {
GuildThreadChannelPayload,
ThreadMetadataPayload,
} from "../channels/thread.ts";
import { IntegrationPayload } from "../guilds/integration.ts";
import { GuildPayload } from "../guilds/guild.ts";
import { RolePayload } from "../guilds/role.ts";
import { ApplicationCommandPayload } from "../interactions/command.ts";
import {
ApplicationCommandPayload,
ApplicationCommandPermissions,
} from "../interactions/command.ts";
import {
ScheduledEventPayload,
ScheduledEventPrivacyLevel,
ScheduledEventStatus,
} from "../scheduledEvent/scheduledEvent.ts";
import { StagePrivacyLevel } from "../stageInstances/stage.ts";
import { StickerFormatType } from "../stickers/sticker.ts";
import {
StageInstancePayload,
StagePrivacyLevel,
} from "../stageInstances/stage.ts";
import { StickerFormatType, StickerPayload } from "../stickers/sticker.ts";
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 { EmojiPayload } from "../emojis/emoij.ts";

export interface AuditLogPayload {
application_commands: ApplicationCommandPayload[];
Expand Down Expand Up @@ -90,6 +104,8 @@ export enum AuditLogEvents {
AUTO_MODERATION_BLOCK_MESSAGE = 143,
AUTO_MODERATION_FLAG_TO_CHANNEL = 144,
AUTO_MODERATION_USER_COMMUNICATION_DISABLED = 145,
CREATOR_MONETIZATION_REQUEST_CREATED = 150,
CREATOR_MONETIZATION_TERMS_ACCEPTED = 151,
}

export interface AuditLogEntryInfoPayload {
Expand All @@ -104,6 +120,7 @@ export interface AuditLogEntryInfoPayload {
message_id?: string;
role_name?: string;
type?: string;
integration_type?: string;
}

type AuditLogChangeValue =
Expand All @@ -115,7 +132,20 @@ type AuditLogChangeValue =
| StagePrivacyLevel
| ScheduledEventPrivacyLevel
| ScheduledEventStatus
| RolePayload;
| RolePayload
| GuildPayload
| ChannelPayload
| GuildMemberPayload
| InvitePayload
| WebhookPayload
| EmojiPayload
| IntegrationPayload
| StageInstancePayload
| StickerPayload
// | GuildScheduledEventPayload
| ThreadMetadataPayload
| ApplicationCommandPermissions
| AutoModerationRulePayload;

export interface AuditLogChangePayload {
new_value?: AuditLogChangeValue;
Expand Down
15 changes: 8 additions & 7 deletions types/src/autoMod/autoMod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ export enum AutoModerationRuleTriggerType {
}

export interface AutoModerationRuleTriggerMetadata {
keyword_filter?: string[];
regex_patterns?: string[];
presets?: AutoModerationRuleKeywordPreset[];
allow_list?: string[];
mention_total_limit?: number;
keyword_filter: string[];
regex_patterns: string[];
presets: AutoModerationRuleKeywordPreset[];
allow_list: string[];
mention_total_limit: number;
mention_raid_protection_enabled: boolean;
}

export enum AutoModerationRuleKeywordPreset {
Expand All @@ -49,8 +50,8 @@ export enum AutoModerationRuleActionType {
}

export interface AutoModerationRuleActionMetadata {
channel_id?: string;
duration_seconds?: number;
channel_id: string;
duration_seconds: number;
custom_message?: string;
}

Expand Down
8 changes: 7 additions & 1 deletion types/src/channels/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ export enum ChannelType {
export interface ChannelPayload {
id: string;
type: ChannelType;
flags: number;
flags?: number;
}

export enum ChannelFlags {
PINNED = 1 << 1,
REQUIRE_TAG = 1 << 4,
HIDE_MEDIA_DOWNLOAD_OPTIONS = 1 << 15,
}

export interface TextChannelPayload extends ChannelPayload {
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions types/src/poll/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./poll.ts";
53 changes: 53 additions & 0 deletions types/src/poll/poll.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { EmojiPayload } from "../emojis/emoij.ts";
import { UserPayload } from "../users/user.ts";

export interface PollPayload {
question: PollMediaPayload;
answers: PollAnswerPayload[];
expiry: string | null;
allow_multiselect: boolean;
layout_type: PollLayoutType;
results?: PollResultPayload;
}

export interface PollCreateRequestPayload {
question: PollMediaPayload;
answers: PollAnswerPayload[];
expiry: string | null;
allow_multiselect: boolean;
layout_type?: PollLayoutType;
}

export enum PollLayoutType {
DEFAULT = 1,
}

export interface PollMediaPayload {
text?: string;
emoji?: EmojiPayload;
}

export interface PollAnswerPayload {
answer_id: number;
poll_media: PollMediaPayload;
}

export interface PollResultPayload {
is_finalized: boolean;
answer_counts: PollAnswerCountPayload[];
}

export interface PollAnswerCountPayload {
id: number;
count: number;
me_voted: boolean;
}

export interface GetAnswerVotersParams {
after?: string;
limit?: number;
}

export interface GetAnswerVotersResponse {
users: UserPayload[];
}
1 change: 1 addition & 0 deletions types/src/teams/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./team.ts";
9 changes: 8 additions & 1 deletion types/src/applications/team.ts → types/src/teams/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ export interface TeamPayload {

export interface TeamMemberPayload {
membership_state: MembershipState;
permissions: ["*"];
team_id: string;
user: UserPayload;
role: string;
}

export enum MembershipState {
INVITED = 1,
ACCEPTED = 2,
}

export enum TeamMemberRole {
OWNER = "",
ADMIN = "admin",
DEVELOPER = "developer",
READ_ONLY = "read_only",
}

0 comments on commit ebeca64

Please sign in to comment.