Skip to content

Timer#

Client #

Client(database: DatabaseBuilder, delay: int = 60)

Timer Client

The base class, for creating everything related to database timers.

PARAMETER DESCRIPTION
database

The database you will use for the Timer class.

TYPE: DatabaseBuilder

delay

The delay of when timers have a task created for them.

About delay

The delay argument can be modified, but would not be recommended.

● Lower number: This will cause there to be more tasks, but the tasks will last for a shorter amount of time.
● Higher number: This will cause there to be more tasks, with longer times between execution of the tasks.

TYPE: int DEFAULT: 60

load async #

load() -> None

Load Timer

Load the timer instance, connect to the database, and check the timers.

unload async #

unload() -> None

Unload Timer

Unload the timer instance, disconnect from the database, and clean up.

create async #

create(delay: int, name: str) -> Timer

Create Timer

Creates a new timer with the set time.

Note

This does not start the timer. You must run the start function.

PARAMETER DESCRIPTION
delay

The delay in which it will take to trigger this timer.

TYPE: int

name

The name of the function, that will run.

TYPE: str

start async #

start(timer: Timer) -> Timer

Start Timer

Start a timer, for your event.

PARAMETER DESCRIPTION
timer

The timer you wish to start

TYPE: Timer

RAISES DESCRIPTION
TimerException

The timer has already ended.

cancel async #

cancel(timer: Timer) -> None

Cancel a timer

Cancel the requested timer.

PARAMETER DESCRIPTION
timer

The timer you wish to cancel.

TYPE: Timer

listen #

listen(name: str) -> t.Callable[[FuncT], FuncT]

Listen for the name

This will listen for this functions name, and if any timers call that specific name, it will call it.

Warning

The name MUST be unique. If they are not unique, the program will not run.

PARAMETER DESCRIPTION
name

The name of the function

TYPE: str