Official Repository of the Digital Flight Dynamics Discord bot.
- Use straight-forward command names
- Write your commands with readability in mind.
- Test your code thoroughly before submitting a pull request
Just open the file for the command you want to edit in src/commands/<category>
, and make your desired changes.
- Create a new typescript file in the relevant category in
src/commands/
, and name it as your command name.examplecommand.ts
- You may use the template found below to help with creating the command.
- Import your command in
src/commands/index.ts
and add it to thecommands
array at the end of the file. Please note that the order you put in your command in the array will affect the order it will be displayed in the.help
command.
import { CommandCategories, CommandDefinition } from '../index';
export const name: CommandDefinition = {
names: ['name'], // The command only requires 1 name, but it can have multiple
description: 'Describe your command', // This description will be displayed with the .help command
category: CommandCategories.GENERAL, // Put whatever category best suites the command
permissions: [], // Not required; If the command needs specific permissions, add them here. A list of permission flags can be found at https://discord.js.org/#/docs/main/stable/class/Permissions?scrollTo=s-FLAGS
execute: async (message, args) => {
await message.channel.send('Command works!').catch((err) => console.error(err));
},
};
If the command you want to create doesn't fit any of the existing categories, you'll need to create a new one.
- Add the category to the
CommandCategories
enum insrc/commands/index.ts
.MY_CATEGORY = 'My Category',
- Open the file for the
.help
command found atsrc/commands/general/help.ts
. Find the embed calledrootEmbed
and add a new field.{ name: 'My Category', value: 'Describe your category' },
- Lastly, create a new folder in
src/commands/
, and name it based on your category in lower case.src/commands/my category/