ReadyState

Attributes

client_reference : WeakReferer to Client

Reference to the ready state's client.

shard_count : int

The amount of shards of the client.

shard_ready_waiter : None of Future

Waiter for shard ready event.

shard_user_requesters : dict of (int, ShardUserRequester) items.

User requester for each shard.

task : None, Task to ._runner

Task, which waits for all the user requests to finish.

Methods

__new__(client)

Creates a new ready state instance from the given parameters.

ParameterTypeDescription
client

Client

The respective client instance.

call_ready()

Calls the ready event handler of the respective client.

cancel()

Cancels the ready state.

discard_guild(guild)

Discards a guild from the guild requests.

ParameterTypeDescription
guild

Guild

The guild to discard from the ready state.

feed_guild(client, guild)

Feeds the given guild to the ready state. Sets the last received guild's time to the current time and ends the ready state if there are no more guilds to receive.

ParameterTypeDescription
client

Client

The respective client instance.

guild

Guild

Received guild.

Returns

request_enqueued : bool

Whether the request is queued up.

shard_ready(guild_datas, shard_id)

Sets the ready state's .last_ready to the current time and increases it's .guild_left_counter by the length of the given data.

ParameterTypeDescription
guild_datas

list of object

Received guild datas.

shard_id

int

The shard's identifier.

_runner()

Runner task of the ready state waiting for all guild users to be requested.

This method is a coroutine.

__await__()

Waits till the ready state receives all of it's shards and guilds, or till timeout occurs.

This method is an awaitable generator.

__iter__()

Waits till the ready state receives all of it's shards and guilds, or till timeout occurs.

This method is an awaitable generator.