zostay / bot-backbone Goto Github PK
View Code? Open in Web Editor NEWA generic bot-writing framework
A generic bot-writing framework
Create an example bot using IRC + Console.
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:
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.
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.
Say possibly a bridge bot?
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.