Typer

A typer what will keep sending typing events to the given channel with the client. Can be used as a context manager.

After entered as a context manager sends a typing event each 8 seconds to the given channel.

Attributes

channel_id : int

The channel's id where typing will be triggered.

client : Client

The client what will send the typing events.

timeout : float

The leftover timeout till the typer will send typing events. Is reduced every time, when the typer sent a typing event. If goes under 0.0 the typer stops sending more events.

waiter : Future, None

The sleeping future what will wake_up .run.

Methods

__init__(client, channel_id, ...)

ParameterTypeOptionalDefaultDescription
client

Client

The client what will send the typing events.

channel_id

int

The channel's id where typing will be triggered.

timeout

float

300.0

The maximal amount of time till the client will keep sending typing events. Defaults to 300.0.

cancel()

If the context manager is still active, cancels it.

run()

The coroutine what keeps sending the typing requests.

This method is a coroutine.

__await__()

Keeps typing till timeout occurs.

__enter__()

Enters the typer's context block by ensuring it's .run method.

__exit__()

Exits the typer's context block by cancelling it.