Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot core proposal #4

Open
saethlin opened this issue Dec 23, 2017 · 6 comments
Open

Bot core proposal #4

saethlin opened this issue Dec 23, 2017 · 6 comments

Comments

@saethlin
Copy link

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.

@LaVieEstDure
Copy link
Member

Sounds good to me. I can see the flow going something like

run bot->
on_message event handler called->
redirects to command handler in bot core->
bot core either connects to something that links languages in core, 
  or a module that links to other language on its own -> 
function called and returned, and answer posted by bot

The on_message event handler definitely works with discord.py. I think Mathbot does it, so someone can take some inspiration from there if needed.

@seekheart
Copy link
Member

I like it, can we finalize on what the directory should look like?

@saethlin
Copy link
Author

All the basic stuff at the top level, and put all the commands in a directory. Now add something already.

@seekheart
Copy link
Member

How do we wanna call the bot in the server? !bot <cmd> is what it was and I was thinking -ab <cmd> for new version?

@saethlin
Copy link
Author

Sounds good to me. I would prefer something more specific that just calling it bot

@Samoxive
Copy link

Prefix can be dynamic, we can pick a placeholder for now and make awesomebot fetch prefix from the config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants