Runners

High level runners for cordy only apps

async cordy.runner.run(client: Client)[source]

Start a client and await till it is stopped

Parameters

client (cordy.client.Client) – The Client to be ran.

async cordy.runner.run_all(clients: Iterable[Client])[source]

Start multiple clients and await till all have stopped.

Parameters

clients (Iterable[cordy.client.Client]) – The iterable of clients to be ran.

cordy.runner.launch(client: Client)[source]

Run the client until it is closed. Cleanup due to unforseen cancellation is handled.

Parameters

client (Client) – The client to run.

cordy.runner.launch_all(clients: Iterable[Client])[source]

launch all the given clients util all clients are closed. Cleanup for each client due to unforseen cancellation is handled.

Parameters

clients (Iterable[Client]) – All the clients to launch.

Example

Running a cordy client
import cordy
client = cordy.Client(token="<TOKEN>")

cordy.run(client)
Running multiple cordy clients
import cordy

tokens = ("<TOKENS>", ...)
clients = [cordy.Client(token=token) for token in tokens]

cordy.run_all(clients)