disco.client

Classes

ClientConfig

Inherits From Config

Configuration for the Client.

Attributes
Name Type Description
token str Discord authentication token, can be validated using the `disco.util.token.is_valid_token` function.
shard_id int The shard ID for the current client instance.
shard_count int The total count of shards running.
max_reconnects int The maximum number of connection retries to make before giving up (0 = never give up). log_level: str The logging level to use.
manhole_enable bool Whether to enable the manhole (e.g. console backdoor server) utility.
manhole_bind tuple(str, int) A (host, port) combination which the manhole server will bind to (if its enabled using :attr:`manhole_enable`).
encoder str The type of encoding to use for encoding/decoding data from websockets, should be either 'json' or 'etf'.

Client

Inherits From LoggingClass

Class representing the base entry point that should be used in almost all implementation cases. This class wraps the functionality of both the REST API (disco.api.client.APIClient) and the realtime gateway API

Parameters
Name Type Description
config `ClientConfig` Configuration for this client instance.
Attributes
Name Type Description
config `ClientConfig` The runtime configuration for this client.
events `Emitter` An emitter which emits Gateway events.
packets `Emitter` An emitter which emits Gateway packets.
state `State` The state tracking object.
api `APIClient` The API client.
gw `GatewayClient` The gateway client.
manhole_locals dict Dictionary of local variables for each manhole connection. This can be modified to add/modify local variables.
manhole Optional[`BackdoorServer`] Gevent backdoor server (if the manhole is enabled).

Functions

init(self, config)

update_presence(self, status, game, afk=False, since=0.0)

Updates the current clients presence.

Params
Name Type Description
status `user.Status` The clients current status.
game `user.Game` If passed, the game object to set for the users presence.
afk bool Whether the client is currently afk.
since float How long the client has been afk for (in seconds).

run(self)

Run the client (e.g. the GatewayClient) in a new greenlet.

run_forever(self)

Run the client (e.g. the GatewayClient) in the current greenlet.

results matching ""

    No results matching ""