State

Mock implementation of a discord.state.ConnectionState. Overwrites a Client’s default state, allowing hooking of its methods and support for test-related features.

class FakeState(client: Client, http: HTTPClient, user: ClientUser | None = None, loop: AbstractEventLoop | None = None)

A mock implementation of a ConnectionState. Overrides methods that would otherwise cause issues, and implements functionality such as disabling dispatch temporarily.

http: back.FakeHttp
__init__(client: Client, http: HTTPClient, user: ClientUser | None = None, loop: AbstractEventLoop | None = None) None
stop_dispatch() None

Stop dispatching events to the client, if we are

start_dispatch() None

Start dispatching events to the client, if we aren’t already

async query_members(guild: Guild, query: str, limit: int, user_ids: int, cache: bool, presences: bool) None
async chunk_guild(guild: Guild, *, wait: bool = True, cache: bool | None = None)
parse_channel_create(data) None

Need to make sure that FakeVoiceChannels are created when this is called to create VoiceChannels. Otherwise, guilds would not be set up correctly.

Parameters:

data – info to use in channel creation.