fix(aurora): fixed TypeError in embed _overrides function
Some checks failed
Actions / Lint Code (Pylint) (pull_request) Failing after 15s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 11s

This commit is contained in:
Seaswimmer 2024-01-15 07:07:06 +00:00
parent d99df7f898
commit a373f63756
Signed by: cswimr
GPG key ID: D74DDDDF420E13DF
2 changed files with 13 additions and 5 deletions

View file

@ -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

View file

@ -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"