String Utilities API Reference¶
- toolbox.strings.format_dt(time: datetime.datetime, style: Optional[str] = None) str[source]¶
Convert a datetime into a Discord timestamp. For styling see this link: https://discord.com/developers/docs/reference#message-formatting-timestamp-styles
- Parameters
time (datetime.datetime) – The datetime to convert.
style (str, optional) – The style to use for the timestamp, by default None.
- Returns
The formatted timestamp.
- Return type
- toolbox.strings.is_invite(string: str, *, fullmatch: bool = True) bool[source]¶
Returns True if the provided string is a Discord invite, otherwise False.
- toolbox.strings.is_url(string: str, *, fullmatch: bool = True) bool[source]¶
Returns True if the provided string is a valid http URL, otherwise False.
- toolbox.strings.utcnow() datetime.datetime[source]¶
A short-hand function to return a timezone-aware utc datetime.
- Returns
The current timezone-aware utc datetime.
- Return type