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
Boot up:
client.send_message(BOT_WITH_BOT, '000000init ' + bwb.init())
On 000000init [data]
:
client.send_message(BOT_WITH_BOT, '000000handshake ' + bwb.handshake(data))
On 000000handshake [data]
:
client.send_message(BOT_WITH_BOT, bwb.wrap('secret ' + bwb.secret(data)))
bwb.set_otp(bwb.init_secret)
On OTP authed 123456secret [data]
:
bwb.set_secret(data)
client.send_message(BOT_WITH_BOT, bwb.wrap('🤝'))
On OTP authed 123456🤝
:
client.send_message(BOT_WITH_BOT, '🤝')
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
bwb-2.0.3.tar.gz
(3.7 kB
view details)
Built Distribution
bwb-2.0.3-py3-none-any.whl
(4.6 kB
view details)
File details
Details for the file bwb-2.0.3.tar.gz
.
File metadata
- Download URL: bwb-2.0.3.tar.gz
- Upload date:
- Size: 3.7 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 | 961e9262949ca1e54061b85488f65f77bd5e698bd31f07ad36678d94c5faf5c9 |
|
MD5 | cd52a4fa7ae58b290cd4a97a154a05a5 |
|
BLAKE2b-256 | 64508ca00939d3403b1665494741fd6b5df25ecdc61ab8f804c4fbd1d97e1f75 |
File details
Details for the file bwb-2.0.3-py3-none-any.whl
.
File metadata
- Download URL: bwb-2.0.3-py3-none-any.whl
- Upload date:
- Size: 4.6 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 | 8beff973a3a1b46cadaf13e4b417f17ab876ee1e60209ec99fd016aabff20283 |
|
MD5 | 856331e42cda3ffe273a3bb686331a88 |
|
BLAKE2b-256 | 9d9e0e1ddb0bb57fe9a08df43fbaa7e3eeadc0fbdb45612ea2dbc6b712fa87b5 |