API Reference

The following section outlines the API of pytalk.

Note

This module uses the Python logging module to log diagnostic and errors in an output independent way. If the logging module is not configured,

Bot

Enums

TeamTalk enums and constants.

class pytalk.enums.TeamTalkServerInfo

Holds the required information to connect and login to a TeamTalk server.

__init__(data: dict[str, Any]) None

Initialize a TeamTalkServerInfo object.

Parameters:

data (dict) – A dictionary containing the server information.

classmethod from_dict(data: dict[str, Any]) Self

Construct a TeamTalkServerInfo object from a dictionary.

Parameters:

data (dict) – The dictionary to construct the object from.

Returns:

The constructed object.

Return type:

Self

to_dict() dict[str, Any]

Convert this object to a dictionary.

Returns:

The dictionary representation of this object.

Return type:

dict

class pytalk.enums.UserStatusMode

Represents user status modes (mutually exclusive).

ONLINE = 0

The user is online.

AWAY = 1

The user is away.

QUESTION = 2

The user has a question.

class pytalk.enums.Status

A helper class to construct combined status values for a user.

Use Status.online, Status.away, or Status.question properties, then chain them with a gender property (.male, .female, .neutral) to get the final status value for pytalk.TeamTalkInstance.change_status.

Examples

Status.online.male Status.away.female Status.question.neutral

This class should not be instantiated directly.

__init__() None

Prevent direct instantiation of the Status class.

Raises:

TypeError – If an attempt is made to instantiate this class.

classmethod online() _StatusBuilder

Set the user status to ‘online’.

classmethod away() _StatusBuilder

Set the user status to ‘away’.

classmethod question() _StatusBuilder

Set the user status to ‘question’.

class pytalk.enums.UserType

The type of a user account.

DEFAULT = 1

The default user type. This only has the permissions set, and no other permissions.

ADMIN = 2

The admin user type. This has all permissions.

Server

Channel

UserAccount

User

Message

Audio Streaming

Files

Permission

Subscriptions

Exceptions

teamtalk.py exceptions.

exception pytalk.exceptions.TeamTalkError

Base exception class for teamtalk.py.

All other exceptions inherit from this class, which inherits from Exception.

__init__(message: str) None

Initialise the exception.

Parameters:

message (str) – The message to be displayed when the exception is raised.

exception pytalk.exceptions.PytalkPermissionError

Exception raised when the bot does not have permission to perform an action.

TeamTalkInstance (low level)