var simpletemplate = new SimpleTemplate(generalMessage like textMessage,buttonList,responseType like "Text");
var button = new Button(text like "salam",value like "/hello",1);
simpleTemplate.addbtn(button); var templateMessage = new
TemplateMessage(simpleTemplate);

此示例代码无效
按钮列表??
按钮??
addbtn不存在

最佳答案

这是伪代码,不起作用
如果要通过bot发送模板消息,可以使用以下代码

const TextMessage = BaleBotPlatform.TextMessage;
const SimpleTemplate = BaleBotPlatform.SimpleTemplate;
const TemplateMessage = BaleBotPlatform.TemplateMessage;
const Button = BaleBotPlatform.ButtonElement;

simpleTemplate = new SimpleTemplate(new TextMessage("hello world"), [new Button("first","first",1),new Button("second","second",1)] , "1")
templateMessage = new TemplateMessage(simpleTemplate)

07-26 06:54