请帮我解决一下我的问题? 我需要: 找到所有“var text = data.message.text;”在电子表格中 并在同一行发送文本但下一个colomn发送到电报 例如: 电子表格: 111 7 sdf sdfsd 222 4 sdv asdfasdf 333 11 sdfs sdfsdfsdf 222 15 sdf sdfsdfsdf 555 3 asdf asdfasdfas
if the user in telegram enters 222
bot has to send him:
4
15
I will be very grateful to you!!!
spreadsheet can be like this:
Genri 111 7 sdf sdfsd
Ford 222 4 sdv asdfasdf
Suzi 333 11 sdfs sdfsdfsdf
in Delphi it seems like this
for example spreadsheet placed in array a
For i:=1 to maxColomns do
For j:=1 to maxRaws do
if a[i,j]=text then sendText(id,a[i,j+1]);
but i don't know the functions in gs(((
Telegram script bot
youtube.com - Telegram Bot Tutorial: How to connect your Telegram Bot to a Google Spreadsheet (Apps Script)
// FULL SCRIPT BELOW:
// How to connect your Telegram Bot to a Google Spreadsheet (Google Apps Script)
// https://www.youtube.com/watch?v=mKSXd...
//
// FILL IN THE GLOBAL VARIABLES token, webAppUrl and ssId
//
var token = ""; // FILL IN YOUR OWN TOKEN
var telegramUrl = "https://api.telegram.org/bot" + token;
var webAppUrl = ""; // FILL IN YOUR GOOGLE WEB APP ADDRESS
var ssId = ""; // FILL IN THE ID OF YOUR SPREADSHEET
function getMe() {
var url = telegramUrl + "/getMe";
var response = UrlFetchApp.fetch(url);
Logger.log(response.getContentText());
}
function setWebhook() {
var url = telegramUrl + "/setWebhook?url=" + webAppUrl;
var response = UrlFetchApp.fetch(url);
Logger.log(response.getContentText());
}
function sendText(id,text) {
var url = telegramUrl + "/sendMessage?chat_id=" + id + "&text=" + text;
var response = UrlFetchApp.fetch(url);
Logger.log(response.getContentText());
}
function doGet(e) {
return HtmlService.createHtmlOutput("Hi there");
}
function doPost(e) {
// this is where telegram works
var data = JSON.parse(e.postData.contents);
var text = data.message.text;
var id = data.message.chat.id;
var name = data.message.chat.first_name + " " + data.message.chat.last_name;
var answer = "Hi " + name + ", thank you for your comment " + text;
sendText(id,answer);
SpreadsheetApp.openById(ssId).getSheets()[0].appendRow([new Date(),id,name,text,answer]);
if(/^@/.test(text)) {
var sheetName = text.slice(1).split(" ")[0];
var sheet = SpreadsheetApp.openById(ssId).getSheetByName(sheetName) ? SpreadsheetApp.openById(ssId).getSheetByName(sheetName) : SpreadsheetApp.openById(ssId).insertSheet(sheetName);
var comment = text.split(" ").slice(1).join(" ");
sheet.appendRow([new Date(),id,name,comment,answer]);
}
}