Client
Reminder ¶
A class to manage reminders.
| PARAMETER | DESCRIPTION |
|---|---|
cycle
|
The cycle duration in milliseconds (default is 180ms). This determines how frequently the system checks for due schedules.
TYPE:
|
loop
|
The event loop to use, by default None (the current event loop is used).
TYPE:
|
event ¶
Register a coroutine function as an event handler.
This method assigns the given coroutine function to be used as an event handler with the same name as the coroutine function.
| PARAMETER | DESCRIPTION |
|---|---|
coro
|
The coroutine function to register as an event handler. |
on_error
async
staticmethod
¶
Handle errors occurring during event dispatch.
This static method logs an exception that occurred during the processing of an event.
| PARAMETER | DESCRIPTION |
|---|---|
event_name
|
The name of the event that caused the error.
TYPE:
|
error
|
The exception that was raised.
TYPE:
|
*args
|
Positional arguments passed to the event.
TYPE:
|
**kwargs
|
Keyword arguments passed to the event.
TYPE:
|
wait_for
async
¶
wait_for(schedule: Schedule) -> None
Wait for a schedule to complete based on its ID.
| PARAMETER | DESCRIPTION |
|---|---|
schedule
|
The schedule object to wait for.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If no schedule with the given ID exists. |
get_schedule_by_id ¶
Retrieve a schedule by its unique ID.
| PARAMETER | DESCRIPTION |
|---|---|
schedule_id
|
The unique ID of the schedule to retrieve.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Schedule
|
The schedule with the matching ID. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If no schedule with the given ID exists. |
get_schedules ¶
remove_schedule ¶
remove_schedule(schedule_id: str) -> None
Remove a schedule by its unique ID.
| PARAMETER | DESCRIPTION |
|---|---|
schedule_id
|
The unique ID of the schedule to remove.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If no schedule with the given ID is found. |
remove_schedule_by_title ¶
remove_schedule_by_title(title: str) -> None
Remove a schedule by its title via the manager.
| PARAMETER | DESCRIPTION |
|---|---|
title
|
The title of the schedule to remove.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If no schedule with the given title is found. |
add_schedule ¶
add_schedule(title: Optional[str] = None, duration: timedelta = timedelta(seconds=0), description: Optional[str] = None, callback: Optional[str] = None) -> Schedule
Add a new reminder with a specified title, duration, and optional description.
| PARAMETER | DESCRIPTION |
|---|---|
title
|
The title of the schedule. |
duration
|
The duration of the schedule. |
description
|
A description of the schedule. |
callback
|
A callback event name to be executed when the schedule ends. |
run ¶
run(log_handler: Optional[logging.Handler] = None, log_level: Optional[int] = None, root_logger: bool = False) -> None
Run the reminder system, setting up logging and starting the asynchronous event loop.
This method sets up the logging configuration and starts an asynchronous loop to run the main process, including the event handler and scheduler.
| PARAMETER | DESCRIPTION |
|---|---|
log_handler
|
A logging handler to manage log outputs. If None, default logging handler will be used. (default is None) |
log_level
|
The log level to use for logging output. If None, the default level will be used. (default is None) |
root_logger
|
Whether to set up the root logger. (default is False)
TYPE:
|