Eusoff Meal Bot is a telegram bot that shows breakfast and dinner for Eusoff Hall for the current week.
It uses Google Apps Script as a webhook for the telegram bot.
Done by @glennjs
To use this, you'll need.
- Telegram bot Token
- A google account
- Spreadsheet IDs to the breakfast and dinner menus in google sheet format (upload files from this folder to google drive and convert to google sheets files through
File > Save as Google Sheets
)
-
With npm installed, install clasp globally
npm install -g @google/clasp
-
Install yarn. 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 Meal Bot" --type webapp --rootDir ./src
-
Add the file order from
.clasp.json.example
into.clasp.json
. -
Copy
secret.js.example
and make a new filesecret.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
Created version 1. - <<YOUR DEPLOYMENT ID HERE>> @1.
-
Now set the deployment id in
secret.ts
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
bot/utility.gs
, and clickRun > Run Function > setWebHook
Like so
-
It will ask you to authorise (for the first time), and it should be ok to do so, click
Advanced > Go to Eusoff Meal 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)This should be seen.
-
Open your telegram bot! It should show you the breakfast and dinner for the current week!
- When you want to update your telegram bot with the current code, use
clasp push && clasp deploy -i <<YOUR DEPLOYMENT ID>>