tdryer / hangups

the first third-party instant messaging client for Google Hangouts
https://hangups.readthedocs.io/
MIT License
1.71k stars 190 forks source link

Sending embed/file in google chat causes exception #525

Closed othello777 closed 2 years ago

othello777 commented 2 years ago

Using https://github.com/joshdabosh/dhbridge but this seems like an issue with the hangouts api. sending google chat embeds cause this which hangs the program:

Message 'EmbedItem' ignoring repeated field type: Unknown enum value: 456
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "pearl.py", line 51, in run2
    self.loop.run_until_complete(self.client.connect())
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "~/.local/lib/python3.8/site-packages/hangups/client.py", line 140, in connect
    await self._listen_future
  File "~/.local/lib/python3.8/site-packages/hangups/channel.py", line 194, in listen
    await self._longpoll_request()
  File "~/.local/lib/python3.8/site-packages/hangups/channel.py", line 298, in _longpoll_request
    await self._on_push_data(chunk)
  File "~/.local/lib/python3.8/site-packages/hangups/channel.py", line 334, in _on_push_data
    await self.on_receive_array.fire(data_array)
  File "~/.local/lib/python3.8/site-packages/hangups/event.py", line 59, in fire
    await gen
  File "~/.local/lib/python3.8/site-packages/hangups/client.py", line 372, in _on_receive_array
    await self.on_state_update.fire(state_update)
  File "~/.local/lib/python3.8/site-packages/hangups/event.py", line 59, in fire
    await gen
  File "~/dhbridge/bridge/nacre/event.py", line 22, in fire
    await listener(*args, **kwargs)
  File "~/dhbridge/bridge/plugins/listen.py", line 21, in handle
    await self.respond(event, caller="h")
  File "~/dhbridge/bridge/plugins/listen.py", line 33, in respond
    toSend = "**{}:** {}".format(self.hangouts.getUser(event=event).full_name, incoming.group(1).strip())
AttributeError: 'NoneType' object has no attribute 'group'
tdryer commented 2 years ago

This is an issue with dhbridge rather than hangups. It's raising an exception because the event text doesn't match the regular expression that it expects.