Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

v1.0.0 Command Structure #103

Description

@sr229

since the inception of this project, we've used the chalda/DiscordBot layout for making commands, which is

exports.commands= [
  'xyz'
];
exports.xyz = {}

However there's limtiations on this implementation

  • we can't use numbers in declaration names for export objects
  • it does not encourage clean code.

so to improve this, we'll be doing a class-based approach instead of the export object approach we usually adopted.

class CommandName {
    constructor(description, usage, adminOnly) {
          description: 'nya',
          usage: '<ayn>',
          adminOnly: true;
          }
     async main() {
             await ctx.createMessage('noud is cute');
           }
}

exports.commands= CommandName;

this is usually cleaner and requires less code for subcommanding compared to the exports approach

class CommandName {
    constructor(description, usage, adminOnly) {
          description: 'nya',
          usage: '<ayn>',
          adminOnly: true;
          }
   async main() {
       await ctx.createMessage('noud is cute');
         }
   async delet() {
         this;
      }
}
exports.commands = CommandName;

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions