This commit is contained in:
2023-04-28 15:24:14 +03:00
parent 351b53f007
commit 318b24243a
20 changed files with 244 additions and 154 deletions

View File

@@ -0,0 +1,18 @@
from tgbot.storage import scan, Profile
# устанавливает соответствие данных
def handle_startup():
btn_ids, btns = scan(match='btn-*', count=100)
for btnid in btn_ids:
# для каждой ранее созданной кнопки
try:
btnid_str = btnid.decode("utf-8")
chat_id, member_id = btnid_str[3:].split('-')
newcomer = Profile.get(member_id)
if len(newcomer.get('parents', [])) > 0:
# принять заявку если её нажимали
r = approve_chat_join_request(chat_id, member_id)
print(r)
except:
print(f'error {btnid}')