To use this, you'll need.
- Telegram bot Token
- A google account
- Spreadsheet IDs to the necessary in google sheet format (upload files from this folder to google drive and convert to google sheets files through
File > Save as Google Sheets
) Furthermore, create an empty spreadsheet to be used as a logsheet for logger!
-
With npm installed, install clasp globally
npm install -g @google/clasp
-
Run
yarn
to install dependencies -
Enable the Google Apps Script API
-
Then login to Google,
clasp login
-
Create the google app,
clasp create --title "Eusoff Gym Bot" --type webapp --rootDir src
-
Copy
config.js.example
intoconfig.js
, replace all placeholder values with your own, except for deployment id. -
Deploy it using
clasp deploy
to get the deployment id.Take note of the deployment id after
Created version x
e.g.Created version 1. - <<YOUR DEPLOYMENT ID HERE>> @1.
-
Now set the deployment id in
secret.js
along with the bot token and sheet ids. -
Run
clasp push
andclasp deploy -i <<YOUR DEPLOYMENT ID HERE>>
to push your code to Google Scripts and deploy it again -
Run
clasp open
to open it in google script -
Click
config.js
, and clickRun > Run Function > setWebHook
-
It will ask you to authorise (for the first time), and it should be ok to do so, click
Advanced > Go to Eusoff Gym Bot (unsafe) > Allow
-
Open the app by
clasp open --webapp
, select the version with your deployment id to open. (This will automatically reset the telegram bot's webhooks)
- When you want to update your telegram bot with the current code, use
clasp push && clasp deploy -i <<YOUR DEPLOYMENT ID>>