From a373f63756b226fd2187a3a69211075930c4a6b6 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 15 Jan 2024 07:07:06 +0000 Subject: [PATCH] fix(aurora): fixed TypeError in embed _overrides function --- aurora/configuration/embed.py | 10 +++++----- aurora/configuration/utils.py | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/aurora/configuration/embed.py b/aurora/configuration/embed.py index 24632d9..71593db 100644 --- a/aurora/configuration/embed.py +++ b/aurora/configuration/embed.py @@ -4,7 +4,7 @@ from discord import Embed, Guild, Member, User from redbot.core import commands from redbot.core.utils.chat_formatting import bold, error, warning -from .utils import get_bool_emoji +from .utils import get_bool_emoji, get_pagesize_str from ..utilities.config import config async def _core(ctx: commands.Context) -> Embed: @@ -33,8 +33,8 @@ async def _overrides(user: Union[Member, User]) -> str: bold("Auto Evidence Format: ") + get_bool_emoji(override_settings['auto_evidenceformat']), bold("Ephemeral: ") + get_bool_emoji(override_settings['ephemeral']), bold("Inline: ") + get_bool_emoji(override_settings['inline']), - bold("Inline Pagesize: ") + override_settings['inline_pagesize'] + " cases per page", - bold("Pagesize: ") + override_settings['pagesize'] + " cases per page", + bold("Inline Pagesize: ") + get_pagesize_str(override_settings['inline_pagesize']), + bold("Pagesize: ") + get_pagesize_str(override_settings['pagesize']), ] overrides = '\n'.join(overrides) return overrides @@ -72,8 +72,8 @@ async def _guild(guild: Guild) -> str: bold("Auto Evidence Format: ") + get_bool_emoji(guild_settings['auto_evidenceformat']), bold("Ephemeral: ") + get_bool_emoji(guild_settings['history_ephemeral']), bold("History Inline: ") + get_bool_emoji(guild_settings['history_inline']), - bold("History Pagesize: ") + guild_settings['history_pagesize'] + " cases per page", - bold("History Inline Pagesize: ") + guild_settings['history_inline_pagesize'] + " cases per page" + bold("History Pagesize: ") + get_pagesize_str(guild_settings['history_pagesize']), + bold("History Inline Pagesize: ") + get_pagesize_str(guild_settings['history_inline_pagesize']) ] guild_str = '\n'.join(guild_str) return guild_str diff --git a/aurora/configuration/utils.py b/aurora/configuration/utils.py index 6e70e48..91376e1 100644 --- a/aurora/configuration/utils.py +++ b/aurora/configuration/utils.py @@ -1,3 +1,5 @@ +from typing import Union + def get_bool_emoji(value: bool) -> str: """Returns a unicode emoji based on a boolean value.""" if value is True: @@ -6,3 +8,9 @@ def get_bool_emoji(value: bool) -> str: return "\N{NO ENTRY SIGN}" if value is None: return "\N{BLACK QUESTION MARK ORNAMENT}\N{VARIATION SELECTOR-16}" + +def get_pagesize_str(value: Union[int, None]) -> str: + """Returns a string based on a pagesize value.""" + if value is None: + return "\N{BLACK QUESTION MARK ORNAMENT}\N{VARIATION SELECTOR-16}" + return str(value) + " cases per page"