API Reference

The following section outlines the API of stoat’s chunking extension module.

Member Chunking

MemberChunker

class stoat.ext.chunking.MemberChunker(client, *, flags=None, priorities=None, servers=None)[source]

Represents a member chunker.

Parameters:
client

The client.

Type:

Client

flags

The flags to use when chunking.

Type:

MemberChunkerFlags

prioritize

The prioritized servers to chunk.

Type:

Dict[str, int]

servers

The list of servers to only chunk if MemberChunkerFlags.chunk_only_servers is True, or exclude them otherwise.

Type:

List[str]

is_chunking_completed()[source]

bool: Returns whether chunking process was completed after receiving ReadyEvent.

await get_priorities()[source]

Dict[str, int]: Retrieve server priorities.

await can_chunk(server, /)[source]

bool: Whether the server should be chunked.

await process_ready(event, /)[source]

Process a ReadyEvent.

Parameters:

event (ReadyEvent) – The event to process.

await process_server_create(event, /)[source]

Process a ServerCreateEvent.

Parameters:

event (ServerCreateEvent) – The event to process.

await process_server_delete(event, /)[source]

Process a ServerDeleteEvent.

Parameters:

event (ServerDeleteEvent) – The event to process.

await process_server_member_join(event, /)[source]

Process a ServerMemberJoinEvent.

Parameters:

event (ServerMemberJoinEvent) – The event to process.

await process_server_member_remove(event, /)[source]

Process a ServerMemberRemoveEvent.

Parameters:

event (ServerMemberRemoveEvent) – The event to process.

await chunk(server, cache_context, /)[source]

Chunks a server.

Parameters:
Returns:

The member list.

Return type:

MemberList

MemberChunkerFlags

class stoat.ext.chunking.MemberChunkerFlags(value=0, /, **kwargs)[source]

Wraps up a member chunker flag value.

x == y

Checks if two flags are equal.

x != y

Checks if two flags are not equal.

x | y, x |= y

Returns a MemberChunkerFlags instance with all enabled flags from both x and y.

x & y, x &= y

Returns a MemberChunkerFlags instance with only flags enabled on both x and y.

x ^ y, x ^= y

Returns a MemberChunkerFlags instance with only flags enabled on only one of x or y, not on both.

~x

Returns a MemberChunkerFlags instance with all flags inverted from x.

hash(x)

Return the flag’s hash.

iter(x)

Returns an iterator of (name, value) pairs. This allows it to be, for example, constructed as a dict or a list of pairs.

bool(b)

Returns whether any flag is set to True.

value

The raw value. This value is a bit array field of a 53-bit integer representing the currently available flags. You should query flags via the properties rather than using this raw value.

Type:

int

subscribe_to_ready

Whether to auto subscribe to ReadyEvent.

Type:

bool

subscribe_to_server_create

Whether to auto subscribe to ServerCreateEvent.

Type:

bool

subscribe_to_server_delete

Whether to auto subscribe to ServerDeleteEvent.

Type:

bool

subscribe_to_server_member_join

Whether to auto subscribe to ServerMemberJoinEvent.

Type:

bool

subscribe_to_server_member_remove

Whether to auto subscribe to ServerMemberRemoveEvent.

Type:

bool

subscribe_to_events

Whether to auto subscribe to ReadyEvent, ServerCreateEvent, ServerDeleteEvent, ServerMemberJoinEvent and ServerMemberRemoveEvent.

Type:

bool

chunk_only_servers

Whether to chunk only provided servers in constructor, not exclude them.

Type:

bool

defer_prioritized

Whether to defer prioritized servers for chunking.

Type:

bool

asynchronously_chunk_prioritized_servers

Whether to asynchronously chunk prioritized servers or not.

Type:

bool

synchronously_chunk_unprioritized_servers

Whether to synchronously chunk unprioritized servers or not.

Type:

bool

keep_users_with_no_mutual_servers

Whether to keep users cache if they no longer have mutual servers or not.

Type:

bool