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 teamtalk.* 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 teamtalk.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¶
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¶
on_message |
teamtalk.Message (either teamtalk.ChannelMessage, teamtalk.DirectMessage, teamtalk.BroadcastMessage) |
Called when the bot receives a message. |
on_my_connect |
teamtalk.Server |
Called when the bot has successfully connected to the teamtalk.Server |
on_my_login |
teamtalk.Server |
Called when the bot has successfully logged in to the teamtalk.Server |
on_my_logout |
teamtalk.Server |
Called when the bot has successfully logged out from the teamtalk.Server |
on_my_disconnec |
teamtalk.Server |
Called when the bot has successfully disconnected from the teamtalk.Server |
on_my_connection_lost |
teamtalk.instance |
Called when the bot has lost connection to the teamtalk.Server |
on_my_kicked_from_channel |
teamtalk.Channel |
Called when the bot has been kicked from teamtalk.Channel |
Server, Channel & File Events¶
on_channel_new |
teamtalk.Channel |
Called when a new channel (teamtalk.Channel) is created. |
on_channel_update |
teamtalk.Channel |
Called when a teamtalk.Channel has been updated. |
on_channel_delete |
teamtalk.Channel |
Called when a teamtalk.Channel has been deleted from the server. |
on_server_update |
teamtalk.Server |
Called when a teamtalk.Server has updated its settings. |
on_server_statistics |
teamtalk.Statistics |
Called when a TeamTalk server sends it’s statistics. |
on_file_new |
teamtalk.RemoteFile |
Called when a file has been uploaded to a channel. |
on_file_delete |
teamtalk.RemoteFile |
Called when a file has been deleted from a channel. |
on_muxed_audio |
teamtalk.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 |
teamtalk.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¶
on_user_audio |
teamtalk.AudioBlock |
Called when a user transmits audio. |
on_user_login |
teamtalk.user |
Called when a user logs in to a server that the bot is on |
on_user_logout |
teamtalk.User |
Called when a user logs out from a server that the bot is on |
on_user_update |
teamtalk.User |
Called when a user gets updated |
on_user_join |
teamtalk.User, teamtalk.Channel |
Called when a teamtalk.User joins a teamtalk.Channel |
on_user_left |
teamtalk.User, teamtalk.Channel |
Called when a teamtalk.User leaves a teamtalk.Channel |