Skip to content
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

Bridging events of a specific user to matrix does not work. #526

Closed
f4814 opened this issue Oct 1, 2020 · 2 comments
Closed

Bridging events of a specific user to matrix does not work. #526

f4814 opened this issue Oct 1, 2020 · 2 comments
Labels
external This issue is valid, but needs to be fixed somewhere else (e.g. a library)
Milestone

Comments

@f4814
Copy link

f4814 commented Oct 1, 2020

There is one user, whose messages are not bridged from telegram to matrix. He is not a matrix user and has never interacted with the bridge. Everytime he sends a message on telegram, one of those exceptions shows up in the log:

[[email protected].@jan:intothecyber.space] Failed to handle Telegram update UpdateNewChannelMessage(message=Message(id=804, to_id=PeerChannel(channel_id=1397274890), date=datetime.datetime(2020, 10, 1, 19, 18, 59, tzinfo=datetime.timezone.utc), message='[I CENSORED THIS]', out=False, mentioned=False, media_unread=False, silent=False, post=False, from_scheduled=False, legacy=False, edit_hide=False, from_id=442939811, fwd_from=None, via_bot_id=None, reply_to_msg_id=None, media=None, reply_markup=None, entities=[], views=None, edit_date=None, post_author=None, grouped_id=None, restriction_reason=[]), pts=884, pts_count=1)
 Traceback (most recent call last):
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix_telegram/abstract_user.py", line 195, in _update_catch
     await self._update(update)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix_telegram/abstract_user.py", line 242, in _update
     await self.update_message(update)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix_telegram/abstract_user.py", line 440, in update_message
     return await portal.handle_telegram_message(self, sender, update)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix_telegram/portal/telegram.py", line 493, in handle_telegram_message
     event_id = await self.handle_telegram_text(source, intent, is_bot, evt)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix_telegram/portal/telegram.py", line 249, in handle_telegram_text
     return await self._send_message(intent, content, timestamp=evt.date)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix_telegram/portal/base.py", line 471, in _send_message
     return await intent.send_message_event(self.mxid, event_type, content, **kwargs)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 87, in wrapper
     return await __method(*args, **kwargs)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 284, in send_message_event
     await self._ensure_has_power_level_for(room_id, event_type)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 408, in _ensure_has_power_level_for
     if not self.state_store.has_power_level(room_id, self.mxid, event_type):
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix/appservice/state_store/abstract.py", line 113, in has_power_level
     return room_levels.get_user_level(user_id) >= room_levels.get_event_level(event_type)
 TypeError: '>=' not supported between instances of 'str' and 'int'

Or:

[[email protected].@jan:intothecyber.space] Failed to handle Telegram update UpdateNewChannelMessage(message=Message(id=805, to_id=PeerChannel(channel_id=1397274890), date=datetime.datetime(2020, 10, 1, 19, 19, 16, tzinfo=datetime.timezone.utc), message='[I CENSORED THIS]', out=False, mentioned=False, media_unread=False, silent=False, post=False, from_scheduled=False, legacy=False, edit_hide=False, from_id=442939811, fwd_from=None, via_bot_id=None, reply_to_msg_id=None, media=None, reply_markup=None, entities=[], views=None, edit_date=None, post_author=None, grouped_id=None, restriction_reason=[]), pts=885, pts_count=1)
 Traceback (most recent call last):
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix_telegram/abstract_user.py", line 195, in _update_catch
     await self._update(update)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix_telegram/abstract_user.py", line 242, in _update
     await self.update_message(update)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix_telegram/abstract_user.py", line 440, in update_message
     return await portal.handle_telegram_message(self, sender, update)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix_telegram/portal/telegram.py", line 493, in handle_telegram_message
     event_id = await self.handle_telegram_text(source, intent, is_bot, evt)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix_telegram/portal/telegram.py", line 249, in handle_telegram_text
     return await self._send_message(intent, content, timestamp=evt.date)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix_telegram/portal/base.py", line 471, in _send_message
     return await intent.send_message_event(self.mxid, event_type, content, **kwargs)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 87, in wrapper
     return await __method(*args, **kwargs)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 284, in send_message_event
     await self._ensure_has_power_level_for(room_id, event_type)
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix/appservice/api/intent.py", line 408, in _ensure_has_power_level_for
     if not self.state_store.has_power_level(room_id, self.mxid, event_type):
   File "/var/lib/mautrix-telegram/lib/python3.7/site-packages/mautrix/appservice/state_store/abstract.py", line 113, in has_power_level
     return room_levels.get_user_level(user_id) >= room_levels.get_event_level(event_type)
 TypeError: '>=' not supported between instances of 'str' and 'int'

I am running the latest release.

@tulir tulir added the external This issue is valid, but needs to be fixed somewhere else (e.g. a library) label Oct 9, 2020
@tulir
Copy link
Member

tulir commented Oct 9, 2020

The power levels in that room are broken, but I'll add some type casting because synapse allows invalid types in power levels

@f4814
Copy link
Author

f4814 commented Oct 9, 2020

Yeah. Thanks for the hint. One user had powerlevel of "0" (type string).

Thanks for all your work on the bridge!

@tulir tulir added this to the 0.9.0 milestone Oct 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external This issue is valid, but needs to be fixed somewhere else (e.g. a library)
Development

No branches or pull requests

2 participants