From 38ec5d1e691368f189eb54836723b6283691c6e0 Mon Sep 17 00:00:00 2001 From: Codex Date: Fri, 6 Jun 2025 02:58:40 +0000 Subject: [PATCH] Add NullAccessory for non-interactive sections --- cogs/logging_cog.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cogs/logging_cog.py b/cogs/logging_cog.py index 9709160..ee9c7af 100644 --- a/cogs/logging_cog.py +++ b/cogs/logging_cog.py @@ -43,6 +43,15 @@ ALL_EVENT_KEYS = sorted([ # Add more audit keys if needed, e.g., "audit_stage_instance_create" ]) +class NullAccessory(ui.Button): + """Non-interactive accessory used as a placeholder.""" + + def __init__(self) -> None: + super().__init__(label="\u200b", disabled=True) + + def is_dispatchable(self) -> bool: # type: ignore[override] + return False + class LoggingCog(commands.Cog): """Handles comprehensive server event logging via webhooks with granular toggling.""" def __init__(self, bot: commands.Bot): @@ -75,7 +84,7 @@ class LoggingCog(commands.Cog): accessory=( ui.Thumbnail(media=author.display_avatar.url) if author - else None + else NullAccessory() ) ) self.header.add_item(ui.TextDisplay(f"**{title}**")) @@ -101,7 +110,7 @@ class LoggingCog(commands.Cog): def add_field(self, name: str, value: str, inline: bool = False): """Mimic Embed.add_field by appending a bolded name/value line.""" if not self._field_sections or len(self._field_sections[-1].children) >= 3: - section = ui.Section(accessory=None) + section = ui.Section(accessory=NullAccessory()) self._insert_field_section(section) self._field_sections.append(section) self._field_sections[-1].add_item(ui.TextDisplay(f"**{name}:** {value}"))