All Projects → spankybot → spanky.py

spankybot / spanky.py

Licence: GPL-3.0 license
Chat-bot overlay framework that can run on top of any python-based bot and call plugins on various events

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to spanky.py

nextcord
A Python wrapper for the Discord API forked from discord.py
Stars: ✭ 956 (+6728.57%)
Mutual labels:  bots, bot-framework, discord-py
Rasa core
Rasa Core is now part of the Rasa repo: An open source machine learning framework to automate text-and voice-based conversations
Stars: ✭ 2,302 (+16342.86%)
Mutual labels:  bots, bot-framework
Node Vk Bot Api
🤖 VK bot framework for Node.js, based on Bots Long Poll API and Callback API.
Stars: ✭ 195 (+1292.86%)
Mutual labels:  bots, bot-framework
awesome-botframework
🤖 A curated list of awesome Microsoft Bot Framework related things
Stars: ✭ 30 (+114.29%)
Mutual labels:  bots, bot-framework
Botonic
Build chatbots and conversational experiences using React
Stars: ✭ 144 (+928.57%)
Mutual labels:  bots, bot-framework
Eddi
Scalable Open Source Chatbot Platform. Build multiple Chatbots with NLP, Behavior Rules, API Connector, Templating. Developed in Java, provided with Docker, orchestrated with Kubernetes or Openshift.
Stars: ✭ 171 (+1121.43%)
Mutual labels:  bots, bot-framework
Blankly
🚀 💸 Easily build, backtest and deploy your algo in just a few lines of code. Trade stocks, cryptos, and forex across exchanges w/ one package.
Stars: ✭ 1,456 (+10300%)
Mutual labels:  bots, bot-framework
Botbuilder Java
The Microsoft Bot Framework provides what you need to build and connect intelligent bots that interact naturally wherever your users are talking, from text/sms to Skype, Slack, Office 365 mail and other popular services.
Stars: ✭ 127 (+807.14%)
Mutual labels:  bots, bot-framework
airy
💬 Open source conversational platform to power conversations with an open source Live Chat, Messengers like Facebook Messenger, WhatsApp and more - 💎 UI from Inbox to dashboards - 🤖 Integrations to Conversational AI / NLP tools and standard enterprise software - ⚡ APIs, WebSocket, Webhook - 🔧 Create any conversational experience
Stars: ✭ 299 (+2035.71%)
Mutual labels:  bots, bot-framework
msbotbuilder-go
Microsoft Bot Framework SDK for Go
Stars: ✭ 113 (+707.14%)
Mutual labels:  bots, bot-framework
Rasa
💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
Stars: ✭ 13,219 (+94321.43%)
Mutual labels:  bots, bot-framework
bots
Programming bots to play video games
Stars: ✭ 106 (+657.14%)
Mutual labels:  bots, bot-framework
Framework
Chatbot framework
Stars: ✭ 130 (+828.57%)
Mutual labels:  bots, bot-framework
Botbuilder Microsoftteams
Microsoft Bot Builder extension library for developing bots for Microsoft Teams
Stars: ✭ 192 (+1271.43%)
Mutual labels:  bots, bot-framework
Slack Block Builder
Lightweight, no-dependency JavaScript library for creating Slack Block Kit UIs, with a builder syntax, inspired by SwiftUI.
Stars: ✭ 129 (+821.43%)
Mutual labels:  bots, bot-framework
Awesome Bots
The most awesome list about bots ⭐️🤖
Stars: ✭ 2,864 (+20357.14%)
Mutual labels:  bots, bot-framework
Botpress
🤖 Dev tools to reliably understand text and automate conversations. Built-in NLU. Connect & deploy on any messaging channel (Slack, MS Teams, website, Telegram, etc).
Stars: ✭ 9,486 (+67657.14%)
Mutual labels:  bots, bot-framework
Fondbot
Chatbot framework
Stars: ✭ 102 (+628.57%)
Mutual labels:  bots, bot-framework
rasa-docker-arm
Rasa Docker image for ARMv7. Runs on a Raspberry Pi.
Stars: ✭ 19 (+35.71%)
Mutual labels:  bots, bot-framework
MyBot
🧠 Create chatbots easily with Bot Framework! 🤖
Stars: ✭ 30 (+114.29%)
Mutual labels:  bots, bot-framework

spanky.py

Chat-bot overlay framework that can run on top of any python-based bot and call plugins on multiple types of events.

High level schematic:

=====================================
| Backend that communicates with    |
| Discord, Slack, IRC servers, etc. |
=====================================
                  ||
                  ||
        events are decapsulated and 
          sent to the framework
                  ||                                                              -------------------
                  ||                                                         | -> | moderator tools |
                  \/                                                         |    -------------------
            =============                                                    |    -----------
            | Framework | ===> bot framework triggers events            ===> | -> | logging |
            =============      that are specified in the plugins folders     |    -----------
                                                                             |    ---------------------
                                                                             | -> | periodic events   |
                                                                                  | for announcements |
                                                                                  ---------------------

Running the bot

1. Using Docker (recommended)

The easiest way of stating up the bot is to use the tools provided in the Dockerfile/ folder:

git clone https://github.com/gc-plp/spanky.py.git && \
  cd spanky.py

# Build container
./Dockerfile/build.sh

# Create bot_config.json
cp bot_config.json.sample bot_config.json

# Edit the config file
# vi bot_config.json

# Start the bot
./Dockerfile/start.sh <folder where home files are kept>

2. Native (not recommended)

There are a lot of system dependencies that need to be installed on the system where you are planning to run the bot.

Some of the prerequisites can be found in Dockerfile/Dockerfile. Once you install them, run the bot with Python 3.5.

Design notes

Plain commands

Plugins can be added in the plugins/ folder and are dinamically loaded at startup.

A plugin can also be modified while the bot is running. A write event (i.e. saving the file) will trigger the bot to reload the plugin.

Example:

from spanky.hook2 import Hook
hook = Hook("example")

@hook.command()
def example1():
    return "example1 called"
Permissions

The bot has a built-in permission system that allows plugin authors to restrict who can use a command.

Currently there are two explicit permission levels set in spanky/plugin/permissions.py:

@enum.unique
class Permission(enum.Enum):
    admin = "admin"  # Can be used by anyone with admin rights in a server
    bot_owner = "bot_owner"  # Bot big boss

Example:

from spanky.hook2 import Hook
from spanky.plugin.permissions import Permission

hook = Hook("example")

@hook.command(permissions=Permission.admin)
def example2():
    return "example2 called"

This will make the example2 command only be accessible by users having one of the rules set through admin_config admin_roles add @role command.

Similarly, when using the bot_owner permission, commands will only be accessed by users specified in the bot_owner field set in the bot_config.json file.

Slash commands

Slash commands are registered through the hook decorator, but are only added when the slash_servers parameter is set in the decorator. Example:

from spanky.hook2 import Hook
hook = Hook("example")

@hook.command(slash_servers=["123456"])
def example1():
    return "example1 called"

By default, the bot will add a string parameter to plugins that request the text parameter. Example:

from spanky.hook2 import Hook
hook = Hook("example")

@hook.command(slash_servers=["123456"])
def example2(text):
    return "example2 called with " + str(text)

Explicit arguments can also be added to a slash command and can be accessed through event.args

from spanky.hook2 import Hook
hook = Hook("example")

@hook.command(slash_servers=["123456"])
def example3(event):
    """
    :sarg example_arg [1, 2]: int = 1 | some arg
    """
    return "example3 called with " + str(event.args)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].