Skip to content

[BUG] SelectOption breaks if optional emoji not specified #537

@crying-ibex

Description

@crying-ibex

Describe the bug
When creating a SelectOption without specifying an optional emoji AttributeError is raised

Reproducing steps
I'm on the latest build of the unstable branch

Here's a minimal example demonstrating this bug

import interactions

option = interactions.SelectOption(
    label='Option Label',
    description='option description',
    value='option_value')

print(option)

It appears as though an earlier bugfix allowing Emoji objects to be passed broke this, as now self._json.update({"emoji": self.emoji._json}) is called even if self.emoji has been set to None.

What's normally expected
The object should be created and printed

What actually happened
The application crashes (stack trace included)

Traceback (most recent call last):
  File "█████/select_option_minimal_example.py", line 3, in <module>
    option = interactions.SelectOption(
  File "/usr/local/lib/python3.10/site-packages/interactions/models/component.py", line 43, in __init__
    self._json.update({"emoji": self.emoji._json})
AttributeError: 'NoneType' object has no attribute '_json'

Versions

  • I am using discord.py versions 1.7 and below with my code.
    • I am using 2.0 or higher, or a modified fork.
  • I am using dis-snek with my code.
  • I am not using any of the listed above and am using the library code alone.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions