best practice for hybrid commands

im wondering what the best practices for making commands that have a message and slash version would be. is it possible to have one single file (ex: ping.ts) that stores a PingSlashCommand class and a PingMessageCommand class? so far ive divided it up via 2 files. one called ping.ts and one called message.ping.ts. this is kinda annoying though...
3 Replies
MC Princess
MC Princess3w ago
it would be best to have them in the same file
čamdžić
čamdžić3w ago
yeah because you can do messageRun and chatInputRun in ONE file/class
MC Princess
MC Princess3w ago
i.e.
export class PingCommand extends Command {
// command registry

public async messageRun(message: Message) {
// code
}

public async chatInputRun(interaction: Command.ChatInputInteraction) {
// code
}
}
export class PingCommand extends Command {
// command registry

public async messageRun(message: Message) {
// code
}

public async chatInputRun(interaction: Command.ChatInputInteraction) {
// code
}
}

Did you find this page helpful?