event reference

This page documents the various events that a TeamTalk Bot can listen to.

The tables are grouped by relevance.

For more information, on what each pytalk.* function does, please refer to the API Reference documentation.

How do I use these events?

The events are listed in the following tables. Each event has a name, a list of arguments that are passed to the event handler and a description of what the event is.

To listen to an event, you must use the pytalk.bot.event() decorator.

example:

@bot.event
def on_message(message):
    print(message)

The above code will print the message object to the console whenever a message is sent. The message object is passed to the event handler as an argument.

Missellaneous Events

Miscellaneous Events

on_ready

None

Called when the bot is started and ready to accept events.

on_error

event_name (str), *args (Any), **kwargs (Any)

Called when another event errors. Has a default implementation

Bot Events

Bot Events

on_message

pytalk.Message (either pytalk.ChannelMessage, pytalk.DirectMessage, pytalk.BroadcastMessage)

Called when the bot receives a message.

on_my_connect

pytalk.Server

Called when the bot has successfully connected to the pytalk.Server.

on_my_connect_failed

pytalk.Server

Called when the bot has failed to connect to the pytalk.Server.

on_my_connect_crypt_error

pytalk.Server

Called when the bot has failed to connect to the pytalk.Server due to a cryptography error.

on_my_disconnect

pytalk.Server

Called when the bot has successfully disconnected from the pytalk.Server.

on_my_login

pytalk.Server

Called when the bot has successfully logged in to the pytalk.Server.

on_my_logout

pytalk.Server

Called when the bot has successfully logged out from the pytalk.Server.

on_my_connection_lost

pytalk.instance

Called when the bot has lost connection to the pytalk.Server.

on_my_kicked_from_channel

pytalk.Channel

Called when the bot has been kicked from pytalk.Channel.

Server, Channel & File Events

Server, Channel & File Events

on_channel_new

pytalk.Channel

Called when a new channel (pytalk.Channel) is created.

on_channel_update

pytalk.Channel

Called when a pytalk.Channel has been updated.

on_channel_delete

pytalk.Channel

Called when a pytalk.Channel has been deleted from the server.

on_server_update

pytalk.Server

Called when a pytalk.Server has updated its settings.

on_server_statistics

pytalk.Statistics

Called when a TeamTalk server sends it’s statistics.

on_file_new

pytalk.RemoteFile

Called when a file has been uploaded to a channel.

on_file_delete

pytalk.RemoteFile

Called when a file has been deleted from a channel.

on_muxed_audio

pytalk.MuxedAudioBlock

called when a muxed audio block is recieved, this is used to get audio from all users in the channel at once.

on_user_audio

pytalk.AudioBlock

called when an audio block is recieved from a user, this is the audio for an individual user, not the hole server.

User Events

User Events

on_user_audio

pytalk.AudioBlock

Called when a user transmits audio.

on_user_login

pytalk.user

Called when a user logs in to a server that the bot is on

on_user_logout

pytalk.User

Called when a user logs out from a server that the bot is on

on_user_update

pytalk.User

Called when a user gets updated

on_user_join

pytalk.User, pytalk.Channel

Called when a pytalk.User joins a pytalk.Channel

on_user_left

pytalk.User, pytalk.Channel

Called when a pytalk.User leaves a pytalk.Channel

on_user_account_new

pytalk.UserAccount

Called when a new user account is created on the server.

on_user_account_remove

pytalk.UserAccount

Called when a user account is deleted from the server.