Skip to content

A sample Discord bot demonstrating basic features using Node.js and discord.js, including support for slash commands and event handling. Ideal for learning discord bot development.

License

Notifications You must be signed in to change notification settings

Rihanss/discordbot-example-v14

Repository files navigation

Discord Bot Example

Discord bot example made in Discord.js (Javascript). Follow the instructions below to set up and run the discord bot.

Features 📈

  • Easy to Setup
  • Made for Slash Commands
  • Up to date

Prerequisites

Before you begin, ensure you have met the following requirements:

  • You have a Discord account.
  • You have latest Node.js installed.
  • You have npm installed.
  • You have git installed.

Step 1: Setting Up the Bot

  1. Go to the Discord Developer Portal.
  2. Click on "New Application" and give it a name.

bot create

  1. You can choose between Personal or Team
  2. Agree to Discord Developer Terms of Service and Developer Policy
  3. You have created your Discord Bot.

Step 2: Get the Bot Token & ID

  1. In the "General Information" tab, click "Copy" under "Application ID". Save this ID as it will be used in your code.

bot id

  1. In the "Bot" tab, click "Copy" under "TOKEN". Save this token as it will be used in your code.

Due to a recent update from Discord, you need to reset your bot token to be able to copy it.

bot token

Do not share your Discord Bot Token. Tokens shown in the example are no longer valid.

Step 3: Invite the Bot to Your Server

  1. Go to the "OAuth2" tab.
  2. Under "OAuth2 URL Generator", select "bot" and "application.commands".
  3. Under "Bot Permissions", select the permissions your bot will need.
  4. Copy the generated URL and open it in your browser.
  5. Select the server you want to add the bot to and authorize it.

Step 4: Clone the Repository

git clone https://github.com/Rihanss/discordbot-example-v14.git

Step 5: Install Dependencies

npm install

Step 6: Configure the Bot

  1. Rename example.env to .env
  2. Fill the required values from with what have you saved from step 2.
TOKEN=YOURBOTTOKEN
CLIENTID=BOTID

Step 7: Start the bot

node deploy

This also creates commands needed for your Discord bot to respond.

Guides 📚

Support ⚙️

If you have found an issue with using this Discord bot example, feel free to submit an issue here or a pull request. I'll be happy to take a look

Thanks! ❤️

This repo is maintained in my spare time. If you like the example I've provided, please give it a star :)

License

This project is licensed under the MIT License.

The MIT License is a permissive license that allows for reuse, modification, and distribution of the software. You are free to use this software in any project, personal or commercial, as long as you include the original license and copyright notice in any distributed copies or substantial portions of the software.

For more details, see the LICENSE file.

Check out my discord bot!

Discord Bots

About

A sample Discord bot demonstrating basic features using Node.js and discord.js, including support for slash commands and event handling. Ideal for learning discord bot development.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published