Skip to content

Commit

Permalink
feat: add context menu builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyameliaaaa committed Mar 23, 2023
1 parent 7d7d132 commit 40a67d5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/commands/contextMenu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { ContextMenuCommandBuilder as Builder, ContextMenuCommandType } from '@discordjs/builders';
import { getDefaultString, joinKeys, getAllStrings } from 'index';
import { BaseKeyMixin } from 'mixins/base';
import { PermsV2Mixin, SharedOptionsMixin } from 'mixins/commands';
import { NameMixin } from 'mixins/nameAndDescription';
import { mix } from 'ts-mixer';

export interface ContextMenuCommandBuilder extends PermsV2Mixin<Builder>, NameMixin<Builder>, BaseKeyMixin {}

@mix(PermsV2Mixin, NameMixin, BaseKeyMixin)
export class ContextMenuCommandBuilder {
// eslint-disable-next-line
constructor(baseKey?: string) {
this.builder = new Builder();
}

protected init(baseKey?: string) {
if (baseKey) {
this.setName(getDefaultString(joinKeys([baseKey, 'context']), 'commands'));
this.setNameLocalizations(getAllStrings(joinKeys([baseKey, 'context']), 'commands'));
}
}

setType(type: ContextMenuCommandType) {
this.builder.setType(type);
return this;
}
}

0 comments on commit 40a67d5

Please sign in to comment.