Skip to content

[Bug]: Plugin registerCommand handler not invoked for Telegram inline button callback_query in DMs #28659

@kilhyeonjun

Description

@kilhyeonjun

Summary

When a plugin registers a command via api.registerCommand() and returns inline keyboard buttons (via channelData.telegram.buttons), clicking those buttons works correctly in group forum topics but does nothing in DMs — the handler is never invoked and no log output appears.

The command itself works fine in DMs when typed manually (e.g. /limits), confirming the handler registration is correct. Only the callback_query routing path fails in DM context.

Steps to reproduce

  1. Create a plugin that registers a command with inline buttons:
export default function (api: any) {
  api.registerCommand({
    name: "example",
    description: "Test inline buttons",
    acceptsArgs: true,
    handler: (ctx: any) => {
      const args = (ctx.args || "").trim();
      console.log(`[example] handler invoked, args="${args}"`);
      if (args === "action") {
        return { text: "Action executed!" };
      }
      return {
        text: "Choose an action:",
        channelData: {
          telegram: {
            buttons: [[{ text: "Run Action", callback_data: "/example action" }]]
          }
        }
      };
    }
  });
}
  1. In a Telegram group forum topic, type /example → inline button appears → click "Run Action" → handler fires with args="action"
  2. In a Telegram DM with the bot, type /example → inline button appears → click "Run Action" → nothing happens

Evidence from logs

Group topic — handler invoked on button click:

[provider-limits] args="run:status" from=telegram:group:-XXXXX:topic:19 to=telegram:-XXXXX messageThreadId=19
[provider-limits] args="send" from=telegram:group:-XXXXX:topic:19 to=telegram:-XXXXX messageThreadId=19

DM — handler invoked for typed command, but NOT for button click:

# Typed /limits in DM → handler fires:
[provider-limits] args="" from=telegram:XXXXX to=telegram:XXXXX messageThreadId=undefined

# Clicked inline button in DM → no log at all (handler never invoked)

Expected behavior

callback_query from inline buttons in DMs should route to the plugin's registerCommand handler, same as it does in group forum topics.

Environment

  • OpenClaw version: 2026.2.26
  • Channel: Telegram
  • OS: macOS (darwin)
  • Node: 22.x / 25.x (gateway subsystem)
  • Bot config: dmPolicy: "pairing", groupPolicy: "allowlist" (set at account level)

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions