Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Latest commit

 

History

History
216 lines (154 loc) · 9.4 KB

events.rst

File metadata and controls

216 lines (154 loc) · 9.4 KB

Event Reference

This section outlines the different types of events dispatched by discodo client.

Note

If you are using a standalone discodo node server while not using :pyDPYClient, the events that you get will have something different. See this node_events.

To listen an event, use :pyEventDispatcher of the :pyDPYClient

import discord
import discodo

bot = discord.Client()
codo = discodo.DPYClient(bot)

# Using DPYClient.event

@codo.event("SOURCE_START")
async def start_event(VC, source):
    print(f"{VC} is now playing {source}")

# Using DPYClient.dispatcher.on

async def stop_event(VC, source):
    print(f"{VC} is stopped {source}")

codo.dispatcher.on("SOURCE_STOP", stop_event)

VC_CREATED(:pyVoiceClient, :pydict data)

Called when the new voice client has successfully created. This is not the same as the client being fully connected.

Data Structure

Field Type Description

guild_id

int

The guild id of the voice client

---------------- --------------------- ----------------------------------

id

str

The id of the voice client

QUEUE_EVENT(:pyVoiceClient, :pydict data)

Called when there is something changed in the queue of the voice client. If you are using :pyDPYClient, Ignore this event.

Data Structure

Field Type Description

guild_id

int

The guild id of the voice client

---------------- --------------------- ----------------------------------

name

str

The name of the method

---------------- --------------------- ----------------------------------

args

list

The arguments of the method

VC_CHANNEL_EDITED(:pyVoiceClient, :pydict data)

Called when the voice channel of the voice client is changed.

Data Structure

Field Type Description

guild_id

int

The guild id of the voice client

---------------- --------------------- -----------------------------------

channel_id

int

The channel id of the voice client

putSource(:pyVoiceClient, :pydict data)

Called when some sources are put in the queue.

Data Structure

Field Type Description

guild_id

int

The guild id of the voice client

---------------- --------------------- -----------------------------------

sources

list

The sources which is put

loadSource(:pyVoiceClient, :pydict data)

Called when some sources are searched and put in the queue.

Data Structure

Field Type Description

guild_id

int

The guild id of the voice client

---------------- ----------------------- ---------------------------------------

source

Union[AudioData, list]

The sources which is searched and put

REQUIRE_NEXT_SOURCE(:pyVoiceClient, :pydict data)

Called when the player needs next source to play. If you set autoplay as True, the related source will be put after this event.

Data Structure

Field Type Description

guild_id

int

The guild id of the voice client

---------------- ----------------------- --------------------------------------------------

current

AudioSource

The source which the player is currently playing

SOURCE_START(:pyVoiceClient, :pydict data)

Called when the player starts to play the source.

Data Structure

Field Type Description

guild_id

int

The guild id of the voice client

---------------- ----------------------- --------------------------------------------

source

AudioSource

The source which the player starts to play

SOURCE_STOP(:pyVoiceClient, :pydict data)

Called when the player stops to play the source.

Data Structure

Field Type Description

guild_id

int

The guild id of the voice client

---------------- ----------------------- --------------------------------------------

source

AudioSource

The source which the player stops to play

PLAYER_TRACEBACK(:pyVoiceClient, :pydict data)

Called when the player gets some traceback while trying to send packets to discord server.

Data Structure

Field Type Description

guild_id

int

The guild id of the voice client

---------------- ------------------------------- ----------------------------------------------------------------

traceback

str

The traceback information which the player gets

SOURCE_TRACEBACK(:pyVoiceClient, :pydict data)

Called when the player gets some traceback while trying to play the source. That source will be automatically removed from the queue.

Data Structure

Field Type Description

guild_id

int

The guild id of the voice client

---------------- ------------------------------- ----------------------------------------------------------------

source

Union[AudioData, AudioSource]

The source which the player gets traceback while trying to play

---------------- ------------------------------- ----------------------------------------------------------------

traceback

str

The traceback information which the player gets