Skip to content
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

feat: add once kwarg to Cog.listener #2403

Merged
merged 5 commits into from Mar 24, 2024

Conversation

NeloBlivion
Copy link
Member

@NeloBlivion NeloBlivion commented Mar 21, 2024

Summary

Adds the once kwarg to Cog.listener as per #2157. But as noted in that request, there's a caveat - due to how it's stored, once resets on cog load. Either this PR can go through as is with that warning, or we can slightly rework it to not reset on reload (perhaps through an extra kwarg specifying which behavior you want)

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.

Closes #2157

@JustaSqu1d
Copy link
Member

Either this PR can go through as is with that warning, or we can slightly rework it to not reset on reload (perhaps through an extra kwarg specifying which behavior you want)

Maybe we can create an enum like OnceCogBehavior.single, OnceCogBehavior.cog_reload, and OnceCogBehavior.none. The names can be better...

@JustaSqu1d
Copy link
Member

JustaSqu1d commented Mar 24, 2024

This closes #2157, so why isn't that issue linked to this PR?

@plun1331
Copy link
Member

This closes #2157, so why isn't that issue linked to this PR?

bcs someone forgot to use the closes keyword in their pr desc

@plun1331 plun1331 linked an issue Mar 24, 2024 that may be closed by this pull request
@Lulalaby Lulalaby merged commit ac7c341 into Pycord-Development:master Mar 24, 2024
31 checks passed
plun1331 added a commit to SkyKings-Guild/pycord that referenced this pull request Apr 21, 2024
* feat: add once kwarg to Cog.listener (Pycord-Development#2403)

* add once kwarg to Cog.listener

* clarify

* style(pre-commit): auto fixes from pre-commit.com hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Lala Sabathil <lala@pycord.dev>

* chore(pre-commit): pre-commit autoupdate (Pycord-Development#2410)

updates:
- [github.com/asottile/pyupgrade: v3.15.1 → v3.15.2](asottile/pyupgrade@v3.15.1...v3.15.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* fix: pass proper state to interaction._guild (Pycord-Development#2411)

* fix: option and BridgeOption adjustments (Pycord-Development#2417)

* chore(pre-commit): pre-commit autoupdate (Pycord-Development#2416)

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](pre-commit/pre-commit-hooks@v4.5.0...v4.6.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* feat: implement Guild.search_members (Pycord-Development#2418)

* implement guild member search

* clarification.

* style(pre-commit): auto fixes from pre-commit.com hooks

* cl

* undo iteration

* style(pre-commit): auto fixes from pre-commit.com hooks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* ci(deps): bump ribtoks/tdg-github-action from 0.4.7.pre.beta to 0.4.10.pre.beta (Pycord-Development#2420)

ci(deps): bump ribtoks/tdg-github-action

Bumps [ribtoks/tdg-github-action](https://github.com/ribtoks/tdg-github-action) from 0.4.7.pre.beta to 0.4.10.pre.beta.
- [Release notes](https://github.com/ribtoks/tdg-github-action/releases)
- [Commits](ribtoks/tdg-github-action@v0.4.7-beta...v0.4.10-beta)

---
updated-dependencies:
- dependency-name: ribtoks/tdg-github-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: plun1331 <plun1331@gmail.com>

* fix: Added member data to the raw_reaction_remove event (Pycord-Development#2412)

* fix: Added member data to the raw_reaction_remove event

* style(pre-commit): auto fixes from pre-commit.com hooks

* Added changelog.md for adding member data to raw reaction remove

* Update CHANGELOG.md

Signed-off-by: plun1331 <plun1331@gmail.com>

* doc: Updated documentation for the RawReactionActionEvent.member field

---------

Signed-off-by: plun1331 <plun1331@gmail.com>
Co-authored-by: root <root@DESKTOP-U7KGUE3>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: plun1331 <plun1331@gmail.com>

* chore(pre-commit): pre-commit autoupdate (Pycord-Development#2422)

updates:
- [github.com/psf/black: 24.3.0 → 24.4.0](psf/black@24.3.0...24.4.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* docs: remove false optional (Pycord-Development#2424)

docs: not optional

* fix: Guild.query_members may accept empty query and limit (Pycord-Development#2419)

Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com>
Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
Co-authored-by: plun1331 <plun1331@gmail.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: plun1331 <plun1331@gmail.com>
Signed-off-by: UK <41271523+NeloBlivion@users.noreply.github.com>
Co-authored-by: UK <41271523+NeloBlivion@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Lala Sabathil <lala@pycord.dev>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: jordan-day <47164307+jordan-day@users.noreply.github.com>
Co-authored-by: root <root@DESKTOP-U7KGUE3>
Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
Co-authored-by: JustaSqu1d <89910983+JustaSqu1d@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add event(once=True) to Cog.listener
4 participants