fix log view field section accessory

This commit is contained in:
Codex 2025-06-05 19:24:58 +00:00 committed by Slipstream
parent 1080a8e93d
commit 3d7e9f3f63
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -72,10 +72,14 @@ class LoggingCog(commands.Cog):
self.header.add_item(ui.TextDisplay(description))
self.container.add_item(self.header)
# Section to hold log fields with no accessory. Using a blank
# TextDisplay avoids ``None`` errors from ``is_dispatchable`` while
# keeping the accessory effectively invisible.
self.fields_section = ui.Section(accessory=ui.TextDisplay("\u200b"))
# Section to hold log fields. `discord.py` requires an accessory of
# type ``Button`` or ``Thumbnail`` for a ``Section``. A disabled
# button with a zero-width label acts as an invisible placeholder
# and prevents ``is_dispatchable`` errors without affecting the
# layout visually.
self.fields_section = ui.Section(
accessory=ui.Button(label="\u200b", disabled=True)
)
self.container.add_item(self.fields_section)
self.container.add_item(ui.Separator(spacing=discord.SeparatorSpacing.small))