Telegram bot where users can subscribe to weather forecast notification. Every day at the chosen time at UTC timezone this bot sends what weather is expected today.
- User can subscribe to the weather forecast.
- User can unsubscribe from the weather forecast.
- User can update the time when he wants to receive the weather forecast.
- User can update his location.
- User can receive the weather forecast in his location every day at the chosen time.
- The bot should be implemented using the Telegram Bot API.
- The bot should use MongoDB for data storage.
- Time should use UTC timezone.
- Time should be implemented using the process.env.TZ variable.
- The bot should use the OpenWeatherMap API to get the weather forecast.
- The bot should use the cron library to schedule the sending of the weather forecast.
- Cron and telegram bot should run in one process - to block application scalability.
- Start the bot by sending
/start
command. - Send
/subscribe
command to subscribe to the weather forecast. - Send
/unsubscribe
command to unsubscribe from the weather forecast. - Send
/update_time
command to update the time when you want to receive the weather forecast. - Send
/update_location
command to update your location.
/start
- Sending to user greeting message and possible commands buttons./subscribe
- Subscribing to the weather forecast.Running chain of questions to get the location and time when user wants to receive the weather forecast./unsubscribe
- Unsubscribing from the weather forecast./update_time
- Updating the time when user wants to receive the weather forecast./update_location
- Updating the user location to get forecast in updated location.
The bot stores the user data in the MongoDB database.
- telegram_id - Uniq Telegram user id.
- location - User location.
- notification_time - Time when user wants to receive the weather forecast.
model User {
telegram_id String @id @map("_id")
location Location
notification_time String
}
type Location {
lat Float
lon Float
}