Events#
This is a document showing you the arguments from the different instances of common.Dispatcher
in the library.
Raw Dispatcher#
Can be found on ShardManadger.raw_dispatcher
and Shard.raw_dispatcher
.
These are the raw dispatchers that just relay raw events from the discord websocket (the gateway).
The event name here is the gateway opcode.
Example usage:
@shard.listen(GatewayOpcode.HEARTBEAT_ACK)
async def on_heartbeat_ack(data):
print("<3")
Event Dispatcher#
Can be found on ShardManadger.event_dispatcher
and Shard.event_dispatcher
.
These dispatchers dispatch the data inside the d
key of a GatewayOpcode.DISPATCH
event.
The event name is the Dispatch event name.
Example usage:
@shard.listen("READY")
async def on_ready(data: ReadyData):
print(f"Logged in as {data.user.username}#{data.user.discriminator}")
HTTPClient dispatcher#
Can be found on HTTPClient.dispatcher
.
The event name is a str
representing the event name.
request_response#
Whenever a response to a request to Discord has been received, this event is dispatcher. The first argument will be the aiohttp.ClientResponse
object.
Example usage:
@http_client.dispatcher.listen("request_response")
async def on_request_response(response: aiohttp.ClientResponse):
print(f"Status code: {response.status}")