Skip to main content

bwb

Project description

bwb

bot with bot.

Usage

Install with pip install --upgrade bwb.

# Import one of:
from bwb.tanner import bwb
from bwb.jason import bwb
from bwb.tdev import bwb
from bwb.molly import bwb

Handshaking

On boot up, send 000000handshake to BWB chat.

When you see a 000000handshake:

secret = bwb.init()
await client.send_message(BWB, '000000handshake ' + secret)

When you see a 000000handshake [secret data]:

bwb.init(secret_data)
await client.send_message(BWB, bwb.wrap('🤝'))

When you see and authed '🤝', reply with unauthed '🤝'.

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):
    authed = True
    text = text[6:]
else:
    return

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

Params:

wrap(text, 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

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

bwb-1.0.8.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

bwb-1.0.8-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file bwb-1.0.8.tar.gz.

File metadata

  • Download URL: bwb-1.0.8.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for bwb-1.0.8.tar.gz
Algorithm Hash digest
SHA256 5c585eb6e2184db34ee63c436347c64d812ebf54f129922d2a11e7ca3aeca7e0
MD5 1d5928db738c63ae9ccf23504706ea2a
BLAKE2b-256 7d93d1f366245b620e14d06598a6698347d676ae925d8385667a65e17d9ffa3e

See more details on using hashes here.

File details

Details for the file bwb-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: bwb-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for bwb-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f6b912d27a0ba1ee46b29fb721b8fc198a53b25465650b46032e146c195b954f
MD5 33a7c93872b77eadf9b48b3e70b7df57
BLAKE2b-256 caabbd6587b2fb7dbd7a0b63c581015a29f3a526d58902f6ce3f745c139d5220

See more details on using hashes here.

Supported by

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