Skip to content

The Weather Bot is a bot on the Telegram platform designed to help you get real-time information about the weather in your city.

License

Notifications You must be signed in to change notification settings

lucapwn/weather-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather Bot

The Weather Bot is a bot on the Telegram platform designed to help you get real-time information about the weather in your city.

Badge Badge

Content

About

The Weather Bot was developed in Python using the python-telegram-bot library to perform integration with the Telegram platform, thus enabling communication with all users in real time.

To get the weather information for the city in which the user reported to the bot, the Visual Crossing Weather API provided by RapidAPI was used.

Support

This software is available for Windows and GNU/Linux operating systems.

I have not been able to test it on macOS yet, but I believe it will work as well.

Setting

To create the bot, it is necessary to have a Telegram account. If you do not have an account, please create one.

To get the climate information, as mentioned above, we need to use an API. To do this, if you do not have a RapidAPI account, please create one.

Getting the tokens

After you have created the above accounts, let's create the bot itself. Inside Telegram, open a conversation with @BotFather and create a bot with the command /newbot. Next, enter the name and username of your bot.

Create.mp4

If all went well, you will receive a message with your bot's token similar to this one:

2763282781:AAEnulN_nH9f2Sr2j_vl5mi8Fw9XskzLf4s

Now, navigate to the RapidAPI site, search for Visual Crossing Weather (or click next to it), and click "Subscribe to Test".

Finally, under "Header Parameters" you will see your X-RapidAPI-Key similar to this one:

4999cb7e22mkh7491sba992e1f76px63690jsnfedaeadzf15x

Saving the tokens

After getting the tokens, we need to save them.

Create a file in the project root called .env and insert the content below:

TELEGRAM_BOT_TOKEN="2763282781:AAEnulN_nH9f2Sr2j_vl5mi8Fw9XskzLf4s"
RAPID_API_TOKEN="4999cb7e22mkh7491sba992e1f76px63690jsnfedaeadzf15x"

Note: Enter your real tokens, not the tokens in the example above.

Running

Install the project dependencies:

foo@bar:~$ pip3 install -r ./requirements.txt

Run the main file:

foo@bar:~$ python3 ./main.py

If all goes well, you will see a success message. That's it! :)

Getting weather information

Finally, inside Telegram, search for the username of the bot you created and send a message from your city name.

Screenshot

The video below illustrates the conversation with the running Weather Bot.

Running.mp4

Author

Developed by Lucas Araújo.

License

This software is MIT licensed.

About

The Weather Bot is a bot on the Telegram platform designed to help you get real-time information about the weather in your city.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages