去掉/bm93

This commit is contained in:
shenjack 2024-08-10 12:04:44 +08:00
parent 1a8714488c
commit 70180265c2
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -255,37 +255,36 @@ def bmcl_rank(msg: IcaNewMessage, client: IcaClient | TailchatClient, name: str)
client.send_message(reply)
def bangbang_img(msg: IcaNewMessage, client: IcaClient) -> None:
data = requests.get("https://api.bangbang93.top/api/link")
if data.status_code != 200:
reply = msg.reply_with(f"请求失败 {data.status_code} {data.reason}")
client.send_message(reply)
return
raw_name = data.url.split("/")[-1]
img_suffix = raw_name.split(".")[-1]
# mine 映射一下
if img_suffix.lower() in ("jpeg", "jpg"):
img_suffix = "jpeg"
img_name = raw_name[:-len(img_suffix) - 1]
img_name = urllib.parse.unquote(img_name)
mime_format = f"image/{img_suffix}"
client.info(f"获取到随机怪图: {img_name} {img_suffix}")
reply = msg.reply_with(img_name)
reply.set_img(data.content, mime_format, True)
client.send_message(reply)
# def bangbang_img(msg: IcaNewMessage, client: IcaClient) -> None:
# data = requests.get("https://api.bangbang93.top/api/link")
# if data.status_code != 200:
# reply = msg.reply_with(f"请求失败 {data.status_code} {data.reason}")
# client.send_message(reply)
# return
# raw_name = data.url.split("/")[-1]
# img_suffix = raw_name.split(".")[-1]
# # mine 映射一下
# if img_suffix.lower() in ("jpeg", "jpg"):
# img_suffix = "jpeg"
# img_name = raw_name[:-len(img_suffix) - 1]
# img_name = urllib.parse.unquote(img_name)
# mime_format = f"image/{img_suffix}"
# client.info(f"获取到随机怪图: {img_name} {img_suffix}")
# reply = msg.reply_with(img_name)
# reply.set_img(data.content, mime_format, True)
# client.send_message(reply)
help = """/bmcl -> dashboard
/bmcl rank -> all rank
/bmcl rank <name> -> rank of <name>
/bm93 -> 随机怪图
/brrs <name> -> rank of <name>
搜索限制:
1- 3 显示全部信息
4-10 显示状态名称
11+ 不显示
"""
# /bm93 -> 随机怪图
def on_ica_message(msg: IcaNewMessage, client: IcaClient) -> None:
if not (msg.is_from_self or msg.is_reply):
@ -320,8 +319,8 @@ def on_ica_message(msg: IcaNewMessage, client: IcaClient) -> None:
if len(name) > 1:
name = name[1]
bmcl_rank(msg, client, name)
elif msg.content == "/bm93":
bangbang_img(msg, client)
# elif msg.content == "/bm93":
# bangbang_img(msg, client)
except: # noqa
report_msg = f"bmcl插件发生错误,请呼叫shenjack\n{traceback.format_exc()}"
client.warn(report_msg)