ImoutoChan/GreenCaptchaBot

Bug: bot incorrectly sets restrictions for new chat members

kreuwont opened this issue · 1 comments

New users joining to the chat can not write messages even after successfully solving the captcha.

Suspected reason: for getting actual restrictions for current user you use getchatmember from tg bot api. This method return struct with status field which can accept one of several values (restricted, member, owner and other). The reason is that the fields with the current restrictions information for user are given only to users with 'restricted' status (and new users have 'member' status and these fields are not sent in the response => .NET sets defalt values for those model's fields).

Telegram api answer example

Suspected reason: […] fields are not sent in the response => .NET sets defalt values for those model's fields).

Your hypothesis isn't right: as I can see, the corresponding values are nullable bools.