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

BugFix: Allow users to mention other users in Group Channels again #724

Merged
merged 1 commit into from
Dec 31, 2021

Conversation

dfuchss
Copy link
Contributor

@dfuchss dfuchss commented Dec 31, 2021

Hi,
I currently can't send messages in group channels when I mention members of the group with '@name'.
Matrix shows the message but nothing can be seen in Telegram.

After checking the logs, I've seen the following error:

[2021-12-31 02:08:35,001] [[email protected]] /usr/lib/python3.9/site-packages/mautrix/util/formatter/parser.py:173: RuntimeWarning: coroutine 'UserMethods.get_input_entity' was never awaited
  custom = await self.custom_node_to_fstring(node, ctx)

[2021-12-31 02:08:35,004] [[email protected]..........] Failed to bridge $[.........]: a TLObject was expected but found something else
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/telethon/tl/tlobject.py", line 194, in __bytes__
    return self._bytes()
  File "/usr/lib/python3.9/site-packages/telethon/tl/functions/messages.py", line 4697, in _bytes
    b'' if self.entities is None or self.entities is False else b''.join((b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.entities)),b''.join(x._bytes() for x in self.entities))),
  File "/usr/lib/python3.9/site-packages/telethon/tl/functions/messages.py", line 4697, in <genexpr>
    b'' if self.entities is None or self.entities is False else b''.join((b'\x15\xc4\xb5\x1c',struct.pack('<i', len(self.entities)),b''.join(x._bytes() for x in self.entities))),
  File "/usr/lib/python3.9/site-packages/telethon/tl/types/__init__.py", line 9720, in _bytes
    self.user_id._bytes(),
AttributeError: 'coroutine' object has no attribute '_bytes'
More log output:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/mautrix_telegram/portal.py", line 1690, in handle_matrix_message
await self._handle_matrix_message(sender, content, event_id)
File "/usr/lib/python3.9/site-packages/mautrix_telegram/portal.py", line 1744, in _handle_matrix_message
await self._handle_matrix_text(
File "/usr/lib/python3.9/site-packages/mautrix_telegram/portal.py", line 1464, in _handle_matrix_text
response = await client.send_message(
File "/usr/lib/python3.9/site-packages/telethon/client/messages.py", line 872, in send_message
result = await self(request)
File "/usr/lib/python3.9/site-packages/telethon/client/users.py", line 30, in call
return await self._call(self._sender, request, ordered=ordered)
File "/usr/lib/python3.9/site-packages/telethon/client/users.py", line 63, in _call
future = sender.send(request, ordered=ordered)
File "/usr/lib/python3.9/site-packages/telethon/network/mtprotosender.py", line 176, in send
state = RequestState(request)
File "/usr/lib/python3.9/site-packages/telethon/network/requeststate.py", line 17, in init
self.data = bytes(request)
File "/usr/lib/python3.9/site-packages/telethon/tl/tlobject.py", line 200, in bytes
raise TypeError('a TLObject was expected but found something else')
TypeError: a TLObject was expected but found something else
[2021-12-31 02:08:35,024] [[email protected]] /usr/lib/python3.9/site-packages/mautrix_telegram/portal.py:1704: RuntimeWarning: coroutine 'UserMethods.get_input_entity' was never awaited
await self._send_bridge_error(

I've tested the behavior on version v0.11.0 and latest.

I think I've found the missing await, therefore I've created this PR (For me the proposed change resolves the issue).
Nevertheless, someone else should also test the change :)

@tulir tulir merged commit 2b6db85 into mautrix:master Dec 31, 2021
@dfuchss dfuchss deleted the bugfix/mentions-in-group-messages branch December 31, 2021 13:19
pidongqianqian added a commit to kelaresg/mautrix-telegram that referenced this pull request Jan 18, 2022
* master_tulir: (48 commits)
  Fix bug in !tg create. Fixes mautrix#736
  bridge state: use TRANSIENT_DISCONNECT if connection drops and is expected to come back soon
  Very basic support for live location
  Add support for t.me/+code invite links
  Bump version to 0.11.1
  Update some small things
  Make telegram blue text more readable on dark themes. Fixes mautrix#729
  Use min() instead of sorting list
  Update dependencies and fix some things in config updater
  Deduplicate lottieconverter calls in tgs_converter
  Delete nulls in message table. Fixes mautrix#731
  Update changelog
  Don't use parameters for pg_constraint query
  voice messages: bridge from Telegram to native Matrix
  Send message checkpoints for Matrix edits too
  Find constraint names dynamically to work around schemas broken by pgloader
  Add missing await to get_input_entity in HTML parser (mautrix#724)
  Don't redact reactions in chats with relaybot
  Don't alter columns to not null on sqlite
  Fix some things in dedup changes
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants