Created
March 6, 2022 05:09
-
-
Save trezy/2796cab1230f37a8156821125cefa363 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Module imports | |
| import { SlashCommandBuilder } from '@discordjs/builders' | |
| export class Command { | |
| /****************************************************************************\ | |
| * Instance properties | |
| \****************************************************************************/ | |
| command = null | |
| config = {} | |
| /****************************************************************************\ | |
| * Public methods | |
| \****************************************************************************/ | |
| #build() { | |
| this.command = new SlashCommandBuilder() | |
| this.command.setName(this.name) | |
| this.command.setDescription(this.description) | |
| } | |
| constructor(config) { | |
| this.config = config | |
| this.execute = this.config.execute.bind(this) | |
| this.#build() | |
| } | |
| execute = () => { | |
| console.error('No execution method set.') | |
| } | |
| /****************************************************************************\ | |
| * Getters | |
| \****************************************************************************/ | |
| get description() { | |
| return this.config.description | |
| } | |
| get name() { | |
| return this.config.name | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment