Skip to content

fix: pass binding for prefixed variant of hybrid cmd #1573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

AstreaTSS
Copy link
Member

@AstreaTSS AstreaTSS commented Nov 27, 2023

Pull Request Type

  • Feature addition
  • Bugfix
  • Documentation update
  • Code refactor
  • Tests improvement
  • CI/CD pipeline enhancement
  • Other: [Replace with a description]

Description

When declaring a hybrid command in a subclass of Client (see the test scenario a bit below), an error would occur when using the prefixed command variant of it, saying that not enough arguments were passed. This was due to the generated prefixed command not inheriting the binding of the main hybrid/slash command - while the slash command would continue to work fine, the prefixed command would not have the "binded" self, causing the issue.

This PR fixes that by setting the generated prefixed command's binding to the main hybrid/slash command's binding.

Changes

  • Set the generated prefixed command's binding to the main hybrid/slash command's binding when generating a prefixed command based off said hybrid/slash command.

Related Issues

Test Scenarios

class MyBot(Client):
    @hybrid_slash_command()
    async def test(self, ctx: HybridContext):
        await ctx.reply("e")

Python Compatibility

  • I've ensured my code works on Python 3.10.x
  • I've ensured my code works on Python 3.11.x

Checklist

  • I've run the pre-commit code linter over all edited files
  • I've tested my changes on supported Python versions
  • I've added tests for my code, if applicable
  • I've updated / added documentation, where applicable

@LordOfPolls LordOfPolls merged commit d29a03f into interactions-py:unstable Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy