From 9c62d475e4f32c3389c82b5ba4b78de6e98d176d Mon Sep 17 00:00:00 2001 From: Andrea Draghetti Date: Mon, 26 Feb 2024 16:25:01 +0100 Subject: [PATCH] =?UTF-8?q?Notice=20when=20bot=20was=20kicked=20(IRC=20lam?= =?UTF-8?q?er=20=F0=9F=A4=98)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tosint.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tosint.py b/tosint.py index 6a38f48..760662c 100755 --- a/tosint.py +++ b/tosint.py @@ -30,9 +30,11 @@ def main(): if response.json().get('result'): telegram_get_chat_member = response.json().get('result') print(f"Bot In The Chat Is An: {telegram_get_chat_member['status']}") - elif response.json().get('parameters')['migrate_to_chat_id']: - migrate_to_chat_id = response.json().get('parameters')['migrate_to_chat_id'] - print(f"ATTENTION {response.json().get('description')} - Migrated to: {migrate_to_chat_id}") + elif response.json().get('description'): + if response.json().get('parameters') and 'migrate_to_chat_id' in response.json().get('parameters'): + print(f"ATTENTION {response.json().get('description')} - Migrated to: {response.json().get('parameters')['migrate_to_chat_id']}") + else: + print(f"ATTENTION {response.json().get('description')}") # Get Chat Info