mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-09-29 08:39:59 +08:00
fix mute and open_case
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Type
|
||||
from typing import Type, Tuple, Any
|
||||
from nonebot import on_command
|
||||
from nonebot.matcher import Matcher
|
||||
from utils.utils import scheduler, is_number
|
||||
@@ -9,7 +9,7 @@ from nonebot.permission import SUPERUSER
|
||||
import random
|
||||
from nonebot.plugin import MatcherGroup
|
||||
from configs.path_config import IMAGE_PATH
|
||||
from nonebot.params import CommandArg
|
||||
from nonebot.params import CommandArg, RegexGroup
|
||||
from .open_cases_c import (
|
||||
open_case,
|
||||
total_open_statistics,
|
||||
@@ -145,12 +145,12 @@ async def _(event: GroupMessageEvent):
|
||||
)
|
||||
|
||||
|
||||
open_shilian: Type[Matcher] = cases_matcher_group.on_regex("(.*)连开箱(.*?)")
|
||||
open_shilian: Type[Matcher] = cases_matcher_group.on_regex("(.*)连开箱(.*)?")
|
||||
|
||||
|
||||
@open_shilian.handle()
|
||||
async def _(event: GroupMessageEvent, state: T_State):
|
||||
num = state["_matched_groups"][0].strip()
|
||||
async def _(event: GroupMessageEvent, state: T_State, reg_group: Tuple[Any, ...] = RegexGroup()):
|
||||
num, case_name = reg_group
|
||||
if is_number(num) or num_dict.get(num):
|
||||
try:
|
||||
num = num_dict[num]
|
||||
@@ -162,7 +162,6 @@ async def _(event: GroupMessageEvent, state: T_State):
|
||||
await open_shilian.finish("再负开箱就扣你明天开箱数了!", at_sender=True)
|
||||
else:
|
||||
await open_shilian.finish("必须要是数字切不要超过30啊笨蛋!中文也可!", at_sender=True)
|
||||
case_name = state["_matched_groups"][1].strip()
|
||||
case_name = case_name.replace("武器箱", "").strip()
|
||||
if not case_name:
|
||||
case_name = random.choice(cases_name)
|
||||
|
||||
Reference in New Issue
Block a user