Search code examples
pythonbotsdiscordaliases

Is There a Way to Get a List of Aliases? (Discord py)


So I've been stuck on this for a while and can't seem to find the answer online...

Is there a way to show a user all of the aliases that a command has?

Example: .sum has the aliases: .add, .plus, .addNums, etc...

Mainly I just need a way to "get" a list of aliases for a given command.

I found bot.get_command("aliasName"), which will return the command that this alias is tied to, however I cannot find a way to get a list of aliases from a given command.

I've checked this, but could not find what I needed.

Any help would be appreciated!


Solution

  • from discord.ext import commands
    
    sum_command = commands.Bot.get_command(bot, "sum")
    
    sum_aliases = sum_command.aliases
    

    Found it!