Skip to content

Commit

Permalink
added Intellivoid SpamProtection (UsergeTeam#270)
Browse files Browse the repository at this point in the history
* added Intellivoid SpamProtection

* typo

* commit suggestion

* hmm
  • Loading branch information
Krishna-Singhal authored Feb 17, 2021
1 parent cda1e68 commit caa1c25
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions userge/plugins/admin/gban.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit caa1c25

Please sign in to comment.