'Text length filter Google Apps Script
I create a telegram bot, which collects user info into gSheets. I want to create a filter. If the user wrote less than 10 symbols, bot says that this is not enough. When I tested it, bot just stopped, but JSON was still coming and being processed.
function doPost(e) {
let contents = JSON.parse(e.postData.contents);
let chat_id = contents.message.chat.id;
let text = contents.message.text;
if (text.length > 10) {
sendText(chat_id,"✅ Great!");
}
else (text.length < 10) {
sendText(chat_id,"😔 Its not enough.");
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|