Skip to content
A plugin-based Telegram bot written in Python
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
plugins
.gitignore
bot.py
readme.md
utils.py

readme.md

Chicor

Flexible, plugin-based Telegram bot written in Python.

How to setup

Clone the repo, install the modules and doop doop.

How to write plugins for the bot

Basic structure

class plugin_name():
    '''
    The plugin name must be the same as the filename of the module
    Plugins are also able to access the following variables:
    - self.admin_list   -> the admin_list defined in config.json
    '''

    def __init__(self):
        self.config = {}
        self.commands = {
            'command1': handler1,
            'command2': handler2
        }
        self.default_config = {} # If this exists, it's copied to the plugin config in config.yaml (Not required)
        self.description = "Plugin description"
        self.help_text = "Plugin help text"

    def on_load(self):
        print("I get called when the bot loads this plugin!")


    def handler1(self, bot, update, args):
        update.message.reply_text("Hello?")


    def handler2(self, bot, update, args):
        update.message.reply_text("Hello!")


    def on_text(self, bot, update):
        update.message.reply_text("I get called when a message gets sent")

    # There are also other handlers for other types of messages.

After writing the plugin, either enable it with /enable <plugin_name> or by manually adding the plugin name in the config.yaml

You can’t perform that action at this time.