Skip to content

Instantly share code, notes, and snippets.

@trezy
Created March 6, 2022 05:09
Show Gist options
  • Save trezy/2796cab1230f37a8156821125cefa363 to your computer and use it in GitHub Desktop.
Save trezy/2796cab1230f37a8156821125cefa363 to your computer and use it in GitHub Desktop.
// 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