Skip to main content

High-level Python interface for Simplex API

Project description

python-simplex-bot

A high-level python library for building bots for simplex chat

Currently supported simplex-chat version: 6.3.6.0

Installation

pip install python-simplex-bot

Alternatively, clone this repository into a desired location

Usage

Creating your first bot

  1. Install simplex-chat terminal client
  2. Start client using simplex-chat -p 5225 -d my-bot-name
  3. If running for the first time, answer the initial questions e.g. username (this will be your bot's name as users see it)
  4. Save this code as bot.py:
    from simplex_bot import Bot
    from sumplex_bot.types import UpdateNewContact, UpdateTextMessage, BaseContext
    
    # 5225 is the port number you passed to the -p argument in step 2:
    bot = Bot(url="ws://localhost:5225")
    
    @bot.hello_handler
    async def hello_handler(update: UpdateNewContact, context: BaseContext):
        await context.reply(f"Hello, {update.peer.user.username}!")
    
    @bot.text_handler
    async def echo_handler(update: UpdateTextMessage, context: BaseContext):
        await context.reply(f"You said: {update.text})
    
    bot.start()
    
  5. Run your bot with python3 bot.py
  6. Bot will print its address into the terminal output. Insert this address into your favourite simplex chat client application to connect to your bot.

Example bots

Love to learn by example? See ./examples/ directory for some self-explanatory examples

Documentation

See ./docs/README.md for detailed documentation and reference.

PyDoc is also available; access it from your IDE, pydoc server or python console e.g.:

>>> import simplex_bot
>>> help(simplex_bot)

Roadmap

v0.1 milestone:

  • Automatically message a new contact
  • Send and receive text messages
  • Send and receive multimedia messages
  • File transfers
  • Edit and delete messages
  • Message statuses (mark as read/fire when user has read)
  • Reply to messages

v0.2 milestone:

  • Group chat operations - [ ] Create one-time group invite link - [ ] User joined/user left events - [ ] Mute/unmute - [ ] Kick user from group - [ ] Manage group chat preferences

v0.3 milestone:

  • Dialog state management using the context object

v0.4 milestone:

  • Profile management - [ ] Set username and profile photo - [ ] Generate one-time links
  • Multi user support (run multiple bots using single websocket connection)
  • List connected users and groups

Contacts

For bug reports and feature requests, use Issues.

Donations

Toss a coin to your developer, o Valley of Plenty

  • Bitcoin: ``
  • Bitcoin Cash: ``
  • Litecoin: ``
  • Ethereum/ERC-20: ``
  • Tron/TRC-20: ``
  • Solana: ``
  • Monero: ``

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_simplex_bot-0.0.1.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_simplex_bot-0.0.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file python_simplex_bot-0.0.1.tar.gz.

File metadata

  • Download URL: python_simplex_bot-0.0.1.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for python_simplex_bot-0.0.1.tar.gz
Algorithm Hash digest
SHA256 21b80ecfddbc4a57eb9d4f90d0fb4b02580f2a9ef218dc1f67aabe2146db4eb9
MD5 e49fe567a427090becc86353fe905d82
BLAKE2b-256 4a1b2b9c80de8c38bf9caff3397ecd95bf70e4854868080fcc42a722c2a90339

See more details on using hashes here.

File details

Details for the file python_simplex_bot-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for python_simplex_bot-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f5f9a13631c969468434a5df528dd9e5c7c7871e3e4c0e0fdb2a33578404d39f
MD5 fe137ba29d138acf9be16ced62706390
BLAKE2b-256 af885c105450d6bfb22cf752676937d9d5bb4b7da6c5a7c0f0275a1a3588b775

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page