Download src/channels/plugins/normalize/slack.ts from Darochin/openskynet: direct link, hf CLI and curl.
- Browser
- Download file 663 Bytes
-
https://huggingface.co/Darochin/openskynet/resolve/main/src/channels/plugins/normalize/slack.ts
- Command line
-
hf download hf://Darochin/openskynet/src/channels/plugins/normalize/slack.ts
-
curl -L -o slack.ts https://huggingface.co/Darochin/openskynet/resolve/main/src/channels/plugins/normalize/slack.ts
663 Bytes
| import { parseSlackTarget } from "../../../slack/targets.js"; | |
| export function normalizeSlackMessagingTarget(raw: string): string | undefined { | |
| const target = parseSlackTarget(raw, { defaultKind: "channel" }); | |
| return target?.normalized; | |
| } | |
| export function looksLikeSlackTargetId(raw: string): boolean { | |
| const trimmed = raw.trim(); | |
| if (!trimmed) { | |
| return false; | |
| } | |
| if (/^<@([A-Z0-9]+)>$/i.test(trimmed)) { | |
| return true; | |
| } | |
| if (/^(user|channel):/i.test(trimmed)) { | |
| return true; | |
| } | |
| if (/^slack:/i.test(trimmed)) { | |
| return true; | |
| } | |
| if (/^[@#]/.test(trimmed)) { | |
| return true; | |
| } | |
| return /^[CUWGD][A-Z0-9]{8,}$/i.test(trimmed); | |
| } | |