2024-01-15 02:07:06 -05:00
|
|
|
from typing import Union
|
|
|
|
|
2024-01-16 05:57:21 -05:00
|
|
|
from discord import SelectOption
|
|
|
|
|
2024-01-13 10:44:08 -05:00
|
|
|
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}"
|
2024-01-15 06:49:20 -05:00
|
|
|
return "\N{BLACK QUESTION MARK ORNAMENT}\N{VARIATION SELECTOR-16}"
|
2024-01-15 02:07:06 -05:00
|
|
|
|
|
|
|
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"
|
2024-01-16 05:57:21 -05:00
|
|
|
|
|
|
|
def create_pagesize_options() -> list[SelectOption]:
|
|
|
|
"""Returns a list of SelectOptions for pagesize configuration."""
|
2024-01-16 06:11:38 -05:00
|
|
|
options = []
|
|
|
|
options.append(
|
2024-01-16 05:57:21 -05:00
|
|
|
SelectOption(
|
2024-01-16 06:11:38 -05:00
|
|
|
label="Default",
|
|
|
|
value="default",
|
|
|
|
description="Reset the pagesize to the default value.",
|
2024-01-16 05:57:21 -05:00
|
|
|
)
|
2024-01-16 06:11:38 -05:00
|
|
|
)
|
|
|
|
for i in range(1, 21):
|
|
|
|
options.append(
|
|
|
|
SelectOption(
|
|
|
|
label=str(i),
|
|
|
|
value=str(i),
|
|
|
|
description=f"Set the pagesize to {i}.",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return options
|