Discord Weather Bot

Phase 1 — Core Weather Queries

  • Implement a Python Discord bot.
  • Slash commands for basic weather info:
    • /weather city:<city> → shows current weather
    • /forecast city:<city> → shows short-term forecast (next 3 days)
  • Use a public weather API (OpenWeatherMap, WeatherAPI, etc.)
  • Handle invalid city names or API errors gracefully

Functional result: Users can type /weather London and receive a nicely formatted embed with the current weather.


Phase 2 — User Preferences & Database Integration

  • Store per-user default settings in a database (SQLite/PostgreSQL):
    • Default city
    • Units (metric/imperial)
  • Slash commands for preferences:
    • /setcity city:<city> → set default city
    • /setunits unit:<metric|imperial> → set preferred units
  • If a command is issued without a city, the bot uses the user’s default city

Functional result: Users can personalize the bot and get weather info without typing the city every time.


Phase 3 — Enhanced Features & Info Types

  • Additional slash commands:
    • /air city:<city> → shows air quality index
    • /alerts city:<city> → severe weather alerts
    • /time city:<city> → current local time
  • Include error handling and user-friendly messages for unknown cities or API issues

Functional result: Bot provides richer information about the queried cities.


Phase 4 — Advanced Usability & Logging

  • Log per-user command history in the database:
    • Track which cities were queried and when
    • Optional command: /history → shows user’s query history
  • Daily weather notifications:
    • /subscribe → subscribe to daily updates for default city
    • /unsubscribe → remove subscription

Functional result: Bot is robust, logs activity, and supports subscriptions.