Package: dendrotox
dendrotoxis a Python module designed to enable Python code to
interact with theToxdistributed communications
network, including for the purposes of scripts communicating with people
or other scripts. It uses a 2015 version ofToxCoreandratoxfor interfacing with
the Tox network andmegaparsexfor parsing.In particular,dendrotoxinteracts with the filesystem provided by
the FIFO Tox clientratox.dendrotoxalso provides functionality to send and receive messages,
to parse input, to send files, to request confirmations, to provide
information such as IP address and weather information, and to run
arbitrary commands, including functionality to launch reverse-SSH
connections and to restart a script.ToxTox is a peer-to-peer instant-messaging and video-calling protocol that
has end-to-end encryption.The following is a typical Tox ID that one contact can give to another
contact in order to connect:56A1ADE4B65B86BCD51CC73E2CD4E542179F47959FE3E0E21B4B0ACDADE5185520B3E6FC5D64
<--------------------------------------------------------------><------><-->
                                ^                                  ^      ^
                                |                                  |      |
                                |                                  |      |
                            PUBLIC KEY                        NOSPAM      CHECKSUMThe Tox ID is a public key (64 characters), a nospam value (8
characters) and a checksum (4 characters) concatenated in hexadecimal
format. The result is a 76 character string.The public key is generated by the NaCl (Networking and Cryptographic
library)crypto_box_keypairfunction. It is 32 bytes (64 hexadecimal
characters). The nospam value is a generated pseudorandom number
appended to the public key. A connect request sent without the correct
nospam value is ignored. The nospam value can be changed at any time
without affecting the public key, stopping all requests to the current
ID, in order to fight spam. The checksum is a simple XOR checksum of the
public key and the nospam value. It is used to quickly verify the
integrity of the Tox ID.Because Tox has no central servers, it is necessary to know a node that
is already in the network before a client can be connected suffessfully.
Some nodes are listedhere.setupsudoaptinstall\autoconf\autotools-dev\automake\build-essential\checkinstall\check\cmake\festival\git\libtool\libsodium-dev\sox\yasmmkdir~/Toxcd~/ToxInstall FFmpeg.sudoaptinstalllamelibmp3lame-devwgethttp://ffmpeg.org/releases/ffmpeg-3.3.2.tar.bz2tar-xvfffmpeg-3.3.2.tar.bz2cdffmpeg-3.3.2./configure--enable-libmp3lamemake-j$(nproc)sudomakeinstallcd..rmffmpeg-3.3.2.tar.bz2rm-rfffmpeg-3.3.2Set upFestival,eSpeak, Pico TTS anddeep_throatfor speech
capabilities.sudoaptinstall\festival\espeak\libttspico0\libttspico-utils\libttspico-datasudopipinstalldeep_throatInstall the Sodium crypto library.gitclonehttps://github.com/jedisct1/libsodium.gitcdlibsodiumgitcheckouttags/1.0.3./autogen.sh./configuremakechecksudocheckinstall--install--pkgnamelibsodium--pkgversion1.0.0--nodocsudoldconfigcd..Install the libvpx codec.gitclonehttps://chromium.googlesource.com/webm/libvpxcdlibvpxgitcheckouttags/v1.4.0./configure--enable-shared--disable-staticmake-j$(nproc)sudomakeinstallcd..Install ToxCore.wget--content-dispositionhttps://codeload.github.com/irungentoo/toxcore/tar.gz/api_old_versiontar-xvftoxcore-api_old_version.tar.gzcdtoxcore-api_old_versionautoreconf--install--forcemkdir_buildcd_build../configuremake-j$(nproc)sudomakeinstallsudoldconfigcd../..Installratox.gitclonehttps://github.com/wdbm/ratox.gitcdratoxmake-j$(nproc)sudomakeinstallInstall dendrotox.sudopipinstalldentrodoxWhenratoxis launched for the first time, it creates a Tox profile
file.ratox.toxat the working directory to store Tox profile
details. While running, the fileidcontains the Tox ID.examplesdendrotoxis imported and launched in the following way:importdendrotoxdendrotox.start_messaging()print("Tox ID: "+dendrotox.self_ID())sending messagesA message can be sent to a contact in the following way, where a contact
is specified using a string containing their Tox ID:dendrotox.send_message(contact=contact,text="oohai")A message can be sent to multiple contacts in the following way, where
contacts are specified as a list of strings containing contacts’ Tox
IDs.dendrotox.send_message(contacts=[contact_1,contact_2],text="sup")A message can be sent to all contacts in the following way.dendrotox.send_message(contacts="all",text="yo yo yo")receiving messagesA list of unseen messages received recently can be accessed in the
following ways:messages=dendrotox.received_messages()print(messages[0].sender())message=dendrotox.last_received_message()print(message)sending sound callsA sound call can be sent to a contact in a few ways. One way is by
sending a sound file:dendrotox.send_call(contact=contact,filepath="alert.wav")Another way is by using synthesized speech:dendrotox.send_call_synthesized_speech(contact=contact,text="This is an alert.")Another way is by using a microphone:dendrotox.send_call(contact=contact,record=True)Sending a sound call by using a microphone can feature a record duration
specification in order to ensure that the process does not hang:dendrotox.send_call(contact=contact,record=True,duration_record=30)receiving sound callsA sound call can be received from a contact in a few ways. One way is by
using speakers:dendrotox.receive_call(contact=contact)If a contact is not specified, the first contacted identified as calling
is used to receive a call:dendrotox.receive_call()Another way is by receiving a sound file:dendrotox.receive_call(filepath="call.wav")See module code and example bot code for more advanced usage, including
calls, message parsing, confirmations and running commands.dendrotox_alert.pyThe scriptdendrotox_alert.pyis a command line script that can be
used to send a message to contacts. It attempts to connect with any
specified contacts before attempting to send a message to them. If no
contacts are specified, it attempts to send a message to all known
contacts.dendrotox_alert.py--text="alert"futureUnder consideration is speech-to-text for receiving calls.