interactions-py / interactions.py

A highly extensible, easy to use, and feature complete bot framework for Discord
https://interactions-py.github.io/interactions.py/
MIT License
839 stars 184 forks source link

fix: properly parse aliases for base commands #1728

Closed AstreaTSS closed 2 months ago

AstreaTSS commented 2 months ago

Pull Request Type

Description

Previously, aliases like the below wouldn't be properly registered for the prefixed command variant of hybrid commands:

message = HybridSlashCommand(
    name="message",
    description="Hosts public-facing messaging commands.",
    dm_permission=False,
    aliases=["msg"],
)

In this case, trying to use <prefix>msg would not make the bot respond. The hybrid manager was just ignoring any commands without a callback or that were only meant as a jumping point for subcommands, meaning it would never read the aliases from them.

For the first part, this PR properly parses these types of commands (and makes it so it doesn't add improper aliases for base commands). However, this introduced a new problem - the command hooks were run after an empty callback check, which means that the above example would still not properly get parsed. That was fixed by moving the hook above the callback check.

Changes

Related Issues

Test Scenarios

See example above.

Python Compatibility

Checklist