Framework for the textbase package.
Project description
textbase-framework
An add-on for the textbase repository which enables you to deploy your bots to the internet for everyone to use!
To use it, you just have to import the library and use a decorator function called bot(name="your-amazing-bot")
and you can pass the name of your bot using the name
parameter.
Something like:
from textbase_framework import bot, Message
@bot(name="your-amazing-bot") #The decorator function
def on_message(message_history: List[Message], state: dict = None):
'''
Your logic for the bot, assuming it returns bot_response
The response HAS TO BE in the format given below so that our backend framework
has no issues communicating with the frontend.
'''
response = {
"data": {
"messages": [
{
"type": "string",
"value": bot_response
},
{
"type": "audio",
"value": ""
}
],
"state": state
},
"errors": [
{
"message": ""
}
]
}
return {
"status_code": 200,
"response": response
}
Project details
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
Close
Hashes for textbase_framework-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5da1145dc5a4b62373be3c770a5e93a54196f0ed3d977477d9155f06d15811ef |
|
MD5 | b044365921b734bd07016e144881968a |
|
BLAKE2b-256 | d7f5bccb6277a554178dcc153d298607df99c35116e9e3f632dcba45337f10f1 |