Question regarding slash commands / aliases

Hi, is there a way for me to register command aliases as slash commands as well? For example: Command named one has aliases: ['two', 'three'] Is it possible for the command to be run via all of these: /one. /two and /three? They can have the same description and options.
Solution:
You cannot have aliases on slash commands
Jump to solution
4 Replies
Solution
kyra
kyra2y ago
You cannot have aliases on slash commands
tk ⚝
tk ⚝OP2y ago
Yeah, but is there a way to register all aliases as the same command, but with a different name? I was contemplating making different command files for the "aliases" and linking them back to the one same run function, but I thought that was too complicated. Any better way to do it?
Favna
Favna2y ago
import { Command } from '@sapphire/framework';

export class PingCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {
super(context, { ...options });
}

public override registerApplicationCommands(registry: ChatInputCommand.Registry) {
registry.registerChatInputCommand((builder) =>
builder.setName('ping').setDescription('Ping bot to see if it is alive')
);

registry.registerChatInputCommand((builder) =>
builder.setName('pong').setDescription('Ping bot to see if it is alive')
);

registry.registerChatInputCommand((builder) =>
builder.setName('pang').setDescription('Ping bot to see if it is alive')
);

registry.registerChatInputCommand((builder) =>
builder.setName('pung').setDescription('Ping bot to see if it is alive')
);

}
}
import { Command } from '@sapphire/framework';

export class PingCommand extends Command {
public constructor(context: Command.Context, options: Command.Options) {
super(context, { ...options });
}

public override registerApplicationCommands(registry: ChatInputCommand.Registry) {
registry.registerChatInputCommand((builder) =>
builder.setName('ping').setDescription('Ping bot to see if it is alive')
);

registry.registerChatInputCommand((builder) =>
builder.setName('pong').setDescription('Ping bot to see if it is alive')
);

registry.registerChatInputCommand((builder) =>
builder.setName('pang').setDescription('Ping bot to see if it is alive')
);

registry.registerChatInputCommand((builder) =>
builder.setName('pung').setDescription('Ping bot to see if it is alive')
);

}
}
But you really really really shouldn't do that because it'll register the command multiple times on the discord API and each and every one will show up when typing / By definition slash commands do not have aliases
tk ⚝
tk ⚝OP2y ago
thanks!
Want results from more Discord servers?
Add your server