-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
switch to OvyFlash/telegram-bot-api (updated fork of the same lib) #180
Conversation
Deploying tg-spam with Cloudflare Pages
|
38b97cd
to
81ff787
Compare
Everything left the same except - "is_premium" flag about user is now known and logged - username of the hidden user would be detected properly in more places
81ff787
to
1513255
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work. just a few minor things and some questions
@@ -485,12 +519,16 @@ func (a *admin) callbackUnbanConfirmed(query *tbapi.CallbackQuery) error { | |||
func (a *admin) unban(userID int64) error { | |||
if a.softBan { // soft ban, just drop restrictions | |||
_, err := a.tbAPI.Request(tbapi.RestrictChatMemberConfig{ | |||
ChatMemberConfig: tbapi.ChatMemberConfig{UserID: userID, ChatID: a.primChatID}, | |||
ChatMemberConfig: tbapi.ChatMemberConfig{UserID: userID, ChatConfig: tbapi.ChatConfig{ChatID: a.primChatID}}, | |||
Permissions: &tbapi.ChatPermissions{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Permissions list is arbitrary and always has been. I'm not sure what the correct way to deal with this. Maybe TG has a way to know "default permissions"? Btw, in this case, you dropped the Pools permission for some reason, but I can see cases where chat allows pools for users, and we may want to restore it upon unban.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description for polls:
CanSendPolls is true, if the user is allowed to send polls, implies can_send_messages
We don't need to care about it as we remove ability to send messages. I've left CanSendOtherMessages
which works the same for backwards compatibility, as otherwise previously issued softbans won't restore that permission on unban.
if update.Message.Chat == nil { | ||
log.Print("[DEBUG] ignoring message not from chat") | ||
continue | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the removed check for update.Message.Chat make me worry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case doesn't exist anymore as Chat is not a pointer and I have no idea how to trigger it.
1. Extracts forward message handling into a separate method 2. Improves error checking for delete message operations 3. Simplifies code structure and reduces duplication
c6b738f
to
b9f69ee
Compare
This branch has been running on a real chat with about 9k users, and I have not seen any problems yet. I will let it run for a few more days before the merge to master. |
Everything left the same except
I tested the changes as much as I could to verify everything works the same.