Telegram bot that notifies when it's sunny - https://t.me/SunnyNotificationBot

This bot is still in beta, and you must be added to allow list in order to interact with it. Feel free to clone and run locally.
There's also a web app, but it doesn't send notification.
As in every bot, start by sending the /start command.
Send command /subscribe to subscribe and then send location. The location must be in Germany, doesn't have to be exact, and unfortunately doesn't work from telegram web. The /location command is an alternative. Location can be updated at any time.
The bot sends daily forecast in the morning and update notification if it's sunny every hour.
| Command | Description |
|---|---|
/start |
Description |
/help |
List of commands |
/subscribe |
Subscribe to Sunny notification bot. This saves user preferences such as location |
/forecast or /f |
Get today's forecast. Add number (ex ./f 1) to see tomorrow's forecast. Applicable numbers are -1 (yesterday) to 3 |
/location |
Check location used for forecast. |
/location lat lon |
Update location with latitude and longitude, separated by comma. Example /location 52.521,13.295. |
/notifications |
Change or check notification preferences. |
/unsubscribe |
Delete user data from system |
/me |
User info |
Sending location using Telegram app updates your preference.
Missing a feature? Found a bug? Please create an issue.
In this repository there are Telegram bot and web app.
After first time setup, run the bot with
npm startor the web app with
npm run build:web
npm run preview:web-
Clone and install
git clone https://github.com/NoamRa/sunny-notification-bot.git cd sunny-notification-bot npm install
-
Fill
.envfilecp example.env .env -
Add the bot's token from BotFather and allowed users
-
To develop the bot, run
npm run dev:botor the web app
npm run dev:web
- Add start:unattended command to
/etc/rc.localor any startup script:cd /path/to/sunny-notification-bot npm run start:unattended & cd -
- If not working, check
/var/log/syslog, or better yetcat /var/log/syslog | grep -B 3 -A 3 sunny-notification-bot - If git throws with "detected dubious ownership in repository", run
sudo git config --global --add safe.directory /path/to/sunny-notification-bot
- If not installed already, install pm2 and set up autostart using
pm2 startup - Navigate to project root and register sunny-notification-bot with pm2:
pm2 start ecosystem.config.cjs
- Save setup with
pm2 save
- Configure target on chrome://inspect/#devices to
match server's IP address ex:
192.168.0.123:9229. - Use the
inspectoption with0.0.0.0:9229as host:node --inspect=0.0.0.0:9229 --max-old-space-size=abc ./src/bot.js
- Server should appear as remote target. Click inspect to open Chrome DevTools.
The web app is deployed to Github pages using merging a PR. It will be live at https://noamra.github.io/sunny-notification-bot/.
Please do. npm run test is all you need.
Since tests rely on mocked data, and since sometimes the algorithm changes and we need data in different ways, there's a script called create-mocks.js to read historical data from Open-Meteo. Call npm run create-mocks to update openMeteo.mocks.js.
Adding new mocks can be done by appending to the DATES_TO_GET object in create-mocks.js.