Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

☁️ Weather Discord Bot

A simple and fast Discord bot that fetches real-time weather info for any city using WeatherAPI.
Built with Python and discord.py, and deployable for free on Railway.


🚀 Features

  • 🌤 Slash command: /weather [city]
  • 🌡 Current temperature, humidity, and condition
  • 🔐 Secure secrets via .env or Railway variables
  • ⚡ Hosted for free using Railway (no port required)

🧱 Requirements


🗂 Project Structure

weather-discord-bot/
├── weatherapi_bot.py        # Main bot logic
├── requirements.txt         # Python dependencies
├── .env.example             # Environment variable template
└── README.md                # Project documentation

💻 Local Setup

  1. Clone the repository

    git clone https://github.com/YOUR_USERNAME/weather-discord-bot.git
    cd weather-discord-bot
  2. Install dependencies

    pip install -r requirements.txt
  3. Create a .env file

    DISCORD_TOKEN=your_discord_token
    WEATHER_API_KEY=your_weatherapi_key
    GUILD_ID=your_guild_id_as_number
  4. Run the bot

    python weatherapi_bot.py

🌐 Deploy to Railway (Recommended – Free)

  1. Go to https://railway.app

  2. Click “New Project” → “Deploy from GitHub Repo”

  3. Choose your weather-discord-bot repo

  4. Under the Variables tab, add:

    Key Value
    DISCORD_TOKEN Your Discord bot token
    WEATHER_API_KEY Your WeatherAPI key
    GUILD_ID Your Discord server ID
  5. Under Settings, change the Start Command to:

    python weatherapi_bot.py
  6. Click "Deploy" and check the logs for successful startup.


💬 Example Usage

/weather Tokyo
**Weather for Tokyo, Japan**
🌡 Temperature: 27°C (Feels like 29°C)
💧 Humidity: 60%
☁ Condition: Clear

🧪 .env.example

DISCORD_TOKEN=your_discord_token_here
WEATHER_API_KEY=your_weatherapi_key_here
GUILD_ID=your_guild_id_here

⚠️ Do not commit your real .env file.


🛠 Tech Stack


🤝 Contributing

Forks and pull requests are welcome!


📜 License

MIT — free to use and modify


👤 Author

Created by @qbcx

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages