Core library of the retro end2end encrypted terminal messenger.
Installing libretro:
$ pip install .
Installing libretro in development mode:
$ pip install -e .
$ pip uninstall libretro
Account.py User account AccountDb.py User account database Config.py Client configs crypto.py Crypto and hash functions Friend.py Friend class FriendDb.py Encrypted sqlite3 db to resolve friendId's to names MsgHandler.py Create/Decrypt end2end messages MsgStore.py Message storage (encrypted sqlite) net.py Network functions (TLS) RegKey.py Registration key RetroBot.py Baseclass for creating bots RetroClient.py Central client context
Writing an own retro bot is really straight forward.
The only thing you need to do is to subclass libretro.RetroBot
and overwrite the method handle_message()
.
from libretro.RetroBot import RetroBot class MyBot(libretro.RetroBot): def __init__(self): super().__init__() ... def handle_message(sender:Friend, text:str): # Here we do override the method that # is called after receiving a chatmsg. # In this case simply send the message # back to the sender... self.send_msg(sender, text)
A bot needs an account just like a 'normal' user. This is how to create one...
bot = MyBot() bot.create_account(regkey_file)
To load the bot account call
bot.load(username, password)
Now, since the bot account is loaded you can either add a friend (communication partner) ...
bot.add_friend(friend_name, friend_id)
... or run the bot's mainloop.
bot.run()