# █ █ ▀ █▄▀ ▄▀█ █▀█ ▀
# █▀█ █ █ █ █▀█ █▀▄ █
# © Copyright 2022
# https://t.me/hikariatama
#
# 🔒 Licensed under the GNU AGPLv3
# 🌐 https://www.gnu.org/licenses/agpl-3.0.html
# meta pic: https://static.dan.tatar/bincheck_icon.png
# meta banner: https://mods.hikariatama.ru/badges/bincheck.jpg
# meta developer: @hikarimods
# scope: hikka_only
# scope: hikka_min 1.2.10
import json
import requests
from telethon.tl.types import Message
from .. import loader, utils
@loader.tds
class BinCheckerMod(loader.Module):
"""Show bin info about card"""
strings = {
"name": "BinCheck",
"args": (
"💳 To get bin info, you"
" need to specify Bin of card (first 6 digits)"
),
}
strings_ru = {
"args": (
"💳 Для получения"
" информации БИН укажи первые 6 цифр карты"
),
"_cmd_doc_bincheck": "[bin] - Получить информацию БИН",
"_cls_doc": "Показать информацию БИН о банковской карте",
}
strings_de = {
"args": (
"💳 Um die Bin-Info zu"
" erhalten, musst du die Bin der Karte (erste 6 Ziffern) angeben"
),
"_cmd_doc_bincheck": "[bin] - Erhalte Bin-Info",
"_cls_doc": "Zeigt Bin-Info über eine Bankkarte an",
}
strings_hi = {
"args": (
"💳 बिन जानकारी प्राप्त"
" करने के लिए, आपको कार्ड का बिन (पहले 6 अंक) निर्दिष्ट करना होगा"
),
"_cmd_doc_bincheck": "[bin] - बिन जानकारी प्राप्त करें",
"_cls_doc": "बैंक कार्ड के बारे में बिन जानकारी दिखाएं",
}
strings_uz = {
"args": (
"💳 Bin haqida ma'lumot"
" olish uchun, siz karta bin (birinchi 6 raqam) belgilashingiz kerak"
),
"_cmd_doc_bincheck": "[bin] - Bin haqida ma'lumot olish",
"_cls_doc": "Bank karta haqida bin ma'lumotini ko'rsatish",
}
strings_tr = {
"args": (
"💳 Bin bilgisi almak"
" için, kartın bin (ilk 6 rakam) belirtmeniz gerekir"
),
"_cmd_doc_bincheck": "[bin] - Bin bilgisi al",
"_cls_doc": "Banka kartı hakkında bin bilgisi göster",
}
@loader.unrestricted
async def bincheckcmd(self, message: Message):
"""[bin] - Get card Bin info"""
args = utils.get_args_raw(message)
try:
args = int(args)
if args < 100000 or args > 999999:
raise Exception()
except Exception:
await utils.answer(message, self.strings("args"))
return
async def bincheck(cc):
try:
ans = json.loads(
(
await utils.run_sync(
requests.get, f"https://bin-checker.net/api/{str(cc)}"
)
).text
)
return (
"Bin: %s\n\n🏦 Bank: %s\n🌐 Payment system: %s"
" [%s]\n✳️ Level: %s\n⚛️ Country: %s "
% (
cc,
ans["bank"]["name"],
ans["scheme"],
ans["type"],
ans["level"],
ans["country"]["name"],
)
)
except Exception:
return "BIN data unavailable"
await utils.answer(message, await bincheck(args))