A Telegram bot that provides users with real-time weather information for their chosen locations. The bot interacts with a microservice, which queries external weather APIs and returns the weather data.
- Interactive Telegram bot for weather queries.
- Real-time weather data retrieval from external sources.
- Logging for tracking user interactions and errors.
- Scala
- SBT (Scala Build Tool)
- Telegram Bot Token (obtained from BotFather on Telegram)
- API Key for OpenWeatherMap Weather Service
-
Clone the repository:
git clone https://github.com/frog-da/WeatherBotProject.git cd WeatherBotProject
-
Build the project using SBT:
sbt compile
To use the Weather Forecast Telegram Bot, follow these steps:
-
Start a conversation with the bot by searching for its username or by clicking the provided link.
-
Send a message or command to the bot. For example:
/weather CityName
to get the weather for a specific city.
/start
- Start a conversation with the bot./weather CityName
- Get the weather for a specific city.
The project is structured as follows:
-
src/
- Contains the source code for the bot and microservice. -
test/
- Contains test code. -
docs/
- Documentation and API reference.
Testing for this project has not been implemented yet.
Configuration settings, such as API keys, can be managed in the application.conf
file.
Logging is implemented using the log4cats library. Logs can be found in the logs/
directory.
Deployment for this Scala Telegram bot has not been implemented yet.
- 1.1. Create a new directory for your MVP project.
- 1.2. Initialize a new Scala project using your preferred build tool (e.g., SBT).
- 1.3. Set up a Git repository for version control and make an initial commit.
- 2.1. Create a new Telegram bot by talking to the BotFather on Telegram to obtain a bot token.
- 2.2. Implement the Telegram bot using the chosen library (e.g., Telegramium or Bot4s Telegram). Set up the bot token and basic configuration.
- 2.3. Develop the bot to respond to user messages and commands, focusing on the "/weather" command.
- 3.1. Define data models for weather information (e.g.,
WeatherResponse
) for the predefined city (e.g., "London"). - 3.2. Implement a microservice to interact with a single external weather API (e.g., OpenWeatherMap) using STTP.
- 3.3. Ensure the microservice can retrieve weather data for the predefined city and convert it into the data models.
- 3.4. Implement basic error handling in the microservice to handle potential issues during data retrieval.
- 4.1. Connect your Telegram bot with the microservice.
- 4.2. Implement logic to allow users to send a "/weather" command to the bot to request weather information for the predefined city.
- 4.3. Ensure the bot communicates with the microservice to retrieve weather data.
- 4.4. Send weather information back to users as a response message.
- 5.1. Write unit tests for the core functionality of the Telegram bot, including command processing and interaction with the microservice.
- 5.2. Develop basic integration tests to verify that the bot can retrieve weather data from the microservice.
- 5.3. Implement data retrieval tests for the microservice to validate its interaction with the external weather API.
- 6.1. Provide minimal documentation for users on how to initiate a conversation with the bot and request weather information using the "/weather" command.
- 7.1. Deploy the Telegram bot and microservice to a server or cloud platform for demonstration.