From caa1c2533404c4e0837eaddfdb6be9ed2daaea74 Mon Sep 17 00:00:00 2001 From: Krishna-singhal <65902764+Krishna-Singhal@users.noreply.github.com> Date: Wed, 17 Feb 2021 20:31:33 +0530 Subject: [PATCH] added Intellivoid SpamProtection (#270) * added Intellivoid SpamProtection * typo * commit suggestion * hmm --- userge/plugins/admin/gban.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/userge/plugins/admin/gban.py b/userge/plugins/admin/gban.py index 7298556ba..d130ed676 100644 --- a/userge/plugins/admin/gban.py +++ b/userge/plugins/admin/gban.py @@ -314,6 +314,31 @@ async def gban_at_entry(message: Message): f"**ID:** `{user_id}`\n**Reason:** `{reason}`\n**Quick Action:**" f" Banned in {message.chat.title}\n\n$AUTOBAN #id{user_id}") ) + continue + async with aiohttp.ClientSession() as ses: + async with ses.get( + "https://api.intellivoid.net/spamprotection/v1/lookup?query=" + str(user_id) + ) as resp: + iv = json.loads(await resp.text()) + if iv['success'] and iv['results']['attributes']['is_blacklisted'] is True: + reason = iv['results']['attributes']['blacklist_reason'] + await asyncio.gather( + message.client.kick_chat_member(chat_id, user_id), + message.reply( + r"\\**#Userge_Antispam**//" + "\n\nGlobally Banned User Detected in this Chat.\n\n" + "**$Intellivoid SpamProtection**\n" + f"**User:** [{first_name}](tg://user?id={user_id})\n" + f"**ID:** `{user_id}`\n**Reason:** `{reason}`\n\n" + "**Quick Action:** Banned", del_in=10), + CHANNEL.log( + r"\\**#Antispam_Log**//" + "\n\n**GBanned User $SPOTTED**\n" + "**$Intellivoid SpamProtection**" + f"\n**User:** [{first_name}](tg://user?id={user_id})\n" + f"**ID:** `{user_id}`\n**Reason:** `{reason}`\n**Quick Action:**" + f" Banned in {message.chat.title}\n\n$AUTOBAN #id{user_id}") + ) elif Config.SPAM_WATCH_API: intruder = await _get_spamwatch_data(user_id) if intruder: