mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 07:47:39 +00:00
bin 信用卡bin查询插件 (#172)
This commit is contained in:
parent
bd8c1680b9
commit
f67e4375af
58
bin.py
Normal file
58
bin.py
Normal 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="<bin(4到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))
|
10
list.json
10
list.json
@ -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位)"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user