Make check_auth return True / False
This commit is contained in:
@@ -36,16 +36,23 @@ 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`.
|
||||
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
|
||||
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:
|
||||
authed, text = bwb.parse(text)
|
||||
if not text: return
|
||||
return
|
||||
```
|
||||
|
||||
Use `bwb.wrap()` to auth and encode outgoing commands.
|
||||
|
||||
Reference in New Issue
Block a user