Skip to content

Conversation

@AstreaTSS
Copy link
Member

@AstreaTSS AstreaTSS commented Mar 10, 2023

About

This pull request allows "disabling" auto-defers in a command or extension through the helper functions/decorators.

Say, if you had a bot-wide auto-defer (a very common setup), but you wanted one command to specifically not defer (for various reasons). Before, it would take this rather awkward code to achieve the trick:

@slash_command(...)
async def cmd(...):
    ...

cmd.auto_defer = AutoDefer(enabled=False)

With this PR, it's made cleaner:

@slash_command(...)
@auto_defer(enabled=False)
async def cmd(...):
    ...

A similar concept applies with extensions.

Checklist

  • The pre-commit code linter has been run over all edited files to ensure the code is linted.
  • I've ensured the change(s) work on 3.8.6 and higher.
  • I have added the versionadded, versionchanged and deprecated to any new or changed user-facing function I committed.

Pull-Request specification

I've made this pull request: (check all that apply)

  • For the documentation
  • To add a new feature
  • As a general enhancement
  • As a refactor of the library/the library's code
  • To fix an existing bug
  • To resolve #ISSUENUMBER

This is:

  • A breaking change

@LordOfPolls LordOfPolls merged commit d261b6a into interactions-py:5.x Mar 13, 2023
LordOfPolls pushed a commit that referenced this pull request Mar 13, 2023
* feat: allow disabling autodefer through auto_defer methods

* fix: oops

---------

Co-authored-by: Astrea49 <25420078+Astrea49@users.noreply.github.com>
@AstreaTSS AstreaTSS deleted the auto-defer-disable branch March 28, 2023 17:31
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.

2 participants