Skip to content

Commit

Permalink
update v0.1.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
HibiKier committed May 9, 2022
1 parent 8029c00 commit b3b09ed
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 29 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__

## 更新

### 2022/5/9

* 替换了疫情API
* 修复了私聊.ban/.unban出错

### 2022/5/5

* 修改bilibili_sub插件在windows平台下报错 [@pull/153](https://github.com/HibiKier/zhenxun_bot/pull/153)
Expand All @@ -252,12 +257,13 @@ __Docker 最新版本由 [Sakuracio](https://github.com/Sakuracio) 提供__
* 添加商品注册装饰器shop_register
* 修复商品函数kwargs无法获取参数值


### 2022/5/1

* 删除了`group_last_chat`插件(该功能可由`chat_history`替代
* 新增敏感词检测(全新反击系统,是时候重拳出击了

### 2022/4/26 \[v0.5.1.0]
### 2022/4/26

* 修复了群白名单无法正确添加
* 优化了管理员帮助图片,背景图层将位于最下层
Expand Down
2 changes: 1 addition & 1 deletion __version__
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__: v0.1.5.1
__version__: v0.1.5.3
10 changes: 6 additions & 4 deletions basic_plugins/ban/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ async def _(
msg = arg.extract_plain_text().strip()
if msg:
if str(event.user_id) in bot.config.superusers:
if is_number(arg.extract_plain_text().strip().split()[0]):
qq = int(msg[0])
msg = msg[1:]
msg_splt = msg.split()
if is_number(msg_splt[0]):

qq = int(msg_splt[0])
msg = msg_splt[1:]
if cmd in [".ban", "/ban"]:
time = parse_ban_time(msg)
time = parse_ban_time(" ".join(msg))
if isinstance(time, str):
await ban.finish(time)
result = await a_ban(qq, time, str(qq), event, 9)
Expand Down
17 changes: 5 additions & 12 deletions basic_plugins/ban/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def parse_ban_time(msg: str) -> Union[int, str]:
return int(msg[0]) * 60 * 60 + int(msg[1]) * 60


async def a_ban(qq: int, time: int, user_name: str, event: MessageEvent, ban_level: int = None) -> str:
async def a_ban(
qq: int, time: int, user_name: str, event: MessageEvent, ban_level: int = None
) -> str:
"""
ban
:param qq: qq
Expand All @@ -38,7 +40,8 @@ async def a_ban(qq: int, time: int, user_name: str, event: MessageEvent, ban_lev
ban_level = await LevelUser.get_user_level(event.user_id, event.group_id)
if await BanUser.ban(qq, ban_level, time):
logger.info(
f"USER {event.user_id} GROUP {event.group_id} 将 USER {qq} 封禁 时长 {time / 60} 分钟"
f"USER {event.user_id} GROUP"
f" {event.group_id if isinstance(event, GroupMessageEvent) else ''} 将 USER {qq} 封禁 时长 {time / 60} 分钟"
)
result = f"已经将 {user_name} 加入{NICKNAME}的黑名单了!"
if time != -1:
Expand All @@ -57,13 +60,3 @@ async def a_ban(qq: int, time: int, user_name: str, event: MessageEvent, ban_lev
time += " 分钟"
result = f"{user_name} 已在黑名单!预计 {time}后解封"
return result










2 changes: 1 addition & 1 deletion basic_plugins/shop/use/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def parse_args(args_: MappingProxyType):
)
else:
return self._data[goods_name]["func"](
**kwargs,
*parse_args(args)
)
else:
if asyncio.iscoroutinefunction(self._data[goods_name]["func"]):
Expand Down
2 changes: 1 addition & 1 deletion plugins/bilibili_sub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
__plugin_des__ = "非常便利的B站订阅通知"
__plugin_cmd__ = ["添加订阅 [主播/UP/番剧] [id/链接/番名]", "删除订阅 [id]", "查看订阅"]
__plugin_version__ = 0.1
__plugin_author__ = "HibiKier"
__plugin_author__ = "HibiKier & NumberSir"
__plugin_settings__ = {
"level": 5,
"default_status": True,
Expand Down
2 changes: 1 addition & 1 deletion plugins/word_bank/word_hanlde.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"查看词条 ?[问题/下标]",
]
__plugin_version__ = 0.2
__plugin_author__ = "HibiKier"
__plugin_author__ = "HibiKier & yajiwa"
__plugin_settings__ = {
"admin_level": Config.get_config("word_bank", "WORD_BANK_LEVEL [LEVEL]"),
"cmd": ["词库问答", "添加词条", "删除词条", "修改词条", "查看词条"],
Expand Down
16 changes: 8 additions & 8 deletions plugins/yiqing/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
data = {}


url = "https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5"
url = "https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=diseaseh5Shelf"


async def get_yiqing_data(area: str) -> Union[str, MessageSegment]:
Expand All @@ -37,7 +37,7 @@ async def get_yiqing_data(area: str) -> Union[str, MessageSegment]:
if area in data[p]:
province = p
city = area
epidemic_data = json.loads((await AsyncHttpx.get(url)).json()["data"])
epidemic_data = (await AsyncHttpx.get(url)).json()["data"]["diseaseh5Shelf"]
last_update_time = epidemic_data["lastUpdateTime"]
if area == "中国":
data_ = epidemic_data["areaTree"][0]
Expand All @@ -59,12 +59,12 @@ async def get_yiqing_data(area: str) -> Union[str, MessageSegment]:
add_confirm = data_["today"]["confirm"] # 新增确诊
grade = ""
_grade_color = ""
if data_["total"].get("grade"):
grade = data_["total"]["grade"]
if "中风险" in grade:
_grade_color = "#fa9424"
else:
_grade_color = "red"
# if data_["total"].get("grade"):
# grade = data_["total"]["grade"]
# if "中风险" in grade:
# _grade_color = "#fa9424"
# else:
# _grade_color = "red"

dead_rate = f"{dead / confirm * 100:.2f}" # 死亡率
heal_rate = f"{heal / confirm * 100:.2f}" # 治愈率
Expand Down

0 comments on commit b3b09ed

Please sign in to comment.