From 1c2ee551967c293d7e1d0c88634f4c8c3c51a361 Mon Sep 17 00:00:00 2001 From: martincupela Date: Fri, 15 Nov 2024 12:25:57 +0100 Subject: [PATCH] feat: add typescript support for moderation V2 payload in message response --- src/types.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/types.ts b/src/types.ts index a84e196de..bf80fc449 100644 --- a/src/types.ts +++ b/src/types.ts @@ -678,7 +678,8 @@ export type MessageResponseBase< latest_reactions?: ReactionResponse[]; mentioned_users?: UserResponse[]; message_text_updated_at?: string; - moderation_details?: ModerationDetailsResponse; + moderation?: ModerationResponse; // present only with Moderation v2 + moderation_details?: ModerationDetailsResponse; // present only with Moderation v1 own_reactions?: ReactionResponse[] | null; pin_expires?: string | null; pinned_at?: string | null; @@ -713,6 +714,18 @@ export type ModerationHarmResponse = { phrase_list_ids: number[]; }; +export type ModerationAction = 'bounce' | 'flag' | 'remove' | 'shadow'; + +export type ModerationResponse = { + action: ModerationAction; + original_text: string; + blocklist_matched?: string; + image_harms?: string[]; + platform_circumvented?: boolean; + semantic_filter_matched?: string; + text_harms?: string[]; +}; + export type MuteResponse = { user: UserResponse; created_at?: string;