diff --git a/cogs/logging_cog.py b/cogs/logging_cog.py index d952532..198e6dd 100644 --- a/cogs/logging_cog.py +++ b/cogs/logging_cog.py @@ -152,9 +152,18 @@ class LoggingCog(commands.Cog): def add_field(self, name: str, value: str, inline: bool = False) -> None: field = ui.TextDisplay(f"**{name}:** {value}") - if hasattr(self.container, "children"): - index = self.container.children.index(self.bottom_separator) - self.container.children.insert(index, field) + # Ensure the field is properly registered with the view by using + # add_item first, then repositioning it before the bottom separator + if hasattr(self.container, "_children"): + self.container.add_item(field) + try: + children = self.container._children + index = children.index(self.bottom_separator) + children.remove(field) + children.insert(index, field) + except ValueError: + # Fallback to default behaviour if the separator is missing + pass else: self.content_container.add_item(field)