Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Latest commit

 

History

History
47 lines (39 loc) · 1.44 KB

using-aliases-in-commands.md

File metadata and controls

47 lines (39 loc) · 1.44 KB

Aliases

Aliases are simply different ways to call the same command. They're extremely simple to do.

Let's, once again, grab our say command. Head over to all of the command properties.

super(client, {
    name: 'say',
    group: 'group2',
    memberName: 'say',
    description: 'Replies with the text you provide.',
    examples: ['say Hi there!'],
    args: [
        {
            key: 'text',
            prompt: 'What text would you like the bot to say?',
            type: 'string'
        }
    ]
});

Underneath the name property, let's place the aliases. We'll set them to copycat, repeat, echo, and parrot.

super(client, {
    name: 'say',
    aliases: ['copycat', 'repeat', 'echo', 'parrot'],
    group: 'group2',
    memberName: 'say',
    description: 'Replies with the text you provide.',
    examples: ['say Hi there!'],
    args: [
        {
            key: 'text',
            prompt: 'What text would you like the bot to say?',
            type: 'string'
        }
    ]
});

Now, you can use <prefix>say, <prefix>copycat, <prefix>echo, etc. and all of them will call our say command.

Also, note that aliases and command names are automatically case insensitive. say SaY and sAy are all valid here. Auto-Aliases are also created for aliases and command names containing a hyphen (-). For example, server-info will automatically have serverinfo as an alias without needing to list it in the aliases. Cool, huh?