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

Fix entitlement starts_at and ends_at erroring when null #2149

Merged
merged 4 commits into from
Feb 24, 2025

Conversation

julien777z
Copy link
Contributor

@julien777z julien777z commented Jan 23, 2025

Summary

Entitlement starts_at and ends_at are nullable in the Discord API, and if it's null, results in this error:

ends_at=time.iso8601_datetime_string_to_datetime(payload["ends_at"]) if "ends_at" in payload else None,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python3.12/site-packages/hikari/internal/time.py", line 81, in slow_iso8601_datetime_string_to_datetime
    if datetime_str.endswith(("z", "Z")):
        ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'endswith'

The error for starts_at is similar.

Checklist

  • I have run nox and all the pipelines have passed.
  • I have made unittests according to the code I have added/modified/deleted.

Related issues

@julien777z julien777z changed the title Fix entitlement starts_at and ends_at possibly being None Fix entitlement starts_at and ends_at erroring when null Feb 1, 2025
Copy link
Member

@davfsa davfsa left a comment

Choose a reason for hiding this comment

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

Thanks!

Sorry that it took me so long to get to this

@davfsa davfsa merged commit 3ec646c into hikari-py:master Feb 24, 2025
25 checks passed
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