PyTox wraps libtoxcore API with the object pytox.Tox, all the tox API methods are in this class.
ToxCore object
Add a friend.
Add a friend without sending request.
Creates a new groupchat and puts it in the chats array.
Resolves address into an IP address. If successful, sends a ‘get nodes’request to the given node with ip, port.
Return the number of chats in the current Tox instance.
Return the number of friends.
Remove a friend.
Delete a groupchat from the chats array.
The main loop that needs to be run at least 20 times per second.
returns time (in ms) before the next tox_do() needs to be run on success.
Give the number of bytes left to be sent/received. send_receive is 0 for sending and 1 for receiving.
Returns the recommended/maximum size of the filedata you send with file_send_data().
Send file transfer control.
send_receive is 0 for sending and 1 for receiving.
control_type can be one of following value:
control_type | description |
---|---|
Tox.FILECONTROL_ACCEPT | accepts transfer |
Tox.FILECONTROL_PAUSE | pause transfer |
Tox.FILECONTROL_KILL | kill/rejct transfer |
Tox.FILECONTROL_FINISHED | transfer finished |
Tox.FILECONTROL_RESUME_BROKEN | resume broken transfer |
Send file data.
Checks if there exists a friend with given friendnumber.
Return address to give to others.
Return a list of valid group numbers.
Return the public key associated to that friend number.
Return True if friend is connected(Online) else False.
Return the friend id associated to that client id.
Get a list of valid friend numbers.
Return True is user is typing.
Get the public and secret key from the Tox object. Return a tuple (public_key, secret_key)
returns datetime.datetime object representing the last time friend_number was seen online, or None if never seen.
Get nickname of friend_number.
Get nickname length of friend_number.
get nospam part from ID
Return the number of online friends.
Get your nickname.
Get your nickname string length
Get status message of yourself.
Get status message string length of yourself.
Get user status of youself.
See also
Get status message of a friend.
Return the length of friend_number‘s status message.
Get friend status.
See also
send a group action.
List all the peers in the group chat.
Returns the title for group_number.
Return the type of group, could be the following value:
type | description |
---|---|
Tox.GROUPCHAT_TYPE_TEXT | text chat |
Tox.GROUPCHAT_TYPE_AV | video chat |
send a group message.
Return the number of peers in the group chat.
Get the group peer’s name.
Sets the title for group.
Invite friendnumber to groupnumber.
Return False if we are not connected to the DHT.
Join a group (you need to have been invited first.). Returns the group number of success.
Run this before closing shop.
Load the messenger from blob.
Load the messenger from file.
Send a file send request. Returns file number to be sent.
Callback for receiving read receipt, default implementation does nothing.
status is a boolean value which indicates the status of the friend indicated by friend_number. True means online and False means offline after previously online.
Callback for receiving file send control, default implementation does nothing. See file_send_control() for the meaning of receive_send and control_type.
See also
Callback for receiving file data, default implementation does nothing.
Callback for receiving file send requests, default implementation does nothing.
Callback for receiving friend actions, default implementation does nothing.
Callback for receiving friend messages, default implementation does nothing.
Callback for receiving friend requests, default implementation does nothing.
Callback for receiving group actions, default implementation does nothing.
Callback for receiving group invitations, default implementation does nothing.
See also
Callback for receiving group messages, default implementation does nothing.
Callback for receiving group messages, default implementation does nothing.
There are there possible change values:
change | description |
---|---|
Tox.CHAT_CHANGE_PEER_ADD | a peer is added |
Tox.CHAT_CHANGE_PEER_DEL | a peer is deleted |
Tox.CHAT_CHANGE_PEER_NAME | name of peer changed |
Callback for receiving friend name changes, default implementation does nothing.
Callback for receiving read receipt, default implementation does nothing.
Callback for receiving friend status message changes, default implementation does nothing.
Callback for receiving friend status changes, default implementation does nothing.
Callback for receiving friend status changes, default implementation does nothing.
See also
Return messenger blob in str.
Save the messenger to a file.
Send an action to an online friend.
Send a text chat message to an online friend.
Set our nickname.
set nospam part of ID. nospam should be of type uint32
Set our user status message.
Set user typing status.
Set our user status, status can have following values:
kind | description |
---|---|
Tox.USERSTATUS_NONE | the user is online |
Tox.USERSTATUS_AWAY | the user is away |
Tox.USERSTATUS_BUSY | the user is busy |
Tox.USERSTATUS_INVALID | invalid status |
return size of messenger data (for saving).