Skip to content

The problem is with the TON Bridge plugin #31

@xlabtg

Description

@xlabtg

The tool is called without the customMessage parameter, so params.customMessage = undefined.

What's going on:

  1. You are calling ton_bridge_custom_message(buttonText: "TON Bridge")
  2. params.customMessage = undefined (not transmitting)
  3. sdk.telegram.SendMessage(chatId, undefined) → crashes

How to fix it:

Add verification to customMessage:

execute: async (params, context) => {
try {
const customMessage = params.customMessage ||
sdk.pluginConfig?.customMessage ||
"TON Bridge — The #1 Bridge in the TON Catalog\n\nClick the button below to open TON Bridge Mini App.";

    const buttonText = params.buttonText ?? sdk.pluginConfig?.buttonText ?? "TON Bridge No1";
    const startParam = sdk.pluginConfig?.startParam ?? "";
    const url = buildUrl(startParam);
    
    const messageId = await sdk.telegram.sendMessage(
        context.chatId,
        customMessage,
        {
            inlineKeyboard: [[{ text: buttonText, url }]],
        }
    );
    // ...
}

}

We've worked with this before #25 - #30

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions