feat(aurora): merged all of the changes made in the configuration rewrite into the codebase of the cog itself
Some checks failed
Actions / Lint Code (Pylint) (pull_request) Failing after 17s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 13s

This commit is contained in:
SeaswimmerTheFsh 2024-01-16 14:23:45 +00:00
parent 3b8506cba8
commit 46a290aad3
Signed by: cswimr
GPG key ID: D74DDDDF420E13DF
13 changed files with 297 additions and 372 deletions

View file

@ -4,7 +4,7 @@ import json
from datetime import timedelta as td
from typing import Union
from discord import Guild, Interaction, Member, User
from discord import Guild, Interaction, Member, User, SelectOption
from discord.errors import Forbidden, NotFound
from redbot.core import commands
from redbot.core.utils.chat_formatting import error
@ -228,3 +228,37 @@ def convert_timedelta_to_str(timedelta: td) -> str:
minutes = (total_seconds % 3600) // 60
seconds = total_seconds % 60
return f"{hours}:{minutes}:{seconds}"
def get_bool_emoji(value: bool) -> str:
"""Returns a unicode emoji based on a boolean value."""
if value is True:
return "\N{WHITE HEAVY CHECK MARK}"
if value is False:
return "\N{NO ENTRY SIGN}"
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"
def create_pagesize_options() -> list[SelectOption]:
"""Returns a list of SelectOptions for pagesize configuration."""
options = []
options.append(
SelectOption(
label="Default",
value="default",
description="Reset the pagesize to the default value.",
)
)
for i in range(1, 21):
options.append(
SelectOption(
label=str(i),
value=str(i),
description=f"Set the pagesize to {i}.",
)
)
return options