Git Product home page Git Product logo

create-discord-bot's Introduction

Create Discord Bot

Discord Twitter Follow

Create Discord bots using a simple widget-based framework.

npx demo

Table of contents

Getting started

Setup bot

  1. Go to Discord's Developer Portal.
  2. Create a new application.

Take note of your bot's client ID. You will need this to invite your bot to a server.

  1. Go to the bot tab and add a bot user to your application.

Take note of your bot's token. You will need this in the next section.

  1. Invite your bot to a server using: https://discordapp.com/oauth2/authorize?scope=bot&client_id=DISCORD_BOT_CLIENT_ID_PLACEHOLDER

Alternatively, npx peterthehan/create-discord-bot will generate a bot invite link for you when you create a bot project and you provide a valid bot token.

A Discord bot's client ID is not the same as its token. Keep your token and any file containing it private. If your token ever leaks or you suspect it may have leaked, simply regenerate a new token to invalidate your compromised token.

Create bot

npx peterthehan/create-discord-bot
cd my-discord-bot/
npm start

Verify the bot is working by using the .ping command.

You're ready to create your own Discord bot! ๐ŸŽ‰

Documentation

Updating

Update your core bot files to the latest version in this project by running npx peterthehan/create-discord-bot and entering the same name as your existing Discord bot when asked for the application name. This will update:

Command widget

create-discord-bot includes a command widget. Follow the design of the ping command to start building your own commands.

Widget conventions

  • All widgets must live under the src/widgets/ folder.
  • All widgets must have a handlers folder.
  • A handlers folder can only contain event handler files.
  • All event handler files must be named exactly the same as the events found on the Client page.

An example file tree diagram of these requirements may look like:

src/
  widgets/
    command/
      handlers/
        ready.js
        message.js
    widget1/
      handlers/
        messageReactionAdd.js
        messageUpdate.js
        other event handlers
    widget2/
      handlers/
        typingStart.js
        userUpdate.js
        other event handlers

Widgets

The following widgets can be used by this framework by adding them into the src/widgets/ folder:

Troubleshooting

  • Use Git Bash instead of the Command Prompt (cmd.exe) if you are on Windows.
  • npm -v to check if your npm version supports npx (v5.2+).
  • node -v to check if you have the latest LTS version of Node.js (v12+).
  • npm install if running the application outputs Error: Cannot find module '...'.

Visit for more help or information!

Discord server invite

Contributing

Read the Contributing documentation to get started!

create-discord-bot's People

Contributors

dependabot[bot] avatar peterthehan avatar shadowtime2000 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.