⚙ Utils

Cache

GoldyBot.utils.cache.cache_lookup(key: str, cache: Dict[str, Tuple[str, T]] | List[Tuple[str, T]] | Set[Tuple[str, T]], cap_sensitive=True) Tuple[str, T] | None[source]

Finds and returns object using key from any goldy bot cache object.

Human Datetime Utils

class GoldyBot.utils.human_datetime.HumanDatetimeOptions(value)[source]

Bases: Enum

An enumeration.

BOTH = 2
DATE = 1
TIME = 0
GoldyBot.utils.human_datetime.get_datetime(human_time: str, option: Literal[HumanDatetimeOptions.TIME, 0], time_formats=['%H:%M']) datetime | None[source]
GoldyBot.utils.human_datetime.get_datetime(human_date: str, option: Literal[HumanDatetimeOptions.DATE, 1], date_formats=['%d/%m/%Y', '%Y/%m/%d']) datetime | None
GoldyBot.utils.human_datetime.get_datetime(human_datetime: str, option: Literal[HumanDatetimeOptions.BOTH, 2], datetime_formats=['%d/%m/%Y %H:%M', '%Y/%m/%d %H:%M', '%d.%m.%Y %H:%M', '%Y.%m.%d %H:%M']) datetime | None

A Goldy Bot utils function that can read human time and date and convert them to a datetime object.

Returns None if the human datetime string can’t be recognized.

String Utils

GoldyBot.utils.strings.line_fix(string: str) str[source]

Fixes this -> https://github.com/Goldy-Bot/Goldy-Bot-V5/issues/37

Asynchronous Delay

GoldyBot.utils._async.delay(coro, seconds: float, goldy: Goldy)[source]

Delays a asynchronous function.

Is Lambda

GoldyBot.utils._lambda.is_lambda(_lambda: Callable) bool[source]

Returns true if the callable passed into this function is a lambda function.