Coder Social home page Coder Social logo

bot-backbone's People

Contributors

zoffixznet avatar zostay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

zakame

bot-backbone's Issues

Slack service handling makes formatting an obvious pain

Message formatting has always been a pain point with the way this works. If you have a service written to work across multiple bare metal chats, e.g., IRC, Jabber, and Slack, then your service has to magically know that your text might include weird crap from that kind of chat:

  • IRC may use escape sequences to add color.
  • Jabber might mixin arbitrary XML or HTML
  • Slack mixes in HTML and escapes <, >, and & as entities

I have tried to think how to cope with this and have not come up with anything besides a couple naïve solutions that do not work. Just adding a "plain_text" accessor to the message object, for example, will not work because of how predicates process arguments.

I could try to make it so that bare metal chats just put text into message text instead, but that might have consequences for services aimed at a particular bare metal chat that would rather get the original so they can have all the formatting goodies of their chat server.

Allow bots to be subclassed

Bot subclassing does not work. This would be simple to enable though. When setting up a bot during run(), we need to make sure we traverse the entire inheritance tree for services to setup and use in the current instance.

Better tools for adding/removing services on the fly

I am already working on some of the prerequisites for this right now. Basically, it should be possible to add services and remove services on the fly. This would allow, for example, a bot to join a channel and configure services for that channel and then remove those services when the bot leaves that channel.

Adding on the fly will soon be possible because of the initialization tracking I am adding, but to handle the reverse, we really need to be able to keep track of when one service depends on another. The current solution I'm working on will sort of do the job, but remains a little naïve as a general dependency tracking system.

It would be nice, for example, to say something like:

$bot->remove_service('general_chat', and_dependencies => 1);

This could then remove all the dependencies, including custom dispatcher, and services tied to this group. A better syntax for tying related services together is needed.

Allow commands to be remapped

Right now if a service defines a dispatcher like the following:

service_dispatcher as {
    command '!hello' => run_this_method 'say_hello';
};

We can only make effective use of this service once per chat. It would be handy if there were a way to do something like this:

service hello => (
    service => 'Hello',
);

service goodbye => (
    service => 'Hello',
    commands => {
        '!hello' => '!goodbye',
    },
);

# And maybe even
service aloha => (
    service => 'Hello',
    aliases => {
        '!aloha' => '!hello',
    },
);

Here the commands setting remaps a command to a different keyword. The aliases setting could create additional mappings to a command. Then, some modules might be able to exist multiple times within a chat with multiple configurations.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.