Closed ixxie closed 5 years ago
Maybe one way to do this is if Message
included a bot
argument that allowed passing self
when the plugin is triggered. That way all plugins would have access to Bot
's attributes, making it easy to extend the class with funky functionality.
Not sure if this is really the ideal implementation, but I did just test out the concept and it works so I made a PR: https://github.com/archangelic/pinhook/pull/60
Closed by #60
Pinhook is designed to be extended by using command and listener plugins. Sometimes, however, it is natural to extend the Bot class in other ways. Currently I am struggling with appending a natural language processing model to the Bot class.
My current attempt involves creating a new class that instantiates a Pinhook
Bot
and aModel
instance during init; it looks something like this:But now I want to create a listener which has access to the
model
attribute, and it is not clear how. I considered trying instead to extend theBot
class directly, but plugins do not have access toself
anyway so this doesn't help me.Any ideas on how I could work around this sort of issue?