Skip to main content

bwb

bot with bot.

Usage

Install with pip install --upgrade bwb.

from bwb import bwb
bwb = bwb.bwb(TELEGRAM_ID)

Handshaking

Boot up:

client.send_message(CHAT_ID, '000000init ' + bwb.init())

On 000000init [data]:

event.respond('000000handshake ' + bwb.handshake(data))

On 000000handshake [data]:

event.respond(bwb.wrap('secret ' + bwb.secret(data), handshake=True))

On Handshake OTP authed 123456secret [data]:

bwb.set_secret(data)
event.respond(bwb.wrap('🤝'))

On OTP authed 123456🤝:

event.respond('🤝')

Interaction

Run every incoming message through bwb.parse() since it's inexpensive. This will decrypt and remove base58 encoding.

Once decoded, send it through bwb.check_auth() which will return True or False if the code is valid.

Example:

text = bwb.parse(text)
if text.startswith('!'):
    ...
elif text.startswith('000000'):
    text = text[6:]
elif bwb.check_auth(text, handshake=True):
    handshake_authed = True
    text = text[6:]
elif bwb.check_auth(text):
    authed = True
    text = text[6:]
else:
    return

Use bwb.wrap() to auth and encode outgoing commands.

Params:

wrap(text, handshake=False, target=None, b58=False, enc=False)

Examples:

out = bwb.wrap('ping')  # broadcast all bots
out = bwb.wrap('ping', target=TANNER)  # auth for Tannerbot
out = bwb.wrap('ping', target=JASON, enc=True)  # base58 encrypt
out = bwb.wrap('ping', target=MOLLY, b58=True)  # base58

Development

Setup

Clone the repo.

To test your changes:

pip install --upgrade ~/path/to/bwb

Deployment

Install setuptools:

python3 -m pip install --user --upgrade setuptools wheel
  • Increment version number in setup.py

Build and upload:

bash build-upload.sh

Metadata

Release files for bwb 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bwb 3.0.0
File Size Uploaded Provenance Actions
bwb-3.0.0.tar.gz 3.6 kB Without provenance Details for bwb-3.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bwb 3.0.0
File Interpreter ABI Platform Actions
bwb-3.0.0-py3-none-any.whl Python 3 none any Details for bwb-3.0.0-py3-none-any.whl

Total release size: 10.0 kB

Release files / bwb-3.0.0.tar.gz

Download URL bwb-3.0.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
09d5a6e573f2723b1629263335b4ebd0b30c2cfb6b022060178877c17cf50c46
BLAKE2b-256 checksum
How to use checksums
2545931504771e75e9423090f3c4a12d148a3b295034231d97fd73b55d011c02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.3

Release files / bwb-3.0.0-py3-none-any.whl

Download URL bwb-3.0.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
984f5c2edfc8a31ea31e3934d35b0b094db412a7709ab133bd1c4622ea7245c3
BLAKE2b-256 checksum
How to use checksums
7de555de44cc3f800fb8b95a0c10a0023681bdaf2b7c59020452c9d162bf5191
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.5.3

Security for bwb 3.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page