alextison / discordWeatherBot

A Discord bot with features related to weather - OpenSource

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discord Weather Bot TypeScript

discord.js License Stars Pull Requests

Weather bot - A discord.js bot with features related to weather written with TypeScript.

Introduction

This template was created to give developers a starting point for new Discord bots, so that much of the initial setup can be avoided and developers can instead focus on meaningful bot features. Developers can simply copy this repo, follow the setup instructions below, and have a working bot with many boilerplate features already included!

Features

Built-In Bot Features:

  • Basic command structure.
  • Rate limits and command cooldowns.
  • Welcome message when joining a server.
  • Shows server count in bot status.
  • Posts server count to popular bot list websites.
  • Support for multiple languages.

Developer Friendly:

  • Written with TypeScript.
  • Uses the discord.js framework.
  • Built-in debugging setup for VSCode.
  • Written with ESM for future compatibility with packages.
  • Support for running with the PM2 process manger.
  • Support for running with Docker.

Scales as Your Bot Grows:

  • Supports sharding which is required when your bot is in 2500+ servers.
  • Supports clustering which allows you to run your bot on multiple machines.

Commands

This bot has a few example commands which can be modified as needed.

Help Command

A /help command to get help on different areas of the bot or to contact support:

Info Command

A /info command to get information about the bot, links to different resources, or developer information.

Weather Command

The main bot's command /weather, allow users to ask for weather in a given location.

Welcome Message

A welcome message is sent to the server and owner when the bot is added.

Setup

  1. Copy example config files.
    • Navigate to the config folder of this project.
    • Copy all files ending in .example.json and remove the .example from the copied file names.
      • Ex: config.example.json should be copied and renamed as config.json.
  2. Obtain a bot token.
    • You'll need to create a new bot in your Discord Developer Portal.
      • See here for detailed instructions.
      • At the end you should have a bot token.
  3. Modify the config file.
    • Open the config/config.json file.
    • You'll need to edit the following values:
      • client.id - Your discord bot's user ID.
      • client.token - Your discord bot's token.
  4. Install packages.
    • Navigate into the downloaded source files and type npm install.
  5. Register commands.
    • In order to use slash commands, they first have to be registered.
    • Type npm run commands:register to register the bot's commands.
      • Run this script any time you change a command name, structure, or add/remove commands.
      • This is so Discord knows what your commands look like.
      • It may take up to an hour for command changes to appear.

Start Scripts

You can run the bot in multiple modes:

  1. Normal Mode
    • Type npm start.
    • Starts a single instance of the bot.
  2. Manager Mode
    • Type npm run start:manager.
    • Starts a shard manager which will spawn multiple bot shards.
  3. PM2 Mode
    • Type npm run start:pm2.
    • Similar to Manager Mode but uses PM2 to manage processes.

Add the bot to your server

https://discord.com/oauth2/authorize?client_id=1120358582777552986&scope=bot%20applications.commands&permissions=105227086912

About

A Discord bot with features related to weather - OpenSource

License:MIT License


Languages

Language:TypeScript 99.8%Language:Dockerfile 0.2%