Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I need help in my apps script #50

Open
mbino94 opened this issue May 7, 2022 · 1 comment
Open

I need help in my apps script #50

mbino94 opened this issue May 7, 2022 · 1 comment

Comments

@mbino94
Copy link

mbino94 commented May 7, 2022

Hello,
I've been looking for a solution for since a week
I will explain it here hoping to get help

i made a script that interacts with telegram using Apps script and i have a spreadsheet which has a database...
3 columns 500 rows

ID , Username, Full Name

i want to make a command for tg bot like when i send /who "ID NUMBER" it looks up in the spreadsheet in first columns for that specific ID NUMBER and sends back the Full name of it

here is my apps script

var ssId = "16Rw-ilDTdozSHOn73I0fhXeaTJuixyQOp7BDDXfY9Cs";

function setWebhook() {
var url = telegramUrl + "/setWebhook?url=" + webAppUrl;
var response = UrlFetchApp.fetch(url);
}

function sendMessage(id, text,) {
var url = telegramUrl + "/sendMessage?chat_id=" + id + "&text=" + text;
var response = UrlFetchApp.fetch(url);
}
function doPost(s) {

var contents = JSON.parse(s.postData.contents);
var id = contents.message.from.id; // user ID
var name = contents.message.from.first_name; // Sender First name
var uname = contents.message.from.username; // Sender Username
var text = contents.message.text; // Message Text

if (text.includes("/who")) {

var result = text.substr(text.indexOf(" ") + 1);; // this line removes the first word from the Message`
@mbino94
Copy link
Author

mbino94 commented May 7, 2022

Simple example
Var result =138 // im looking for the full name of this id
I want the script to lookup in the sheet for that id in the first column in every row
If its in A83 i want to put C83 value in a var found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant