Giter Site home page Giter Site logo

discord-skeleton's Introduction

Discord bot skeleton

This is a basic skeleton for a Discord bot using discordjs, built off of the discordjs guide. This skeleton implements event and command handlers.

Development

  • Clone this repository.
  • Set the local environment variable DISCORD_TOKEN to your Discord bot token (or set token in config.json).
  • npm install.
  • node index.js.

Code structure

Config

The bot can be configured via config/bot.js. The default command prefix is "!".

Events

To add a new event handler, create a directory within events named after the event you want to catch (full list within the DiscordJS Client object). Every handler must have an index.js that acts as the entry point to the event. See the existing handler for messages for an example.

Messages

As most Discord bots are reply/response, or execute commands, a default message handler is included. messages/index.js detects commands with the configured prefix, and parses arguments. It also supports reacting to non-command message events, for i.e. logging or reply/response.

Commands and features

To create a command, export a property type: 'command'. The bot will check that a message has both the configured prefix, and the correct type property before executing a command.

If the bot detects a valid command, it returns the message split up into it's command phrase (e.g. args-info) and any arguments that came after the command phrase (e.g. for !args-info 1 2) it would return 1 and 2 as two args

Commands are assumed to be executed in response to user messages, and so are handled by the messages handler. To add handlers for other events, see Events.

Commands

Below is a list of commands provided by default. Want to add a command? Pull requests welcome โœจ.

  • args-info-command

Features

  • Basic away tracking with bot response

How to shut it down

  • "CTRL"+"C" to shut down the bot through terminal

Coming soon

  • BRB timers

  • Custom reponses

discord-skeleton's People

Contributors

alex-cd avatar jamesl-kent avatar joenash avatar rtgosling 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.