mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
fix bug
This commit is contained in:
parent
d6ef64c70a
commit
1cbe807b05
@ -118,11 +118,20 @@ async def _(bot: Bot, event: GroupIncreaseNoticeEvent):
|
|||||||
user_info = await bot.get_group_member_info(
|
user_info = await bot.get_group_member_info(
|
||||||
group_id=event.group_id, user_id=event.user_id
|
group_id=event.group_id, user_id=event.user_id
|
||||||
)
|
)
|
||||||
await GroupInfoUser.update_or_create(
|
user, _ = await GroupInfoUser.get_or_create(
|
||||||
user_qq=user_info["user_id"],
|
user_qq=user_info["user_id"],
|
||||||
group_id=user_info["group_id"],
|
group_id=user_info["group_id"],
|
||||||
defaults={"user_name": user_info["nickname"], "user_join_time": join_time},
|
defaults={
|
||||||
|
"user_name": user_info["nickname"],
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
user.user_join_time = join_time
|
||||||
|
await user.save()
|
||||||
|
# await GroupInfoUser.update_or_create(
|
||||||
|
# user_qq=user_info["user_id"],
|
||||||
|
# group_id=user_info["group_id"],
|
||||||
|
# defaults={"user_name": user_info["nickname"], "user_join_time": join_time},
|
||||||
|
# )
|
||||||
logger.info(f"用户{user_info['user_id']} 所属{user_info['group_id']} 更新成功")
|
logger.info(f"用户{user_info['user_id']} 所属{user_info['group_id']} 更新成功")
|
||||||
|
|
||||||
# 群欢迎消息
|
# 群欢迎消息
|
||||||
|
|||||||
@ -53,7 +53,7 @@ CASE2ID = {
|
|||||||
"光谱": "set_community_16",
|
"光谱": "set_community_16",
|
||||||
"手套武器箱": "set_community_15",
|
"手套武器箱": "set_community_15",
|
||||||
"伽玛2号": "set_gamma_2",
|
"伽玛2号": "set_gamma_2",
|
||||||
"伽玛": "set_gamma_1",
|
"伽玛": "set_community_13",
|
||||||
"幻彩3号": "set_community_12",
|
"幻彩3号": "set_community_12",
|
||||||
"野火大行动": "set_community_11",
|
"野火大行动": "set_community_11",
|
||||||
"左轮武器箱": "set_community_10",
|
"左轮武器箱": "set_community_10",
|
||||||
|
|||||||
@ -20,7 +20,7 @@ from .models.open_cases_user import OpenCasesUser
|
|||||||
URL = "https://buff.163.com/api/market/goods"
|
URL = "https://buff.163.com/api/market/goods"
|
||||||
# proxies = 'http://49.75.59.242:3128'
|
# proxies = 'http://49.75.59.242:3128'
|
||||||
|
|
||||||
NAME2COLOR = {"军规级": "BLUE", "受限": "PURPLE", "保密": "PINK", "隐秘": "RED", "非凡": "KNIFE"}
|
NAME2COLOR = {"消费级": "WHITE", "工业级": "LIGHTBLUE", "军规级": "BLUE", "受限": "PURPLE", "保密": "PINK", "隐秘": "RED", "非凡": "KNIFE"}
|
||||||
|
|
||||||
CURRENT_CASES = []
|
CURRENT_CASES = []
|
||||||
|
|
||||||
@ -207,40 +207,49 @@ async def search_skin_page(
|
|||||||
for data in data_list:
|
for data in data_list:
|
||||||
obj = {"case_name": case_name}
|
obj = {"case_name": case_name}
|
||||||
name = data["name"]
|
name = data["name"]
|
||||||
logger.debug(
|
try:
|
||||||
f"武器箱: [<u><e>{case_name}</e></u>] 页数: [<u><y>{page_index}</y></u>] 正在收录皮肤: [<u><c>{name}</c></u>]...",
|
logger.debug(
|
||||||
"开箱更新",
|
f"武器箱: [<u><e>{case_name}</e></u>] 页数: [<u><y>{page_index}</y></u>] 正在收录皮肤: [<u><c>{name}</c></u>]...",
|
||||||
)
|
"开箱更新",
|
||||||
obj["buy_max_price"] = data["buy_max_price"] # 求购最大金额
|
)
|
||||||
obj["buy_num"] = data["buy_num"] # 当前求购
|
obj["buy_max_price"] = data["buy_max_price"] # 求购最大金额
|
||||||
goods_info = data["goods_info"]
|
obj["buy_num"] = data["buy_num"] # 当前求购
|
||||||
info = goods_info["info"]
|
goods_info = data["goods_info"]
|
||||||
tags = info["tags"]
|
info = goods_info["info"]
|
||||||
obj["weapon_type"] = tags["type"]["localized_name"] # 枪械类型
|
tags = info["tags"]
|
||||||
if obj["weapon_type"] in ["音乐盒", "印花"]:
|
obj["weapon_type"] = tags["type"]["localized_name"] # 枪械类型
|
||||||
continue
|
if obj["weapon_type"] in ["音乐盒", "印花", "探员"]:
|
||||||
if obj["weapon_type"] in ["匕首", "手套"]:
|
continue
|
||||||
obj["color"] = "KNIFE"
|
if obj["weapon_type"] in ["匕首", "手套"]:
|
||||||
obj["name"] = data["short_name"].split("(")[0].strip() # 名称
|
obj["color"] = "KNIFE"
|
||||||
if obj["weapon_type"] in ["武器箱"]:
|
obj["name"] = data["short_name"].split("(")[0].strip() # 名称
|
||||||
obj["color"] = "CASE"
|
if obj["weapon_type"] in ["武器箱"]:
|
||||||
obj["name"] = data["short_name"]
|
obj["color"] = "CASE"
|
||||||
else:
|
obj["name"] = data["short_name"]
|
||||||
obj["color"] = NAME2COLOR[tags["rarity"]["localized_name"]]
|
else:
|
||||||
obj["name"] = tags["weapon"]["localized_name"] # 名称
|
obj["color"] = NAME2COLOR[tags["rarity"]["localized_name"]]
|
||||||
if obj["weapon_type"] not in ["武器箱"]:
|
obj["name"] = tags["weapon"]["localized_name"] # 名称
|
||||||
obj["abrasion"] = tags["exterior"]["localized_name"] # 磨损
|
if obj["weapon_type"] not in ["武器箱"]:
|
||||||
obj["color"] = NAME2COLOR[tags["rarity"]["localized_name"]] # 品质颜色
|
obj["abrasion"] = tags["exterior"]["localized_name"] # 磨损
|
||||||
obj["is_stattrak"] = "StatTrak" in tags["quality"]["localized_name"] # type: ignore # 是否暗金
|
obj["is_stattrak"] = "StatTrak" in tags["quality"]["localized_name"] # type: ignore # 是否暗金
|
||||||
else:
|
if not obj["color"]:
|
||||||
obj["abrasion"] = "CASE"
|
obj["color"] = NAME2COLOR[
|
||||||
obj["skin_name"] = data["short_name"].split("|")[-1].strip() # 皮肤名称
|
tags["rarity"]["localized_name"]
|
||||||
obj["img_url"] = goods_info["original_icon_url"] # 图片url
|
] # 品质颜色
|
||||||
obj["steam_price"] = goods_info["steam_price_cny"] # steam价格
|
else:
|
||||||
obj["sell_min_price"] = data["sell_min_price"] # 售卖最低价格
|
obj["abrasion"] = "CASE"
|
||||||
obj["sell_num"] = data["sell_num"] # 售卖数量
|
obj["skin_name"] = data["short_name"].split("|")[-1].strip() # 皮肤名称
|
||||||
obj["sell_reference_price"] = data["sell_reference_price"] # 参考价格
|
obj["img_url"] = goods_info["original_icon_url"] # 图片url
|
||||||
update_data.append(BuffSkin(**obj))
|
obj["steam_price"] = goods_info["steam_price_cny"] # steam价格
|
||||||
|
obj["sell_min_price"] = data["sell_min_price"] # 售卖最低价格
|
||||||
|
obj["sell_num"] = data["sell_num"] # 售卖数量
|
||||||
|
obj["sell_reference_price"] = data["sell_reference_price"] # 参考价格
|
||||||
|
update_data.append(BuffSkin(**obj))
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(
|
||||||
|
f"更新武器箱: [<u><e>{case_name}</e></u>] 皮肤: [<u><c>{name}</c></u>] 错误",
|
||||||
|
e=e,
|
||||||
|
)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"访问武器箱: [<u><e>{case_name}</e></u>] 页数: [<u><y>{page_index}</y></u>] 成功并收录完成",
|
f"访问武器箱: [<u><e>{case_name}</e></u>] 页数: [<u><y>{page_index}</y></u>] 成功并收录完成",
|
||||||
"开箱更新",
|
"开箱更新",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user