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

Added on_raw_typing event #63

Merged
merged 3 commits into from
Oct 8, 2021

Conversation

AstreaTSS
Copy link
Contributor

Summary

Adds in an on_raw_typing event. This may be useful if the typing starts in a DM, as otherwise, d.py is unable to resolve the user and so unable to dispatch an on_typing event.
Feel free to check and review over it! It's probably not perfect anyways.
Fixes #7432.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • 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, ...)

@CodeWithSwastik
Copy link
Contributor

Could you move this to another PR? I don't think making Intents required is related to this PR. image

@AstreaTSS
Copy link
Contributor Author

AstreaTSS commented Sep 6, 2021

Forgot to check this. Oops!

Sorry, that was my bad for porting the code from another fork to this one in a rush! Yeah, I'll move it out and also go in and fix a few other things I've noticed.

def __init__(self, data: TypingEvent) -> None:
self.channel_id: int = int(data['channel_id'])
self.user_id: int = int(data['user_id'])
self.when: datetime.datetime = datetime.datetime.fromtimestamp(data.get('timestamp'), tz=datetime.timezone.utc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also use data['timestamp'] here.

@Middledot
Copy link
Member

This PR has some conflicts to be resolved

raw = RawTypingEvent(data)

member_data = data.get('member')
if member_data:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be shortened to

        member_data = data.get('member')
        raw.member = None
        if member_data:
            guild = self._get_guild(raw.guild_id)
            if guild is not None:
                raw.member = Member(data=member_data, guild=guild, state=self)

@CodeWithSwastik CodeWithSwastik merged commit b1876c1 into Pycord-Development:master Oct 8, 2021
CodeWithSwastik added a commit that referenced this pull request Oct 19, 2021
* Prefer static_format over format with static assets

* GitHub Action to lint Python code

* bytes, not Bytes

* Update lint_python.yml

* Delete lint_python.yml

* Fix typos discovered by codespell

* Fix typos discovered by codespell

* GitHub Action to run codespell

* Make id parameter positional only

* Code Of conduct is a suggestion by Github

* Change `ctx.send` to `ctx.respond` in the README (#197)

* Update README.rst

* Update README.rst

* Added START_EMBEDDED_ACTIVITIES permission #198 (#199)

* Use start_embedded_activities instead of create_instant_invite

* Use an Enum for embedded activites

* Fix error in docstring

* Add typehinting to pull request checklist

* fix: distribution

* change: display text

* fixup! Fix typo for overridden

* Changed unchanged change

* Add *items to View

* Add Pycord Development to LICENSE

* License updates

* Fix accidental deletion in 1257776

* Add dependabot

* Add CodeQL

* Bump sphinx from 4.0.2 to 4.2.0

Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 4.0.2 to 4.2.0.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/4.x/CHANGES)
- [Commits](sphinx-doc/sphinx@v4.0.2...v4.2.0)

---
updated-dependencies:
- dependency-name: sphinx
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Set pycord user-agent (#241)

* created delete_after parameter for ctx.respond (#180)

* created delete_after parameter for ctx.respond

* Update discord/interactions.py

Co-authored-by: proguy914629 <74696067+proguy914629bot@users.noreply.github.com>

* added eventloop thing

* fixed ensure_future

Co-authored-by: proguy914629 <74696067+proguy914629bot@users.noreply.github.com>

* Added `on_raw_typing` event (#63)

* Added `on_raw_typing` event

* Fixes and adjustments for on_raw_typing

Co-authored-by: Swas.py <61446939+CodeWithSwastik@users.noreply.github.com>

* add support for role icons (#254)

* add support for role icons

* add unicode_emoji attribute and change Role.edit

* role.edit required b64 string for icon

* passing None should remove the icon

* change documentation to reflect changes

* update docstring for Role

* invalid sentence

* remove unnecessary documentation

* add new valid keys

* add valid keys

* set icon to None if unicode_emoji is passed

* Fix typo in docs

* Use `ctx.respond` in favor of `ctx.send`

* Use `ctx.respond` in favor of `ctx.send`

* Added new embedded activites with documentation. (#267)

* Added new embedded activities

* Removed chess and renamed youtube2

* Documented `EmbeddedActivity` Enumeration

* renamed youtube_advance to watch_together and added dev version of it

Co-authored-by: Lala Sabathil <aiko@aitsys.dev>

* Updated docs with the new naming convention

Co-authored-by: Lala Sabathil <aiko@aitsys.dev>

Co-authored-by: Lala Sabathil <aiko@aitsys.dev>

* add support for sending file(s) in interaction response (#263)

* add support for sending file(s) in interaction response

* update docstring

* fix

* add ephemeral attribute to Attachment

* use dict.get to avoid KeyErrors (#268)

* Revert "Add a dunder len to Message (#176)" (#270)

This reverts commit 2858bd1.

* Add missing flags

* Fix typo

* Typos .-.

* Fix typo

Co-authored-by: Sonic4999 <sonictbm@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: Izhar Ahmad <54180221+nerdguyahmad@users.noreply.github.com>
Co-authored-by: PGamerX <websitedesigner123456@gmail.com>
Co-authored-by: Gracie <87055757+Grace-codes@users.noreply.github.com>
Co-authored-by: Middledot <78228142+Middledot@users.noreply.github.com>
Co-authored-by: DeviousLab <deviouslab@gmail.com>
Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
Co-authored-by: Aomi Vel <69065737+AomiVel@users.noreply.github.com>
Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com>
Co-authored-by: Dorukyum <doruk.ak@hotmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ian Webster <ianw_github@ianww.com>
Co-authored-by: Cheeseboy8020 <68305035+Cheeseboy8020@users.noreply.github.com>
Co-authored-by: proguy914629 <74696067+proguy914629bot@users.noreply.github.com>
Co-authored-by: Zeffo <43495198+zeffo@users.noreply.github.com>
Co-authored-by: Prince Raj <68418241+Prince2347X@users.noreply.github.com>
Co-authored-by: Lala Sabathil <aiko@aitsys.dev>
Co-authored-by: Lala Sabathil <aiko@aiko-it-systems.eu>
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.

[v2]: DM typing and Thread typing events are not dispatched.
5 participants