forked from cswimr/SeaCogs
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
from typing import Union
|
|
|
|
from discord import SelectOption
|
|
|
|
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
|