Skip to content

Bot core proposal #4

Description

@saethlin

We want to serve a large programming community with varying competency. For this reason I would like to have a core bot built in Python using discord.py, and very quickly dispatch in a generic way into modules that can be written in any language. The onus is on the contributor to integrate whatever language they're using.

I think the core bot should look something like this:

from modules import *

commands = {
    'weather': weather.weather,
    'eval': runner.evaluate,
}

async def on_message_or_whatever():
    if command in commands:
        post_message(commands[payload]())

Where we pull in everything with a modules directory, which will contain the entry point for every command, regardless of what language it is written in. We define a dictionary or config file that maps bot string commands such as !bot weather onto a Python function that takes the contents of the message, and returns the contents of a reply message. The primary job of the core bot is to dispatch to handlers, and to avoid making this overcomplicated so that people unfamiliar with Python have little difficulty integrating their work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions