bin 信用卡bin查询插件 (#172)

This commit is contained in:
Paulkm2006 2021-07-12 13:58:12 +08:00 committed by GitHub
parent bd8c1680b9
commit f67e4375af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 0 deletions

58
bin.py Normal file
View File

@ -0,0 +1,58 @@
import json, requests
from pagermaid.listener import listener
from pagermaid.utils import obtain_message, alias_command
@listener(is_plugin=True, outgoing=True, command=alias_command("bin"),
description="查询信用卡信息",
parameters="<bin4到8位数字>")
async def card(context):
await context.edit('正在查询中...')
try:
card_bin = await obtain_message(context)
except ValueError:
await context.edit("出错了呜呜呜 ~ 无效的参数。")
return
try:
r = requests.get("https://lookup.binlist.net/" + card_bin)
except:
await context.edit("出错了呜呜呜 ~ 无法访问到binlist。")
return
if r.status_code == 404:
await context.edit("出错了呜呜呜 ~ 目标卡头不存在")
return
if r.status_code == 429:
await context.edit("出错了呜呜呜 ~ 每分钟限额超过,请等待一分钟再试")
return
bin_json = json.loads(r.content.decode("utf-8"))
msg_out = []
msg_out.extend(["BIN" + card_bin])
try:
msg_out.extend(["卡品牌:" + bin_json['scheme']])
except KeyError:
pass
try:
msg_out.extend(["卡类型:" + bin_json['type']])
except KeyError:
pass
try:
msg_out.extend(["卡种类:" + bin_json['brand']])
except KeyError:
pass
try:
msg_out.extend(["发卡行:" + bin_json['bank']["name"]])
except KeyError:
pass
try:
if bin_json['prepaid']:
msg_out.extend(["是否预付:是"])
else:
msg_out.extend(["是否预付:否"])
except KeyError:
pass
try:
msg_out.extend(["发卡国家:" + bin_json['country']['name']])
except KeyError:
pass
await context.edit("\n".join(msg_out))

View File

@ -579,6 +579,16 @@
"supported": true,
"des-short": "列出群组中所有潜水超过 n 天的管理员。",
"des": "列出群组中所有潜水超过 n 天的管理员。n>=7。命令fuckadmin 。"
},
{
"name": "bin",
"version": "1.0",
"section": "daily",
"maintainer": "paulkm",
"size": "1.8 kb",
"supported": true,
"des-short": "查询信用卡bin信息。",
"des": "使用binlist api查询1分钟限额10次否则报错。使用方法-bin xxx xxx为信用卡卡号前4-8位推荐6位"
}
]
}