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(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
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.1.1.tar.gz
(3.8 kB
view details)
Built Distribution
bwb-2.1.1-py3-none-any.whl
(4.7 kB
view details)
File details
Details for the file bwb-2.1.1.tar.gz
.
File metadata
- Download URL: bwb-2.1.1.tar.gz
- Upload date:
- Size: 3.8 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 | 25f7506ef6776309a2da92902fde82f0e86214521627c028f937a2da00d56380 |
|
MD5 | 2f7691d5aee936e735cc56097e51a26a |
|
BLAKE2b-256 | 8d1b72a2eac066efee8a43aad69aace74abcabb7e243ef4226d68921361aa96c |
File details
Details for the file bwb-2.1.1-py3-none-any.whl
.
File metadata
- Download URL: bwb-2.1.1-py3-none-any.whl
- Upload date:
- Size: 4.7 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 | d76a423fb9b965eebf0dda9117c30ea8f776022885843d3821fdcb59b74bcbe9 |
|
MD5 | 6e6e385b188dd7c7df787674d1d55945 |
|
BLAKE2b-256 | 73b07eb8b5502971f2db8fac48c62f97fc2e73b34a20ceef51bcd2cabc09163d |