Giter Site home page Giter Site logo

libretro's Introduction

libretro

Core library of the retro end2end encrypted terminal messenger.

Install

Installing libretro:

$ pip install .

Installing libretro in development mode:

$ pip install -e .

Uninstall

$ pip uninstall libretro

Modules

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

Bot Example

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()

libretro's People

Contributors

lukwies avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.