refactor: generalize channel type handling across various components
This commit is contained in:
@@ -519,10 +519,11 @@ export function createHeartbeatTickTool(api: OpenClawPluginApi) {
|
||||
skipped: result.skipped.length,
|
||||
});
|
||||
|
||||
// Send heartbeat notification to orchestrator DM
|
||||
// Send heartbeat notification back to whoever triggered it
|
||||
// Both channel and target are derived from context (DM sessionKey)
|
||||
const notifyConfig = getNotificationConfig(pluginConfig);
|
||||
const orchestratorDm = pluginConfig?.orchestratorDm as string | undefined;
|
||||
|
||||
const orchestratorDm = context.type === "direct" ? context.chatId : undefined;
|
||||
|
||||
await notify(
|
||||
{
|
||||
type: "heartbeat",
|
||||
@@ -541,7 +542,7 @@ export function createHeartbeatTickTool(api: OpenClawPluginApi) {
|
||||
workspaceDir,
|
||||
config: notifyConfig,
|
||||
orchestratorDm,
|
||||
channel: "telegram",
|
||||
channel: "channel" in context ? context.channel : undefined,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ export function createProjectRegisterTool(api: OpenClawPluginApi) {
|
||||
// Provide helpful note if project is already registered
|
||||
const contextInfo = context.projectName
|
||||
? `Note: This group is already registered as "${context.projectName}". You may be re-registering it.`
|
||||
: `Registering project for this ${context.channel === "whatsapp" ? "WhatsApp" : "Telegram"} group (ID: ${actualGroupId.substring(0, 20)}...).`;
|
||||
: `Registering project for this ${context.channel} group (ID: ${actualGroupId.substring(0, 20)}...).`;
|
||||
|
||||
// 1. Check project not already registered (allow re-register if incomplete)
|
||||
const data = await readProjects(workspaceDir);
|
||||
@@ -205,6 +205,7 @@ export function createProjectRegisterTool(api: OpenClawPluginApi) {
|
||||
baseBranch,
|
||||
deployBranch,
|
||||
autoChain: false,
|
||||
channel: context.channel,
|
||||
roleExecution,
|
||||
dev: emptyWorkerState([...DEV_TIERS]),
|
||||
qa: emptyWorkerState([...QA_TIERS]),
|
||||
|
||||
@@ -298,8 +298,7 @@ export function createTaskCompleteTool(api: OpenClawPluginApi) {
|
||||
workspaceDir,
|
||||
config: notifyConfig,
|
||||
groupId,
|
||||
// Channel detection: default to telegram if not available
|
||||
channel: "telegram",
|
||||
channel: project.channel ?? "telegram",
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user