Skip to content

🌀️ A Discord bot that provides real-time, 3-day weather forecasts for any location! Built with Bun, TypeScript, and the Discord API, this bot lets users check weather and astrological information.

License

Notifications You must be signed in to change notification settings

AdrianTomin/discord-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌦️ Discord Weather Forecast Bot

This project is a Discord bot that provides weather forecasts for specified locations. It utilizes the WeatherAPI for weather data and the Discord API for bot interactions.

Built With:

Bun

TypeScript

Discord API

πŸ“– Table of Contents

✨ Features

  • Provides 3-day weather forecasts for a specified location.
  • Supports both metric and imperial units.
  • /forecast command for fetching weather information.
  • /astro command for fetching astrological information.

βš™οΈ Prerequisites

  • Bun – A fast all-in-one JavaScript runtime and package manager
  • TypeScript – A strongly typed programming language built on JavaScript

πŸ“₯ Installation

  1. Clone the repository:
    git clone https://github.com/AdrianTomin/discord-bot.git
    cd discord-bot
  2. Install dependencies: bun install

πŸ› οΈ Configuration

Create a .env file in the root of the project and add the required API keys as shown below:

DISCORD_TOKEN=your_discord_token_here
WEATHER_API_KEY=your_weatherapi_key_here
GUILD_ID=your_guild_id_here
CLIENT_ID=your_client_id_here

πŸ”‘ Getting API Keys

WeatherAPI Key (WEATHER_API_KEY)

  1. Go to WeatherAPI and sign up for a free account.
  2. Once logged in, navigate to your API key dashboard to retrieve your key.

Discord Bot Token (DISCORD_TOKEN)

  1. Go to the Discord Developer Portal.
  2. Create a new application or select an existing one.
  3. Add a bot to your application Under the Bot section, then copy the Token under the "Token" section.

Guild ID (GUILD_ID)

  1. Open Discord and navigate to your server.
  2. Right-click on the server name and select Copy ID (make sure Developer Mode is enabled in Discord settings).

Client ID (CLIENT_ID)

  1. In the Discord Developer Portal, go to your application.
  2. Copy the Application ID from the General Information section (this is your CLIENT_ID).

πŸš€ Running the Bot

You can run the bot after setting up your environment variables in the .env file.

bun run start

The bot should now be online and ready to respond to commands in your Discord server.

πŸ’¬ Commands

Command Options

/forecast

Provides a weather forecast for a specified location with options for metric or imperial units.

Option Type Description
location String Required. Specifies the location for the weather forecast. Accepts city name, postal code, or coordinates.
units String Optional. Sets the unit system for the forecast. Options are "metric" (default) or "imperial".

/astro

Provides the moonrise/set and sunrise/set astrological data for a specified location.

Option Type Description
location String Required. Specifies the location for the weather forecast. Accepts city name, postal code, or coordinates.

πŸ“Έ Preview

Here are some screenshots to give you a glimpse of the Discord Weather Forecast Bot in action!

1. Weather Forecast Command

Screenshot 2024-11-04 at 3 22 32 PM

2. Astro Command

Screenshot 2024-11-04 at 3 23 48 PM

Badges

MIT License

Authors

About

🌀️ A Discord bot that provides real-time, 3-day weather forecasts for any location! Built with Bun, TypeScript, and the Discord API, this bot lets users check weather and astrological information.

Topics

Resources

License

Stars

Watchers

Forks