Closed
Description
Library Version
5.12.1
Describe the Bug
Whenever a message is created with a premium button in it, the library will error out. This is because the Button
code has an explicit check to see if a button is lacking a label and an emoji, which these types of buttons do not have.
Steps to Reproduce
Receive a message with a premium button with the message content intent enabled.
Expected Results
For it to not error out. Granted, information will be lost, but it shouldn't create an exception.
Minimal Reproducible Code
await ctx.send(components={"type": 1, "components": [{"type": 2, "style": 6, "sku_id": "SKU_ID"}]})
Traceback
ValueError: Buttons must have a label or an emoji.
File "interactions/api/events/processors/message_events.py", line 24, in _on_raw_message_create
msg = self.cache.place_message_data(event.data)
File "interactions/client/smart_cache.py", line 436, in place_message_data
message = Message.from_dict(data, self._client)
File "interactions/models/discord/base.py", line 36, in from_dict
data = cls._process_dict(data, client)
File "interactions/models/discord/message.py", line 520, in _process_dict
components = [
File "interactions/models/discord/message.py", line 521, in <listcomp>
models.BaseComponent.from_dict_factory(component_data) for component_data in data["components"]
File "interactions/models/discord/components.py", line 92, in from_dict_factory
return component_class.from_dict(data)
File "interactions/models/discord/components.py", line 140, in from_dict
return cls(*data["components"])
File "interactions/models/discord/components.py", line 131, in __init__
self.components: list[Dict | BaseComponent] = [
File "interactions/models/discord/components.py", line 132, in <listcomp>
BaseComponent.from_dict_factory(c) if isinstance(c, dict) else c for c in components
File "interactions/models/discord/components.py", line 92, in from_dict_factory
return component_class.from_dict(data)
File "interactions/models/discord/components.py", line 259, in from_dict
return cls(
File "interactions/models/discord/components.py", line 250, in __init__
raise ValueError("Buttons must have a label or an emoji.")
Checklist
- I have searched the open issues for duplicates.
- I have shown the entire traceback, if possible.
- I have removed my token from display, if visible.
- I have attempted to debug this myself, and I believe this issue is with the library
Additional Information
This will be resolved by #1701, but I want an issue to point people to in between it being merged and the next interactions.py release.
Metadata
Metadata
Assignees
Labels
No labels