shieldy icon indicating copy to clipboard operation
shieldy copied to clipboard

Fix users being banned permanently

Open ayaka14732 opened this issue 1 year ago • 0 comments

In the previous version, when chat.banUsers is set to false, we use parseInt(`${new Date().getTime() / 1000 + 45}`) to ban a user for 45 seconds. The intention is that the ban will be automatically lifted after 45 seconds.

Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.

In practice, however, this often does not work, and will cause the user to be banned permanently, which has been raised in #106.

In this pull request, I substitute the 45-second approach with the bot.telegram.unbanChatMember API, which will remove a member from the chat (similar to bot.telegram.kickChatMember) but without banning it.

ayaka14732 avatar Aug 16 '22 02:08 ayaka14732