- Extended PluginHookMessageSentEvent to include usage stats (tokens, model, provider, duration) - Extended PluginHookMessageContext to include sessionKey and agentId - Wired up runMessageSent hook call in dispatch-from-config.ts after final replies - Added discord-status example plugin demonstrating how to use the hook The message_sent hook now fires after each reply is delivered, enabling plugins to: - Track token usage across sessions - Update external status indicators (e.g., Discord bot presence) - Log message delivery for analytics/monitoring Note: Full Discord presence support requires exposing setPresence via PluginRuntime. The example plugin currently logs the status it would set.
43 lines
1.1 KiB
JSON
43 lines
1.1 KiB
JSON
{
|
|
"id": "discord-status",
|
|
"name": "Discord Status",
|
|
"version": "0.1.0",
|
|
"description": "Updates Discord bot status with session context usage after each message",
|
|
"author": "Clawdbot Contributors",
|
|
"homepage": "https://github.com/clawdbot/clawdbot",
|
|
"entrypoint": "./index.ts",
|
|
"configSchema": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"enabled": {
|
|
"type": "boolean",
|
|
"description": "Enable Discord status updates"
|
|
},
|
|
"format": {
|
|
"type": "string",
|
|
"description": "Status format string. Use {tokens} for token count.",
|
|
"default": "📊 {tokens} tokens"
|
|
},
|
|
"activityType": {
|
|
"type": "string",
|
|
"enum": ["Playing", "Watching", "Listening", "Competing", "Custom"],
|
|
"description": "Discord activity type",
|
|
"default": "Custom"
|
|
}
|
|
}
|
|
},
|
|
"uiHints": {
|
|
"enabled": {
|
|
"label": "Enable Status Updates"
|
|
},
|
|
"format": {
|
|
"label": "Status Format",
|
|
"placeholder": "📊 {tokens} tokens"
|
|
},
|
|
"activityType": {
|
|
"label": "Activity Type"
|
|
}
|
|
}
|
|
}
|