Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Feature request: message middleware #331

Closed
indexzero opened this issue Jul 20, 2016 · 3 comments
Closed

Feature request: message middleware #331

indexzero opened this issue Jul 20, 2016 · 3 comments

Comments

@indexzero
Copy link

Really enjoying using this thus far. Thanks for all your hard work! 💯 👍

I've been working on a simple command that turned out to be a bit more complex than I thought. At its core this command is a Dead Man's Switch (aka a time-delayed auto-responder) which means that after it's setup I need to add a receive middleware. In doing so I realized how much overhead each receive middleware is since it gets everything.

Wondering if there is any interest in expanding on the middleware concept and adding support for middlewares on types of messages: direct_message, direct_mention, mention and ambient.

The proposed API would be very similar:

controller.middleware.direct_message.use(fn);
controller.middleware.direct_mention.use(fn);
controller.middleware.mention.use(fn);
controller.middleware.ambient.use(fn);
@anonrig
Copy link
Contributor

anonrig commented Jul 20, 2016

Why add it on a middleware, when you have the old fashioned .on('EVENT_TYPE', fn) 🎱

@anonrig
Copy link
Contributor

anonrig commented Jul 20, 2016

But again you can do the same thing with .hears method with giving an appropriate RegEx. So, I'm not really quite sure why Botkit needs a middleware? Can you be more specific. Thanks!

@peterswimm
Copy link
Contributor

Closed due to inactivity, would love to see more discussion or review any pull requests!

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

No branches or pull requests

3 participants