feat(aurora): merged all of the changes made in the configuration rewrite into the codebase of the cog itself
This commit is contained in:
parent
3b8506cba8
commit
46a290aad3
13 changed files with 297 additions and 372 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue