refactor: add inbound context helpers
This commit is contained in:
11
src/channels/chat-type.ts
Normal file
11
src/channels/chat-type.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export type NormalizedChatType = "direct" | "group" | "channel";
|
||||
|
||||
export function normalizeChatType(raw?: string): NormalizedChatType | undefined {
|
||||
const value = raw?.trim().toLowerCase();
|
||||
if (!value) return undefined;
|
||||
if (value === "direct" || value === "dm") return "direct";
|
||||
if (value === "group") return "group";
|
||||
if (value === "channel" || value === "room") return "channel";
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user