Pincer Utils Module¶
Api Object¶
APIObject¶
- clsAPIObject.from_dict
- defto_dict
Directory¶
chdir¶
Signature¶
get_signature_and_params¶
- get_signature_and_params(func)¶
Get the parameters and signature from a coroutine.
- func: Callable
The coroutine from whom the information should be extracted.
- Returns
Signature and ist of parameters of the coroutine.
- Return type
Tuple[List[Union[
str
,inspect.Parameter
]]]
get_params¶
- get_params(func)¶
Get the parameters from a coroutine.
- func: Callable
The coroutine from whom the information should be extracted.
- Returns
List of parameters of the coroutine.
- Return type
List[Union[
str
,inspect.Parameter
]]
Snowflake¶
Snowflake¶
- class Snowflake¶
Bases:
int
Discord utilizes Twitter’s snowflake format for uniquely identifiable descriptors (IDs).
These IDs are guaranteed to be unique across all of Discord, except in some unique scenarios in which child objects share their parent’s ID.
Because Snowflake IDs are up to 64 bits in size (e.g. a uint64), they are always returned as strings in the HTTP API to prevent integer overflows in some languages.
- classmethod from_string(string)¶
Initialize a new Snowflake from a string.
- Parameters
string (
str
) – The snowflake as a string.
- property increment¶
For every ID that is generated on that process, this number is incremented.
- Type
- property timestamp¶
Milliseconds since Discord Epoch, the first second of 2015 or 14200704000000
- Type
Tasks¶
Task¶
- class Task¶
Bases:
object
A Task is a coroutine that is scheduled to repeat every x seconds. Use a TaskScheduler in order to create a task. :param scheduler: The scheduler to use. :type scheduler:
TaskScheduler
:param coro: The coroutine to register as a task. :type coro:Coro
:param delay: Delay between each iteration of the task. :type delay:float
- cancel()¶
Cancel the task.
- property client_required¶
- start()¶
Register the task in the TaskScheduler and start the execution of the task.
TaskScheduler¶
- class TaskScheduler¶
Bases:
object
- @loop(days=0, weeks=0, hours=0, minutes=0, seconds=0, milliseconds=0, microseconds=0)¶
A decorator to create a task that repeat the given amount of t :Example usage:
- Parameters
days (
int
) – Days to wait between iterations.Default:0
weeks (
int
) – Days to wait between iterations.Default:0
hours (
int
) – Days to wait between iterations.Default:0
minutes (
int
) – Days to wait between iterations.Default:0
seconds (
int
) – Days to wait between iterations.Default:0
milliseconds (
int
) – Days to wait between iterations.Default:0
microseconds (
int
) – Days to wait between iterations.Default:0
- Raises
TaskIsNotCoroutine: – The task is not a coroutine.
TaskInvalidDelay: – The delay is 0 or negative.
- close()¶
Gracefully stops any running task.
Timestamp¶
Timestamp¶
- defepoch_to_datetime
- defparse
- defstring_to_datetime
- defto_epoch
- class Timestamp¶
Bases:
object
Contains a lot of useful methods for working with timestamps.
- Parameters
time (Union[
str
,int
,float
,datetime.datetime
]) –
- staticmethod epoch_to_datetime(epoch)¶
Convert an epoch to a datetime object.
- Returns
The converted datetime object.
- Return type
- staticmethod parse(time=None)¶
Convert a time to datetime object.
- time: Optional[Union[
str
,int
,float
,datetime.datetime
]] The time to be converted to a datetime object. This can be one of these types: datetime, float, int, str
If no parameter is passed it will return the current datetime.
- Returns
The converted datetime object.
- Return type
- time: Optional[Union[
- staticmethod string_to_datetime(string)¶
Convert a string to a datetime object.
- string:
str
The string to convert.
- Returns
The converted datetime object.
- Return type
- string:
- staticmethod to_epoch(time)¶
Convert a datetime to an epoch.
- time:
datetime.datetime
The datetime to convert.
- Returns
The epoch time integer.
- Return type
- time:
Types¶
MissingType¶
MISSING¶
- MISSING: MissingType¶
APINullable¶
- APINullable: Union[T, MissingType]¶
Represents a value which is optionally returned from the API
Coro¶
- Coro: TypeVar("Coro", bound=Callable[..., Coroutine[Any, Any, Any]])¶
Represents a coroutine.