Add NullAccessory for non-interactive sections
This commit is contained in:
parent
5dbf605cb1
commit
38ec5d1e69
@ -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}"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user