interactions.py icon indicating copy to clipboard operation
interactions.py copied to clipboard

feat: add fail_if_not_exists for PrefixedContext.reply

Open AstreaTSS opened this issue 1 year ago • 0 comments

Pull Request Type

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

Description

This is a simple PR to add fail_if_not_exists to PrefixedContext.reply. Really, I have to question why fail_if_not_exists doesn't default to False - regardless, people at least have the option now.

Changes

  • Add fail_if_not_exists to PrefixedContext.reply.

Related Issues

Test Scenarios

@prefixed_command()
async def some_cmd(ctx: PrefixedContext):
    await ctx.message.delete()
    await ctx.reply("Hello!")  # will fail
    # meanwhile, await ctx.reply("Hello!", fail_if_not_exists=False) will work with this PR

Python Compatibility

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

Checklist

  • [x] I've run the pre-commit code linter over all edited files
  • [x] 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

AstreaTSS avatar Feb 21 '24 05:02 AstreaTSS