-
Notifications
You must be signed in to change notification settings - Fork 3
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
Plugin conflicts #76
Comments
It seems this effects many plugins not just beertime and 8ball. As discussed on IRC :) I have a solution where an additional attribute can be included in the Info object. The attribute will reflect if a plugin is (going to be) called. On an empty Info object (which you use to register events) this will default to False, so by default events are not called if a plugin is called. This seems to be the most megbot-like solution, we're already using the The obvious problem is how do you handle it when you want both to be called when a plugin is called and when it isn't. It seems to me there are a few solutions to this:
def init(connection):
eventID = 'seenEvent'
info = connection.libraries["IRCObjects"].Info()
# this will peform an event on privmsg.
info.action = "PRIVMSG"
info.triggered = lambda t: True # Always match on this value.
event = connection.core["Corehandler"].IRCEvent(info, on_PRIVMSG, eventID)
connection.handler.register_event(event) With this solution in place: beertime wouldn't conflict with anything as it'd leave this as default, nor would reply. The scene plugin can be made to always log as it does now with a small additional change. We also keep the idea of |
That means attaching plugin state onto the incoming Info object (otherwise how is the callable on My personal preference would be if event handlers returned something, perhaps a truthy value:
Then whatever is iterating over can do something like:
|
We need some way of making a plugin "greedy" or maybe just ignore
!command
messages.The text was updated successfully, but these errors were encountered: