From d379d2c1389fca1464d19cd0bb6fc2548339cb74 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Tue, 10 Sep 2019 02:32:11 +0000 Subject: [PATCH] Add README and build script --- README.md | 93 +++++++++++++++++++++++++++++++++++++++++++++++++ build-upload.sh | 4 +++ setup.py | 10 ++++-- 3 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 README.md create mode 100644 build-upload.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..749ad13 --- /dev/null +++ b/README.md @@ -0,0 +1,93 @@ +# 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. If the command is invalid, `text` will be `None`. + +Example: + +``` +if text.startswith('!'): + ... +else: + authed, text = bwb.parse(text) + if note text: 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 +``` diff --git a/build-upload.sh b/build-upload.sh new file mode 100644 index 0000000..3068b4f --- /dev/null +++ b/build-upload.sh @@ -0,0 +1,4 @@ +#!/bin/bash +rm -r dist +python3 setup.py sdist bdist_wheel +python3 -m twine upload dist/* diff --git a/setup.py b/setup.py index 67b8177..2e4164a 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,16 @@ +import io import setuptools +with io.open('README.md', encoding='utf-8') as fh: + long_description = fh.read() + setuptools.setup(name='bwb', - version="1.0.2", + version="1.0.5", description='bwb', - long_description='bwb', + long_description=long_description, + long_description_content_type='text/markdown', author='bwb', + author_email='bwbpy@qotmail.com', license='QPL.txt', url='https://qotmail.com', packages=setuptools.find_packages(),