Note
The ideas and principles used behind the project structure and module handling is directly inspired by the official DiscordJS Guide. For more info on this topic, please refer to Creating Your App > Command Handling and the section for "Event Handling" after that.
Beyond that, this project also includes example feature implementations that are disabled by default. They may be removed or enabled at any point. Please refer to an example for more.
- NodeJS (LTS; including NPM): https://nodejs.org/en/download/
- Git: https://git-scm.com/downloads
Download the current source code here.
Or clone the repository manually:
git clone https://github.com/Baipyrus/DiscordJS.gitInstall the required dependencies:
npm installRegister or update your commands for Discord with:
npm run deployStart the bot in development mode with:
npm run devDiscord utilizes different types of commands to interface with bots. The following explanations aim to explain these types.
Simple text-based commands. Can be entered in any Text-Based-Channel.
Prefix message with a "Slash" (/) and begin typing the name of the command!
This prefix and the styling as a code snippet will be used to highlight
Slash Commands in this message.
For clarification, this will also highlight command options as
"Slash Command only" by prefixing them with an underscore (_)
"One click" commands. Listed under context (right click) menus, under the group "Apps".
Ideally, clicking on Users or Messages, you can apply any type of command with the press of a button. Comes with the downside of lacking further input capabilities.
Under the list of names of any given command, there may be a quoted string. These are meant to highlight context menu capabilities for the current command, by showcasing the commands name in the quote.
Note
This command example has to be enabled first. You can do so by renaming the file
at commands/keyword and take away the
.example flag in the filename. Also note that this command alone does not
implement any usable functionality without its
counterpart.
/keyword
Register specific keywords that the bot will listen for in every message on this server. Once mentioned, a random selection of registered responses is made and the bot will send the selected message as a chat response to the original user!
Full names:
/keyword add
Description:
Adds a new keyword to the database to be listened for in this server.
Options:
- _keyword: String
Full names:
/keyword remove
Description:
Removes a keyword from the database of this server. Uses auto complete to help fill out all options.
Options:
- _keyword: String
Full names:
/keyword list
Description:
Lists all registered keywords used in this server.
Full names:
/keyword info- "Show keyword details"
Description:
Lists all registered responses associated with a keyword in this server. Uses auto complete to help fill out all options.
Options:
- _keyword: String
All messages in this server are scanned for keywords contained in them.
Note
This command example has to be enabled first. You can do so by renaming the file
at commands/response and take away
the .example flag in the filename. Also note that this change has to be applied
to events/messageCreate as well.
/response
Register messages to be sent automatically by the bot once a keyword has been mentioned. Response messages are tied directly to their keyword in this server. When a keyword has multiple messages associated with it, a random selection is made. When a user sends a message containing multiple keywords, all response messages are considered in the random selection.
Full names:
/response add
Description:
Adds a new response to the database to be listened for in this server. The input is submitted through a pop-up modal that will open once the corresponding keyword is provided and the command is sent. Response messages are given names to better differentiate them without having to list all their content on every reference. Uses auto complete to help fill out all options.
Options:
- _keyword: String
Full names:
/response remove
Description:
Removes a specific response from the database of this server. Uses auto complete to help fill out all options.
Options:
- _keyword: String
- _name: String
Full names:
/response list- "Show keyword details"
Description:
Lists all registered responses associated with a keyword in this server.
Provides the same exact functionality as /keyword info.
Uses auto complete to help fill out all options.
Options:
- _keyword: String
Full names:
/response info
Description:
Shows the exact response details in the format of:
Response 'NAME': `MESSAGE`
Uses auto complete to help fill out all options.
Options:
- _keyword: String
- _name: String
Registered responses will be used to reply to a user once an associated keyword is mentioned in this server.
Note
These lists can and will easily be appended to in the future. Any and all feedback is greatly appreciated!
None
None
None