From d55a53a26031936912bd603e1083235138347b77 Mon Sep 17 00:00:00 2001 From: blank X Date: Sat, 21 May 2022 23:22:07 +0700 Subject: [PATCH] Remove SPB --- sukuinote/plugins/einfo.py | 51 +++----------------------------------- 1 file changed, 4 insertions(+), 47 deletions(-) diff --git a/sukuinote/plugins/einfo.py b/sukuinote/plugins/einfo.py index f0d3ff9..0f6837d 100644 --- a/sukuinote/plugins/einfo.py +++ b/sukuinote/plugins/einfo.py @@ -50,7 +50,7 @@ DEAI_MODULE_CODES = { "8": "Codename Gestapo" } -@Client.on_message(~filters.scheduled & ~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['einfo', 'externalinfo', 'sw', 'spamwatch', 'deai', 'spb', 'spamprotection', 'cas', 'combot', 'rose', 'sibyl'], prefixes=config['config']['prefixes'])) +@Client.on_message(~filters.scheduled & ~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['einfo', 'externalinfo', 'sw', 'spamwatch', 'deai', 'cas', 'combot', 'rose', 'sibyl'], prefixes=config['config']['prefixes'])) @log_errors @public_log_errors async def fedstat(client, message): @@ -62,13 +62,11 @@ async def fedstat(client, message): elif not getattr(message.reply_to_message, 'empty', True): reply = message.reply_to_message entity = reply.from_user or reply.sender_chat or entity - if isinstance(entity, str) and (not entity.isnumeric() and not entity.startswith('TEL-')): + if isinstance(entity, str) and not entity.isnumeric(): entity, entity_client = await get_entity(client, entity) if not isinstance(entity, str): entity = str(entity.id) - if entity.startswith('TEL-') or int(entity) < 0 or command in ('spb', 'spamprotection'): - await message.reply_text(f'Spam Protection:\n{await get_spam_protection(entity)}', disable_web_page_preview=True) - elif command in ('sw', 'spamwatch'): + if command in ('sw', 'spamwatch'): await message.reply_text(f'SpamWatch:\n{await get_spamwatch(entity)}', disable_web_page_preview=True) elif command == 'deai': await message.reply_text(f'DEAI:\n{await get_deai(client, entity)}', disable_web_page_preview=True) @@ -79,7 +77,7 @@ async def fedstat(client, message): elif command == 'sibyl': await message.reply_text(f'Sibyl:\n{await get_sibyl(entity)}', disable_web_page_preview=True) else: - spamwatch, deai, cas, spam_protection, rose, sibyl = await asyncio.gather(get_spamwatch(entity), get_deai(client, entity), get_cas(entity), get_spam_protection(entity), get_rose(client, entity), get_sibyl(entity)) + spamwatch, deai, cas, rose, sibyl = await asyncio.gather(get_spamwatch(entity), get_deai(client, entity), get_cas(entity), get_rose(client, entity), get_sibyl(entity)) await message.reply_text(f'''SpamWatch: {spamwatch} @@ -92,9 +90,6 @@ Rose Support: DEAI: {deai} -Spam Protection: -{spam_protection} - Sibyl: {sibyl}''', disable_web_page_preview=True) @@ -173,40 +168,6 @@ async def get_cas(entity): - Offenses: {json["result"]["offenses"]}''' return f'- XXX: {html.escape(json.get("description", "XXX"))}' -async def get_spam_protection(entity): - status = 500 - try: - async with session.get(f'https://api.intellivoid.net/spamprotection/v1/lookup?query={entity}') as resp: - status = resp.status - json = await resp.json() - except BaseException as ex: - return f'- {status}: {html.escape(type(ex).__name__)}: {html.escape(str(ex))}' - if json['success']: - text = '' - if json['results']['private_telegram_id']: - text += f'- PTID: ' + json['results']['private_telegram_id'] + "\n" - if json['results']['attributes']['intellivoid_accounts_verified']: - text += '- Intellivoid Account Linked: Yes\n' - if json['results']['attributes']['is_potential_spammer']: - text += '- Potential Spammer: Yes\n' - if json['results']['attributes']['is_operator']: - text += '- Operator: Yes\n' - if json['results']['attributes']['is_agent']: - text += '- Agent: Yes\n' - if json['results']['attributes']['is_whitelisted']: - text += '- Whitelisted: Yes\n' - text += f'- Ham/Spam Prediction: {json["results"]["spam_prediction"]["ham_prediction"] or 0}/{json["results"]["spam_prediction"]["spam_prediction"] or 0}' - if json['results']['language_prediction']['language']: - text += f'''\n- Language Prediction: {json["results"]["language_prediction"]["language"]} -- Language Prediction Probability: {json["results"]["language_prediction"]["probability"]}''' - if json['results']['attributes']['is_blacklisted']: - text += f'''\n- Blacklist Flag: {json["results"]["attributes"]["blacklist_flag"]} -- Blacklist Reason: {json["results"]["attributes"]["blacklist_reason"]}''' - if json['results']['attributes']['original_private_id']: - text += f'\n- Original Private ID: {json["results"]["attributes"]["original_private_id"]}' - return text - return f'- {json["response_code"]}: {json["error"]["error_code"]}: {json["error"]["type"]}: {html.escape(json["error"]["message"])}' - async def get_sibyl(entity): if not config['config'].get('sibyl_api'): return '- 404: Missing sibyl api key' @@ -261,9 +222,5 @@ Aliases: {prefix}combot {prefix}deai <user> - Get DEAI info of <user> {prefix}deai (as reply to message) - Get DEAI info of replied user -{prefix}spamprotection <user> - Get Spam Protection info of <user> -{prefix}spamprotection (as reply to message) - Get Spam Protection info of replied user -Aliases: {prefix}spb' - {prefix}sibyl <user> - Get Sibyl's judgement of <user> {prefix}sibyl (as reply to message) - Get Sibyl's judement of the replied to user''')