Closed johnd0e closed 1 month ago
The log doesn't provide much useful info as WARN itself is not the issue. For some messages, tg-spam may fail to send as markdown and should switch to plain text as a fallback. You may want to run it with --dbg, and this will provide more info.
2024/10/14 11:04:30.375 [DEBUG] {events/listener.go:348 events.(*TelegramListener).isAdminChat} message in admin chat -4595886163, from
2024/10/14 11:04:30.375 [DEBUG] {events/listener.go:350 events.(*TelegramListener).isAdminChat} is not superuser in admin chat, ignored
For whatever reason it does not type the name of my user. And obviously I am the owner of the admin chat.
your user should be defined in the list of "super-users" in addition to TG related permissions
--super= super-users [$SUPER_USER]
@umputun
And my user is defined, by its numerical id (as it has no nick)
In either way this is not the reason that user's name/id in the log is empty.
P.S.
Also I see this statement:
super
defines the list of privileged users, can be repeated multiple times or provide as a comma-separated list in the environment. Those users are immune to spam detection and can also unban other users. All the admins of the group are privileged by default.
https://github.com/umputun/tg-spam/blob/master/README.md#application-options-in-details
Unfortunately, the log lines you pasted seem to be truncated, so I can't see much information here. Regarding your correction - yes, you are correct; I completely forgot the part that adds all admins to supers automatically.
Without seeing more details from the logs, it is hard to say what's going on. I can speculate this is related to the privacy settings of TG, and you may need to disable privacy mode for the bot.
I can speculate this is related to the privacy settings of TG, and you may need to disable privacy mode for the bot.
I do not agree that this is the case here. The state of privacy mode does not matter when the bot has admin rights. Furthermore, it affects whether the bot receives messages or not. In this instance, it is clear that the bot is receiving messages, as evidenced by the reactions in the logs.
Nevertheless, I followed the suggestion, but unfortunately, it was unsuccessful.
Unfortunately, the log lines you pasted seem to be truncated.
I am fairly certain that they are not truncated. I consistently receive this type of message in this form. If there are any suggestions on how to obtain complete, untruncated logs, I would appreciate it.
I completely forgot the part that adds all admins to supers automatically.
How can I verify whether that part is functioning correctly? When I run the bot without the --admin option, I see the following log entry:
2024/10/15 14:47:56.477 [INFO] {events/listener.go:435 events.(*TelegramListener).updateSupers} added admins, full list of supers: {tgspamfarmanagerbot}
It seems that I've found the culprit:
And my user is defined, by its numerical id (as it has no nick)
After I've take tg username the problem is gone:
2024/10/15 14:53:49.702 [INFO] {events/listener.go:435 events.(*TelegramListener).updateSupers} added admins, full list of supers: {tgspamfarmanagerbot, real_johnd0e}
2024/10/15 14:54:38.450 [DEBUG] {events/admin.go:64 events.(*admin).MsgHandler} message from admin chat: msg id: 14, update id: 223500437, from: real_johnd0e, sender: ""
I don't think this is a bug; it is just what the system is designed to do. Maybe it's worth clarifying in the README, but I don't recall any place where it promised to support either name or ID.
I will move this to FAQ discussions, so if others run into the same issue, they will see the fix.
Also tried to forward spam message to admin group - also no reaction.
The same one more time after bot restart - no reaction.
I'm admin of the group, and my user id is also stated in bot's --admin option.
The relevant part of the log (alexxis1999 is the spammer):
2024/10/11 16:38:54.818 [INFO] user "alexxis1999" (6301007238) added to approved users 2024/10/11 17:13:58.122 [WARN] failed to send message as markdown, Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 35 2024/10/11 19:03:54.669 [WARN] interrupt signal 2024/10/11 19:03:54.669 [ERROR] telegram listener failed, context canceled 2024/10/11 19:03:54.669 [ERROR] telegram listener failed, context canceled