zevlg / telega.el

GNU Emacs telegram client (unofficial)
https://zevlg.github.io/telega.el/
GNU General Public License v3.0
1.11k stars 86 forks source link

Error "Primitive temex ‘user-deleted’ is undefined." is reported in buffers that use telega-root-mode or telega-chat-mode #368

Closed rodrigomorales1 closed 2 years ago

rodrigomorales1 commented 2 years ago

Telega Setup

OS: Arch Linux Emacs: GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.6) Telega: telega v0.8.40 (TDLib v1.8.4) (telega-server v0.8.0) MELPA: 20220623.1707

Current Behavior

Behavior 1: When visiting the *Telega Root* buffer, this error is shown below some chats

Status: Ready
-------------------(main)-------------------
(Group                                     )📌  ---[telega bug]
PP-ERROR: <<information about the group>>  ==>
  (error "Primitive temex ‘user-deleted’ is undefined.
Use ‘define-telega-matcher’ to define new matchers.")
------

Behavior 2: In addition to that, when visiting a chat (i.e. a buffer with major mode telega-chat-mode, all messages report the same error. The following is what I see then visiting a group's chat (i.e. a buffer with mode telega-chat-mode

---[telega bug]
PP-ERROR: <<information about the message>> ==>
  (error "Primitive temex ‘user-deleted’ is undefined.
Use ‘define-telega-matcher’ to define new matchers.")
------
---[telega bug]
PP-ERROR: <<information about the message>> ==>
  (error "Primitive temex ‘user-deleted’ is undefined.
Use ‘define-telega-matcher’ to define new matchers.")
------
---[telega bug]
PP-ERROR: <<information about the message>> ==>
  (error "Primitive temex ‘user-deleted’ is undefined.
Use ‘define-telega-matcher’ to define new matchers.")
------
____________________________________________________________
>>>

Steps to Reproduce

  1. Use the same version of telega and TDLib that I'm using.
  2. Execute telega to visit the buffer telega-root-mode

At this point, you should see the same behavior I shown above in the first code block.

You can also try visiting a chat (i.e. a buffer with mode telega-chat-mode), and you should see the same behavior I shown above in the second code block.

Possible Solution

Someone in the Telegram group of telega.el suggested doing the following modification in telega-match.el: replace user-is-deleted with user-deleted as shown below.

(define-telega-matcher user-is-deleted (user)
  "Matches if user account is deleted."
  (eq (telega-user--type user) 'deleted))
(define-telega-matcher user-deleted (user)
  "Matches if user account is deleted."
  (eq (telega-user--type user) 'deleted))

I tried this solution and it fixed the two behaviors mentioned above. However, I'm not sure whether this would have other side effects. I'm reporting this issue so that someone more knowledgeable can see whether this is an appropriate solution and fix it accordingly.

UPDATE: Someone has created a pull request with that change, see #369

zevlg commented 2 years ago

Thanks for the report! I think this issue has been fixed in the master, please check

akspecs commented 2 years ago

Thanks for the report! I think this issue has been fixed in the master, please check

lgtm!