-
-
Notifications
You must be signed in to change notification settings - Fork 168
Channel points auto reward redemption event fix no message #527
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
Channel points auto reward redemption event fix no message #527
Conversation
|
I'll test these changes when I get time, but you also need to update the types for the payloads from Twitch, because this current implementation shows:
Once you have fixed that, you will have to adjust your changes in the model to account for it. Does this change also account for both versions of this endpoint? v1 and v2 since v1 is not deprecated? I do not agree with the changes of lists becoming optional and returning None. Those should return empty lists. |
|
V1 also still works with it, message is not None and text is empty I'll check the ChannelPointsMessageData and change to return empty lists. |
|
You can simply undo those commits and change them back to how they were. Although there is a discussion for it to return an empty string, as that is what it does for V1. |
|
Not quite, as self._raw_emotes also throws the TypeError for message being None, and fragments. |
|
My point being handling None privately and returning an empty string user side so there is no difference between v1 and v2 within the same model for that attribute. There are many examples in the library where we do not expose exactly what the API returns as we are not a wrapper, like many other "libraries" for Twitch. I would also like input from @EvieePy on this discussion. |
|
An empty string would be appropriate; as mentioned it would fit within the current version 1 model. |
|
Alright. Thanks for the input. |
chillymosh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please run ruff as there is whitespace
twitchio/models/eventsub_.py
Outdated
| fragments: list[ChatMessageFragment] | None | ||
| The ordered list of chat message fragments. This is only populated when using V2. This is `None` for redemptions that do not contain a message. | ||
| fragments: list[ChatMessageFragment] | ||
| The ordered list of chat message fragments. This is only populated when using V2 or for redemptions that do not contain a message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An ordered list of chat message fragments. This field is populated only when using V2, and only for redemptions that do not contain a message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error from my side as well "This is only populated when using V2, and only for redemptions that contain a message."
Description
For some auto reward redemptions the current implementation threw an TypeError, as "message" in payload is None.
Changes account for payload["message"] to be None and depending attributes to be None (text, fragments, _emotes).
This also means, that text can be None in event_automatic_redemption_add.
Example payload for auto redemption of reward type "chosen_modified_sub_emote_unlock": payload message = None
Error before fix:
Example payload for auto redemption of reward type "send_highlighted_message" ===> payload message not None
Checklist