Here are my Apps Script commands definition and the function:
function setBotCommands() {
const BOT_COMMANDS = [
{
command: "start",
description: "Start"
},
{
command: "joke",
description: "Chucke jokes"
}
];
var bot = new Bot(botToken, {});
var result = bot.request('setMyCommands?commands=', BOT_COMMANDS);
Logger.log(result);
var cmdtmp = bot.request('getMyCommands');
Logger.log(cmdtmp);
}
which passes ok, but getMyCommands returns an empty array:
6:23:40 AM Notice Execution started
6:23:40 AM Info {ok=true, result=true}
6:23:40 AM Info {result=[], ok=true}
6:23:40 AM Notice Execution completed
Request is defined as follows:
Bot.prototype.request = function (method, data) {
var options = {
'method' : 'post',
'contentType': 'application/json',
'payload' : JSON.stringify(data)
};
var response = UrlFetchApp.fetch('https://api.telegram.org/bot' + this.token + '/' + method, options);
if (response.getResponseCode() == 200) {
return JSON.parse(response.getContentText());
}
return false;
}
Any assumptions, what have I missed here? Thanks!