Simple weather Discord bot created for Codédex final project!
To clone repository, you can use Git client like GitKraken or Tower, or just simply type:
git clone https://github.com/pazurkota/weather_bot.git
Prerequisites:
- Discord Bot Token with all intents
- OpenWeather API key
To run this bot:
- Make sure you are running
Python 3.8
or newer - You need both
requests
anddiscord
packages installed:
python -m pip install requests
python -m pip install -U discord.py
- Create
data.json
file in root directory (whereprogram.py
is localized) with following data:
{
"token": "DISCORD BOT TOKEN",
"api_key": "API KEY FROM https://openweathermap.org/"
}
- Open project with PyCharm or any other IDE
- Run the project
The bot prefix is $
$weather <city>
- Get current weather for specified city$aqi <city>
- Get current air quality for specified city
If your location have more than one word, type name in quotes, e.g. $weather "New York"
This bot is simple, but some files are in separate folders for better organization:
data
- contains all methods to get data neither from API ordata.json
fileparse
- contains all methods to parse data from API and return it as Discord Embed
This was my first project with Python, so any feedback is appreciated! If you have any questions, feel free to ask me on Discord @pazurkota
Also, any suggestions for new features or contributions are welcome!