API Reference¶
The following section outlines the API of stoat’s chunking extension module.
Member Chunking¶
MemberChunker¶
- async can_chunk
- async chunk
- async get_priorities
- def is_chunking_completed
- async process_ready
- async process_server_create
- async process_server_delete
- async process_server_member_join
- async process_server_member_remove
- class stoat.ext.chunking.MemberChunker(client, *, flags=None, priorities=None, servers=None)[source]¶
Represents a member chunker.
- Parameters:
client (
Client) – The client.flags (Optional[
MemberChunkerFlags]) – The flags to use when chunking.prioritize (Optional[Dict[
str,int]]) – The prioritized servers to chunk.servers (Optional[List[
str]]) – The list of servers to only chunk ifMemberChunkerFlags.chunk_only_serversisTrue, or exclude them otherwise.
- flags¶
The flags to use when chunking.
- Type:
- servers¶
The list of servers to only chunk if
MemberChunkerFlags.chunk_only_serversisTrue, or exclude them otherwise.- Type:
List[
str]
- is_chunking_completed()[source]¶
bool: Returns whether chunking process was completed after receivingReadyEvent.
- 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:
server (
Server) – The server to chunk.cache_context (
BaseCacheContext) – The cache context.
- Returns:
The member list.
- Return type:
MemberChunkerFlags¶
- asynchronously_chunk_prioritized_servers
- chunk_only_servers
- defer_prioritized
- keep_users_with_no_mutual_servers
- subscribe_to_events
- subscribe_to_ready
- subscribe_to_server_create
- subscribe_to_server_delete
- subscribe_to_server_member_join
- subscribe_to_server_member_remove
- synchronously_chunk_unprioritized_servers
- value
- 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:
- subscribe_to_ready¶
Whether to auto subscribe to
ReadyEvent.- Type:
- subscribe_to_server_create¶
Whether to auto subscribe to
ServerCreateEvent.- Type:
- subscribe_to_server_delete¶
Whether to auto subscribe to
ServerDeleteEvent.- Type:
- subscribe_to_server_member_join¶
Whether to auto subscribe to
ServerMemberJoinEvent.- Type:
- subscribe_to_server_member_remove¶
Whether to auto subscribe to
ServerMemberRemoveEvent.- Type:
- subscribe_to_events¶
Whether to auto subscribe to
ReadyEvent,ServerCreateEvent,ServerDeleteEvent,ServerMemberJoinEventandServerMemberRemoveEvent.- Type:
- chunk_only_servers¶
Whether to chunk only provided servers in constructor, not exclude them.
- Type:
- asynchronously_chunk_prioritized_servers¶
Whether to asynchronously chunk prioritized servers or not.
- Type:
- synchronously_chunk_unprioritized_servers¶
Whether to synchronously chunk unprioritized servers or not.
- Type: