I welcome everyone to use my source code to create own Weather Bot.
There are several things I direct for all developers for the moment.
- Obtain your own token to access the HTTP API for your application.
- Obtain your own API key to get current weather in any part of the world.
- Please do use an individual file for all yous accesses, including your access to database (
config.py). - Kindly do use the
aiogramlibrary for telegram bot,pythonfor coding andaiohttpfor requests.
- Clone the project from GitHub (Windows compatibility):
git clone --recursive -j8 https://github.com/dorochka8/MoscowWeatherBot
- Install
requirements.txt(directly from https://github.com/dorochka8/MoscowWeatherBot/blob/main/requirements.txt to get all the libraries that are used in the project, VS Code compatibility). - Adjust configuration parameters:
- Modify the values in
config.py - Modify the values in
main_bot.py(token, str 14)
- (Optional) Change the information you want to send to user in
main_weather.py. According to json (str 19) choose the parameters you want to add or remove. - Start your Bot with running the
main_bot.pyfile. - Start your Website on localhost with:
> py main_flask.py
MoscowWeatherBot is used to build the Weather bot yourself. You will much more simplify your development by following the steps above.
Moreover to start a World-wide Weather Bot, follow these steps:
- Import all needed packages, Classes
MemoryStorage from aiogram.contrib.fsm_storage.memory
FSMContext from aiogram.dispatcher
StatesGroup from aiogram.dispatcher.filters.state
- Ask a user about the town he is interested in and this message will handle from user because of a StatesGroup Class.
- Enjoy!