Registering Context Commands

Hello I want to register a context command with this code :
export class ValidRoroCommand extends Command {
constructor(context, options) {
super(context, {
...options,
name: "Valide",
});
}

registerApplicationCommands(registry) {
registry.registerContextMenuCommand(builder =>
builder //
.setName(this.name)
.setType(ApplicationCommandType.Message),
);
}
export class ValidRoroCommand extends Command {
constructor(context, options) {
super(context, {
...options,
name: "Valide",
});
}

registerApplicationCommands(registry) {
registry.registerContextMenuCommand(builder =>
builder //
.setName(this.name)
.setType(ApplicationCommandType.Message),
);
}
It's work but I don't have capital letter on the first letter V. Why ?
19 Replies
Favna
Favna8mo ago
@vladdy @kyra 🩵🩷🤍🩷🩵 do we toLowerCase names when adding them to the command store :kekw:?
vladdy
vladdy8mo ago
Yes Probably Idk
kyra
kyra8mo ago
Convert it to kebab-case in any case, probably?
vladdy
vladdy8mo ago
Hmm, definitely not in pieces Maybe in commands? Yep, we lowercase commands And changing that would be breaking
kyra
kyra8mo ago
Or we can make it non-breaking by making it a getter we can use for the registry
vladdy
vladdy8mo ago
rawName?
kyra
kyra8mo ago
kebabCaseName, transformedName
vladdy
vladdy8mo ago
...no
kyra
kyra8mo ago
Vlad, changing name would change the registered name in the store, which will break some bots
vladdy
vladdy8mo ago
which is why i said lets make a rawName property
Favna
Favna8mo ago
@Calypso can you create a GH issue to request a rawName property? The property should receive the name completely unmodified.
Calypso
CalypsoOP8mo ago
GitHub
request: rawName property for context commands · Issue #747 · sapph...
Is there an existing issue or pull request for this? I have searched the existing issues and pull requests Feature description The problem is that the command name is set to lowercase : export clas...
Favna
Favna7mo ago
looking into this now @Calypso released 5.2.0, see #Announcements
Calypso
CalypsoOP7mo ago
Thanks!
Mathias
Mathias3mo ago
I can't get it to work! Do I need to do anything specific? My code:
export class ReportMessageCommand extends Command {
constructor(context, options) {
super(context, {
...options,
name: "Report Message",
});
}

registerApplicationCommands(registry) {
registry.registerContextMenuCommand(builder =>
builder //
.setName(this.name)
.setType(ApplicationCommandType.Message),
);
}
export class ReportMessageCommand extends Command {
constructor(context, options) {
super(context, {
...options,
name: "Report Message",
});
}

registerApplicationCommands(registry) {
registry.registerContextMenuCommand(builder =>
builder //
.setName(this.name)
.setType(ApplicationCommandType.Message),
);
}
vladdy
vladdy3mo ago
This is very vague, whats not working?
Mathias
Mathias3mo ago
My command name in the menu is still displayed in lowercase report message instead Report Message
vladdy
vladdy3mo ago
use this.rawName in the setName call
Mathias
Mathias3mo ago
Oh ok thanks ... I hadn't understood it like that in the code
Want results from more Discord servers?
Add your server