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 [secret]
to BWB chat:
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bwb-1.0.9.tar.gz
.
File metadata
- Download URL: bwb-1.0.9.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1052a7d6a800fd570c952ab9f3379105c790ee77738c6813ae2fea331e040ca |
|
MD5 | 3bcb8878a7172d1a2d743571ef6d864a |
|
BLAKE2b-256 | 1b7728df84144d53b2bdc05312154e5f3d94c54ba3e457fbaa366cfa70d75478 |
File details
Details for the file bwb-1.0.9-py3-none-any.whl
.
File metadata
- Download URL: bwb-1.0.9-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c1da1056231d7b66594a350f6b1b3728b4e28d353a31e7b445bfe0f6e5b76db |
|
MD5 | 2d6288630292fc304fa8c3662588562d |
|
BLAKE2b-256 | 8464856f0608387457ef876dce4c4cdc317022cde6991e57f2c221e6c1c18abf |