hangoutsbot / hangoutsbot

Google Hangouts bot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how do handlers work in v3.0? or is there a new way to work with messages?

jamenlang opened this issue · comments

commented

I've got some plugins that worked with older versions of hangoutsbot but I ran into login issues so I updated to v3.0 now some plugins won't load like lottery which uses a handler.

Output of /bot version

Bot Version: 3.0.0-beta
Python Version: 3.5.2+

  • aiohttp 2.3.10
  • appdirs 1.4.0
  • emoji 0.5.1
  • hangups 0.4.4

Expected behaviour

plugins with handlers to load and work with messages received e.g. _got_a_message.

Actual behaviour

plugins with handlers don't load.

Log output

2018-11-06 09:10:19 INFO event: len/tx: 35//bot pluginload plugins.addlocation
2018-11-06 09:10:19 ERROR plugins: EXCEPTION during plugin init: plugins.addlocation
Traceback (most recent call last):
File "/hangups-0.4.0/hangupsbot/plugins/init.py", line 359, in load
the_function(bot)
File "/hangups-0.4.0/hangupsbot/plugins/addlocation.py", line 9, in _initialise
plugins.register_handler(_got_a_message, type="message", priority=50)
File "/hangups-0.4.0/hangupsbot/plugins/init.py", line 170, in register_handler
bot_handlers.register_handler(function, type, priority)
File "/html/hangups-0.4.0/hangupsbot/handlers.py", line 93, in register_handler
plugins.tracking.register_handler(_handler, type, priority, module_path=_metadata["module.path"])
TypeError: register_handler() got an unexpected keyword argument 'module_path'

They should work fine -- a lot of the built-in plugins include handlers, and as far as I can tell you're the first to report this.

TypeError: register_handler() got an unexpected keyword argument 'module_path'

The argument in question appears to be there:

def register_handler(self, function, type, priority, module_path=None):

Bot Version: 3.0.0-beta
Python Version: 3.5.2+

Have you edited this output? Why is there a + after the Python version? There should also be a git commit hash -- if you haven't got that then you're out of date. That said, the code around the error you're hitting hasn't been changed in a while.