Skip to main content

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

textbase_framework-0.1.0.tar.gz (1.2 kB view hashes)

Uploaded Source

Built Distribution

textbase_framework-0.1.0-py3-none-any.whl (2.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page