mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
修复群聊数据无法初始化
This commit is contained in:
parent
e4ca110938
commit
7b0785248c
@ -331,6 +331,10 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能
|
|||||||
|
|
||||||
## 更新
|
## 更新
|
||||||
|
|
||||||
|
### 2023/5/28
|
||||||
|
|
||||||
|
* 修复群聊数据无法初始化
|
||||||
|
|
||||||
### 2023/5/24
|
### 2023/5/24
|
||||||
|
|
||||||
* 轮盘结算信息使用图片发送
|
* 轮盘结算信息使用图片发送
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import re
|
import re
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from nonebot.adapters.onebot.v11 import Bot, Message
|
from nonebot.adapters.onebot.v11 import Bot, Message, unescape
|
||||||
from nonebot.exception import MockApiException
|
from nonebot.exception import MockApiException
|
||||||
|
|
||||||
from services.log import logger
|
from services.log import logger
|
||||||
@ -14,27 +14,22 @@ async def _(bot: Bot, api: str, data: Dict[str, Any]):
|
|||||||
task = None
|
task = None
|
||||||
group_id = None
|
group_id = None
|
||||||
try:
|
try:
|
||||||
|
msg = unescape(
|
||||||
|
data["message"].strip()
|
||||||
|
if isinstance(data["message"], str)
|
||||||
|
else str(data["message"]["text"]).strip()
|
||||||
|
)
|
||||||
if (
|
if (
|
||||||
(
|
(
|
||||||
(api == "send_msg" and data.get("message_type") == "group")
|
(api == "send_msg" and data.get("message_type") == "group")
|
||||||
or api == "send_group_msg"
|
or api == "send_group_msg"
|
||||||
)
|
)
|
||||||
and (
|
and (
|
||||||
(
|
r := re.search(
|
||||||
r := re.search(
|
"^\[\[_task\|(.*)]]",
|
||||||
"^\[\[_task\|(.*)]]",
|
data["message"].strip()
|
||||||
data["message"].strip()
|
if isinstance(data["message"], str)
|
||||||
if isinstance(data["message"], str)
|
else str(data["message"]["text"]).strip(),
|
||||||
else str(data["message"]["text"]).strip(),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
or (
|
|
||||||
r := re.search(
|
|
||||||
"^[[_task\|(.*)]]",
|
|
||||||
data["message"].strip()
|
|
||||||
if isinstance(data["message"], str)
|
|
||||||
else str(data["message"]["text"]).strip(),
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
and r.group(1) in group_manager.get_task_data().keys()
|
and r.group(1) in group_manager.get_task_data().keys()
|
||||||
|
|||||||
@ -35,9 +35,11 @@ def init_group(func: Callable):
|
|||||||
|
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
self = args[0]
|
self = args[0]
|
||||||
group_id = list(filter(lambda x: is_number(x), args[1:]))[0]
|
if arg_list := list(filter(lambda x: is_number(x), args[1:])):
|
||||||
if self is not None and group_id and not self._data.group_manager.get(group_id):
|
group_id = str(arg_list[0])
|
||||||
self._data.group_manager[group_id] = BaseGroup()
|
if self is not None and group_id and not self._data.group_manager.get(group_id):
|
||||||
|
self._data.group_manager[group_id] = BaseGroup()
|
||||||
|
self.save()
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user