Discord AI Dispatcher
/install discord-ai-dispatcher
Generic Webhook Notifier: Advanced Skill Guide
The Webhook Notifier skill provides a robust architecture that combines hard heuristics with local AI reasoning tools to ensure 100% routing accuracy and high-density visual formatting.
🚀 The High-Consistency Architecture: Deterministic Routing
Instead of relying solely on AI categorization, this dispatcher implements a Deterministic Prefix Engine to ensure 100% routing accuracy:
- Prefix Identification: An
updateId(e.g.,systemevent00100) directly dictates the target channel.systemevent-> Infrastructure Eventsappalert-> Application Monitoringuserupdate-> User Activity
- Zero-Guessing: This removes "Classification Drift" where an AI might misinterpret an update, ensuring data always reaches the correct stakeholders.
🔢 Deterministic Sequential Deduplication
To handle out-of-order API deliveries or network retries, the dispatcher uses a Sequential State Tracker:
- Logic: It extracts a numeric suffix from the ID (the
XXXXXinprefixXXXXX). - State: The highest seen ID for each category is stored locally.
- Rule: Use Numeric Comparison (
100 > 99) instead of Alphabetical (100 \x3C 99). Regex-extract digits[^\d]and cast to[long]to ensure the sequence advances even as ID lengths change. - Result: You never see a stale update overwrite new data, and duplicate notifications are prevented.
🔒 Global Pipeline Locking (Self-Protection)
To prevent race conditions and file corruption when the AI takes longer than the polling interval:
- Lock File: Create a
dispatcher.lockat the start of the orchestrator. - Abort Logic: If a lock exists and is "fresh" (\x3C 30 mins), the next pulse must exit immediately.
- Atomic Recovery: Always use
try/finallyblocks to ensure the lock is released even if the script crashes.
🏗️ Self-Healing JSON Recovery
State files can be corrupted by power loss or interrupted writes.
- Integrity Checks: Wrap every
ConvertFrom-Jsoncall in atry/catch. - Auto-Reset: If parsing fails, log the corruption, delete the broken file, and re-initialize the state from the API source.
- Benefit: The system self-recovers from disk errors without manual developer intervention.
🩹 The "Healing Cleaner" Pattern
Instead of a "Negative Filter" (which deletes bad formatting), this skill uses a Positive Healing logic to repair inconsistent AI output:
- Label Extraction: It scans for colons and automatically wraps the text before them in
**Bold Labels**. - Normalization: It forcefully standardizes fluctuating terms to established vocabulary.
- Noise Blacklist: It aggressively strips AI conversational filler.
- Artifact Stripping: It cleans up redundant formatting artifacts (
** **), escaped characters, and unwanted markdown blocks.
- Result: You get a professional, uniform feed even if the AI model gets "creative".
📊 Dashboard Mode (Clean Chat Strategy)
Prevent chat clutter by updating existing messages instead of posting new ones.
- Logic: Use
PATCH(or corresponding update paradigm) instead ofPOSTfor webhooks. - State: Store the created message ID in a local state file.
- Advantage: Provides a single "Living" source of truth for your system status without generating unnecessary notification spam.
🪙 Token & Cost Optimization
...
- Payload Pruning: Strip all non-essential JSON keys before the AI sees them.
- Compressed Instructions: Use strict list-based prompts instead of paragraphs.
- Low Effort Fallback: If the AI is offline, use a hardcoded template for high availability.
🧠 The AI Improvement Layer: Learning From Gaps
The Webhook Notifier is built to be a self-improving system. When a gap is found, the agent must shift from Monitor to Diagnostician:
1. The RCA Feed (Log Diagnostics)
Instead of guessing, the agent must scan the dispatcher.log for the "Missing IDs":
- Skipped (
duplicate) but not Delivered: Indicates the deduplication logic was too aggressive (Historical Logic Flaw). - Timeout: Indicates the Local LLM needs a higher timeout or more GPU resources.
- No Log Record: Indicates a failure at the Poller or API fetch stage.
2. Strategic Improvement Loop
When the user feeds you an RCA report, you should automatically suggest (or implement) one of the following:
- State Realignment: Resetting
last-seen-ids.jsonorpolling-state.jsonto the actual last-delivered marker to ensure the "Gaps" are re-sent. - Logic Tuning: If sequential IDs are conflicting with timestamp IDs, adjust the
Test-IsSequentialDuplicatehelper to be more specific. - High-Precision Recovery: Creating a one-time "Healing Queue" to force-inject missed notifications into Discord.
🛡️ Recovery Best Practices:
- Bypass Deduplication: When in "Heal Mode", always bypass the
Test-IsSequentialDuplicatefilter to ensure recovery happens. - Audit History: Perform a "Log Audit" before making changes. Never assume a file is missing just because it's not in the DB—always check the logs to confirm if the Dispatcher ever saw it.
🎨 Best Practices for Professional Formatting
To maintain aesthetics and readability:
- Mandatory Bolding: Always wrap labels in visual emphasis (e.g., Key: Value).
- Horizontal Dividers: Every notification should logically separate from the next.
- Tool-Calling First: Calculate your metrics in code; use the AI only for the final beautification.
⚙️ Automation & Version Compatibility
- Scheduling Reliability: Use Headless Discrete Execution (Windows Task Scheduler / Cron). Avoid infinite
while($true)loops to prevent memory leaks and handle system reboots gracefully. - PowerShell 5.1 Compatibility:
- Hashtables: Modern PS 7.0
-AsHashtablefails in 5.1. Use manual property-looping to convert PSCustomObjects into Hashtables for reliable$state[$key]access. - Encoding: Always specify
-Encoding UTF8onSet-Contentto prevent character corruption in mixed-version environments.
- Hashtables: Modern PS 7.0
- Webhook First: Always provide users the option to setup webhooks immediately after configuring the skill for instant "out-of-box" operation.
Designed for extensible and robust notification pipelines.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install discord-ai-dispatcher - 安装完成后,直接呼叫该 Skill 的名称或使用
/discord-ai-dispatcher触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Discord AI Dispatcher 是什么?
Routes Discord notifications with a two-tier system using hardcoded rules and local AI, supports message updates to reduce clutter, and optimizes resource use. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 156 次。
如何安装 Discord AI Dispatcher?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install discord-ai-dispatcher」即可一键安装,无需额外配置。
Discord AI Dispatcher 是免费的吗?
是的,Discord AI Dispatcher 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Discord AI Dispatcher 支持哪些平台?
Discord AI Dispatcher 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Discord AI Dispatcher?
由 bhupendrafire-ai(@bhupendrafire-ai)开发并维护,当前版本 v1.7.8。