Serverless Telegram bot on Google infrastructure using Google App Script Telegram Bot Wrapper .
This bot is developed to fight spammers/userbot in public group. Meant to be used on single public group and self-hosted on your own Google account.
- Go to script.google.com/start to open the script editor.
- Delete any code in the script editor and paste in the code.
- Create two (2) new Google Spreadsheets and DO NOT change anything in there.
- Replace the constants tgBotToken, botSheet, loggerSheet (line 1-3) with your own.
- Click on the menu item Libraries and add BetterLog script ID
1DSyxam1ceq72bMHsE6aOVeOl94X78WCwiYPytKi7chlg4x5GqiNXSw0l
- Choose a version in the dropdown box (usually best to pick the latest version).
- Add our core library Nahfar script ID
1dPQyiqL_uRGhDvZtgDOEf-RoDdgMtZx6KjfBf-Zzty3HtXp9TuctHET6
- Choose a version in the dropdown box (usually best to pick the latest version).
- Save your new script.
- Click Deploy and select New Deployment.
- Select Type as Web app.
- Under execute the app as (Execute as), select your account.
- Under Who has access to the app, select Anyone.
- Click Deploy.
- Copy the URL labeled Web app URL.
- Replace the constant webAppURL in the script (need to do this on every new deploy).
- Replace the constant botHandlerName in the script with your own bot handler.
- Run setWebHook function (need to do this on every new deploy).
- Run oneTimeSetup function (only do this once).
- Run scheduler function (only do this once).
- Now your Telegram bot is up and running.
- /start payload
- /whoami
Feature | Consumer and G Suite free edition (legacy) | Google Workspace accounts |
---|---|---|
Script runtime | 6 min / execution | 6 min / execution |
Custom function runtime | 30 sec / execution | 30 sec / execution |
Simultaneous executions | 30 | 30 |
Triggers | 20 / user / script | 20 / user / script |
Triggers total runtime | 90 min / day | 6 hr / day |
URL Fetch calls | 20,000 / day | 100,000 / day |
URL Fetch response size | 50 MB / call | 50 MB / call |
URL Fetch headers | 100 / call | 100 / call |
URL Fetch headers size | 8 KB / call | 8 KB / call |
URL Fetch POST size | 50 MB / call | 50 MB / call |
URL Fetch URL length | 2 KB / call | 2 KB / call |
Properties read/write | 50,000 / day | 500,000 / day |
Source: Quotas for Google Services