Пример #1
0
async def _(session: CommandSession):
    print('session', session)

    # 去掉消息首尾的空白符
    stripped_arg = session.current_arg.strip()

    pattern = re.compile('[1-9]([0-9]{4,10})')
    stripped_arg = pattern.search(stripped_arg).group(0)

    if session.is_first_run:
        # 该命令第一次运行(第一次进入命令会话)
        if stripped_arg:
            # 第一次运行参数不为空,意味着用户直接将城市名跟在命令名后面,作为参数传入
            # 例如用户可能发送了:天气 南京
            session.state['member'] = stripped_arg
        return

    if not stripped_arg:
        # 用户没有发送有效的城市名称(而是发送了空白字符),则提示重新输入
        # 这里 session.pause() 将会发送消息并暂停当前会话(该行后面的代码不会被运行)
        session.pause('你想喷谁呢?')

    # 如果当前正在向用户询问更多信息(例如本例中的要查询的城市),且用户输入有效,则放入会话状态
    session.state[session.current_key] = stripped_arg
Пример #2
0
async def netease_music(session: CommandSession):
    # 从会话状态(session.state)中获取城市名称(city),如果当前不存在,则询问用户
    # await session.send("在使用 mirai 的情况下无法发送自定义的音乐消息,所以该功能已停用。")
    # return
    song_name = session.get('arg', prompt='乐曲名?')
    # 获取城市的天气预报
    result = await get_163_music_(song_name)
    if result == -114514:
        await session.send("似乎没有找到")
    elif result == -114513:
        await session.send("根本什么都没有")
    elif result == -114512:
        await session.send("和服务器的连接可能发生错误,请稍后再试")
    else:
        await session.send("[CQ:music,type=163,id=" + str(result) + "]")
Пример #3
0
async def _(session: CommandSession):
    stripped_arg = session.current_arg_text.split(' ')
    if session.ctx['message_type'] == 'group':
        session.state['type'] = 2
    else:
        session.state['type'] = 1
    if stripped_arg and len(stripped_arg) == 2:
        session.state['rank'] = int(stripped_arg[0])
        session.state['value'] = int(stripped_arg[1])
        if session.state['rank'] not in (1, 2, 3, 10, 100, 2500, 5000, 10000,
                                         25000, 50000):
            session.finish(
                'rank错误,可用的rank包括1, 2, 3, 10, 100, 2500, 5000, 10000, 25000, 50000'
            )
    else:
        session.finish('格式错误,请使用档线预警 Rank 设定值的格式设定。\n例: \
                       【档线报警 2500 300000】表示在Rank2500的档线达到300000以上时进行通知')
Пример #4
0
async def run(session: CommandSession):
    supported_languages = ", ".join(sorted(SUPPORTED_LANGUAGES.keys()))
    language = session.get('language',
                           prompt='你想运行的代码是什么语言?\n'
                           f'目前支持 {supported_languages}')
    code = session.get('code', prompt='你想运行的代码是?')
    await session.send('正在运行,请稍等……')
    resp = await requests.post(
        RUN_API_URL_FORMAT.format(language),
        json={
            'files': [{
                'name': (SUPPORTED_LANGUAGES[language].get('name', 'main') +
                         f'.{SUPPORTED_LANGUAGES[language]["ext"]}'),
                "content":
                code
            }],
            'stdin':
            '',
            'command':
            ''
        })
    if not resp.ok:
        session.finish('运行失败,服务可能暂时不可用,请稍后再试')

    payload = await resp.json()
    if not isinstance(payload, dict):
        session.finish('运行失败,服务可能暂时不可用,请稍后再试')

    sent = False
    for k in ['stdout', 'stderr', 'error']:
        v = payload.get(k)
        lines = v.splitlines()
        lines, remained_lines = lines[:10], lines[10:]
        out = '\n'.join(lines)
        out, remained_out = out[:60 * 10], out[60 * 10:]

        if remained_lines or remained_out:
            out += f'\n(输出过多,已忽略剩余内容)'

        out = message_escape(out)
        if out:
            await session.send(f'{k}:\n\n{out}')
            sent = True

    if not sent:
        session.finish('运行成功,没有任何输出')
Пример #5
0
async def _(session: CommandSession):
    qq = session.ctx.get('user_id')
    setting = session.get('bind_info', prompt='使用QQ当图床请输入0\n使用时光机当图床请输入1')
    try:
        setting = int(setting)
        con = sqlite3.connect('bind_info.sqlite')
        cur = con.cursor()
        cur.execute('update user set setting = ? where qq = ?', (setting, qq))
        cur.close()
        con.commit()
        con.close()
    except Exception as e:
        await session.send('发生错误')
    else:
        await session.send('图床已更改')
Пример #6
0
async def QandA(session: CommandSession):
    # 从会话状态(session.state)中获取城市名称(city),如果当前不存在,则询问用户
    QA = session.get('QA', prompt='请输入问题与回答')

    if (QA.find(' ') != 0):
        preque = QA[0:QA.find(' ')]
        #判断QA表中是否已经存在
        if (question.count(preque) != 0):  #问题已经存在
            index = question.index(preque)
            answer[index] = QA[QA.find(' ') + 1:]
            await session.send('答案已覆盖')
        else:  #问题还未存在
            question.append(QA[0:QA.find(' ')])
            answer.append(QA[QA.find(' ') + 1:])
            await session.send('设置完成')
Пример #7
0
async def generalDeposit(session: CommandSession):
    if len(session.argv) == 2:
        price = int(eval(session.argv[1]) * 100)
        if session.argv[0] in ('支付宝', 'zfb', 'ZFB'):
            qrcode = await pay.getPayQRcode(price=repr(price),
                                            type='2',
                                            orderuid=repr(
                                                session.ctx['user_id']),
                                            goodsname='支付宝充值')
            if qrcode:
                msg = {'type': 'image', 'data': {'file': 'base64://' + qrcode}}
            else:
                msg = '获取支付宝二维码错误,请重试或联系群主。'
        elif session.argv[0] in ('微信', 'wx', 'WX'):
            qrcode = await pay.getPayQRcode(price=repr(price),
                                            type='1',
                                            orderuid=repr(
                                                session.ctx['user_id']),
                                            goodsname='微信充值')
            if qrcode:
                msg = {'type': 'image', 'data': {'file': 'base64://' + qrcode}}
                await bot.send_group_msg_rate_limited(
                    group_id=config.notice_group,
                    message=str(session.ctx['user_id']) + '获取了' +
                    session.argv[0] + session.argv[1] + '元二维码')
                logger.info(
                    str(session.ctx['user_id']) + '获取了' + session.argv[0] +
                    session.argv[1] + '元二维码')
            else:
                msg = '获取微信二维码错误,请重试或联系群主。'
        else:
            msg = '快速充值用法:发送 充值 微信/支付宝 金额'
        session.finish(msg)
    else:
        session.finish(
            '充值命令用法:请向我发送“充值 微信/支付宝 金额”,例如您想用微信充值100元,请发送“充值 微信 100”')
Пример #8
0
async def note_remove(session: CommandSession):
    ctx_id = context_id(session.ctx)
    count = await note_count(ctx_id)
    if count == 0:
        await session.send(expr(e.LIST_EMPTY))
        return

    id_ = session.get('id', prompt=expr(e.DEL_WHICH_ID))
    note_ = await Note.query.where((Note.context_id == ctx_id)
                                   & (Note.id == id_)).gino.first()
    if note_ is None:
        await session.send(expr(e.DEL_ID_NOT_EXISTS, id=id_))
    else:
        await note_.delete()
        await session.send(expr(e.DEL_SUCCESS, id=id_, content=note_.content))
Пример #9
0
async def item(session: CommandSession):
    is_format = session.get('format')
    if not is_format:
        await session.send('/item 格式错误!./item QQ ± 物品名')
        return
    # 格式正确
    change_qq = int(session.get('change_qq'))
    op_type = session.get('op_type')
    item_name = session.get('item_name')
    # 在游戏中则寻找状态卡,不存在发送错误
    if find_pc(change_qq) is not True:
        await session.send(str(session.event.sender['card']) + ' ' + id_pc_not_find)
        return
    # 存在状态卡
    try:
        result_str = update_item(change_qq, op_type, item_name)
    except Exception:
        await session.send(state_file_used)
        return
    card = None
    try:
        bot = get_bot()
        member_list = await bot.get_group_member_list(group_id=session.event['group_id'])
        for member in member_list:
            if str(member['user_id']) == str(change_qq):
                card = member['card']
    except Exception:
        card = str(change_qq)

    if result_str == 'Have':
        await session.send('[' + card + ']' + item_add_have)
    if result_str == 'Not have':
        await session.send('[' + card + ']' + item_remove_not_have)
    if result_str == 'Succeed':
        await session.send('[' + card + ']' + item_update_succeed)
    return
Пример #10
0
async def run_script(session: CommandSession):
    global lastCall
    if time() - lastCall <= COOLDOWN:
        await session.send(f'技能冷却中…… ({COOLDOWN}s)')
        return
    log.logger.debug(
        f'user {session.event["user_id"]} is trying to run a script')
    code: str = session.get('code')
    async with async_timeout.timeout(300):
        try:
            await runScriptLang(code, session)
        except asyncio.CancelledError:
            await session.send('任务超时,已经停止.', at_sender=True)
        finally:
            lastCall = time()
Пример #11
0
def wikipedia(session: CommandSession):
    keyword = session.get("keyword")
    session.send(f"开始Wiki搜索:{keyword}")
    pages = getWiki(keyword)["query"]["pages"]
    finalResult = {"keyword": keyword, "size": len(pages)}
    finalResult["result"] = []
    for page in pages.values():
        finalResult["result"].append(
            {
                "title": page["title"],
                "introduce": page["extract"],
                "link": NetworkUtils.shortLink([page["fullurl"]])[page["fullurl"]],
            }
        )
    repeatMessage = [
        str(CONFIG_READ.customize.repeat).format(**result)
        for result in finalResult["result"]
    ]
    fullMessage = (
        str(CONFIG_READ.customize.prefix).format(**finalResult)
        + "".join(repeatMessage[: CONFIG_READ.size])
        + str(CONFIG_READ.customize.suffix).format(**finalResult)
    )
    return fullMessage
Пример #12
0
async def ban_someone(session: nonebot.CommandSession):
    ctx = session.ctx.copy()
    if get_privilege(ctx['user_id'], perm.ADMIN):
        try:
            user_id = int(session.get('user_id', prompt='请输入要封禁的qq'))
        except ValueError:
            await session.send('输入非QQ号,发生错误!')
            return

        user_control_module.set_user_privilege(str(user_id), 'BANNED', True)
        await session.send('Done!!')

    else:
        await session.send('您无权进行该操作')
        return
Пример #13
0
async def delete_admin(session: nonebot.CommandSession):
    ctx = session.ctx.copy()
    if not get_privilege(ctx['user_id'], perm.OWNER):
        await session.finish('您无权使用该功能')

    user_id = session.get('user_id', prompt='请输入要添加的qq号')
    try:
        user_id = int(user_id)
    except ValueError:
        await session.send('主人啊,这是数字么?')
        return

    user_control_module.set_user_privilege(user_id, 'ADMIN', False)
    user_control_module.set_user_privilege(user_id, 'WHITELIST', False)
    await session.send('移除完成')
Пример #14
0
async def _(session: CommandSession):
    stripped_arg = session.current_arg_text.strip()
    if session.is_first_run:
        match = re.match(r'^(\d+)(?:\-(\d+)(?:\-(\d+))?)?$', stripped_arg)
        if match:
            year = match.group(1)
            month = match.group(2)
            day = match.group(3)
            if year:
                year = int(year)
            if month:
                month = int(month)
            if day:
                day = int(day)
            session.state['year'] = year
            session.state['month'] = month
            session.state['day'] = day
        return

    if not stripped_arg:
        session.pause('你什么都不输入我怎么知道呢!')

    # 检查输入参数是不是数字
    session.state[session.current_key] = to_number(stripped_arg, session)
Пример #15
0
async def EMMAAAA(session: CommandSession):
    global RepoList
    h_type = session.event.detail_type
    msg = session.current_arg.strip()
    user = session.event.user_id
    group = session.event.group_id

    if not msg:
        msg = session.get('message', prompt='请键入需要反馈的信息')

    RepoList.append(user)

    if countX(RepoList, user) == 5:
        session.finish('您今天已经喝了5杯红茶啦!明天再来吧!')

    if h_type == 'group':
        await bot.send_private_msg(
            user_id=master,
            message=f"来自群[{group}],用户[{user}]的反馈:\n{msg}")  # type: ignore

    elif h_type == 'private':
        await bot.send_private_msg(user_id=master,
                                   message=f"来自用户[{user}]的反馈:\n{msg}"
                                   )  # type: ignore
Пример #16
0
async def music(session: CommandSession):
    # 和炸毛互动
    if session.ctx['message_type'] == 'group' and \
            session.bot.config.GROUPS_TO_PLAY_WITH_ZHAMAO and \
            session.ctx['group_id'] in \
            session.bot.config.GROUPS_TO_PLAY_WITH_ZHAMAO and \
            not session.get_optional('from_nlp'):
        ts = int(time.time() / 30)
        if ts % 2 == 1:  # 奇数炸毛发,奶茶附和
            await asyncio.sleep(2)
            session.finish('炸毛哥哥已经回复你啦~')

    keyword = session.get('keyword', prompt='你想听什么歌呢?')
    song_id = await search_song_id(keyword)
    if song_id is None:
        session.finish('没有找到这首歌呢')
    session.finish(MessageSegment.music('qq', song_id))
Пример #17
0
async def lib_command(session: CommandSession):
    lib_name = session.get_optional('lib')
    if not lib_name:
        message = "标准库链接:\n镜像链接:{}\n官方链接:{}".format(LOCAL_LIB_URL, LIB_URL)
        await session.send(message)
        return
    lib = find_lib(lib_name)
    if lib:
        message = "{}链接:{}".format(
            lib.comment, lib.url.replace(DOC_ROOT_URL, LOCAL_DOC_ROOT_URL))
        await session.send(message)
    else:
        # message = await spider_third_lib(lib_name)
        message = "未找到"
        await session.send(message)
Пример #18
0
async def weather_command(session: CommandSession):
    location = session.get('location', prompt=expr(e.WHERE))
    if location.province and not location.city and not location.district:
        # there is no city or district, ask the user for more info!
        if 'location_more' in session.state:
            del session.state['location_more']
        session.get('location_more',
                    prompt=expr(e.WHERE_IN_PROVINCE, location.province))

    logger.debug(f'Location: {location}')
    final_loc = location.heweather_format()
    weathers = await get_weather(final_loc)
    if len(weathers) > 1:
        await session.send(f'查询到 {len(weathers)} 个同名地区')
    elif len(weathers) == 0:
        session.finish(f'没有查询到{location.short_format()}的天气哦')

    for weather in weathers:
        basic = weather['basic']
        location_name = basic['admin_area']
        if basic['admin_area'] != basic['parent_city']:
            location_name += basic['parent_city']
        if basic['parent_city'] != basic['location']:
            location_name += basic['location']
        report_now = expr(e.REPORT_NOW, **weather['now'])
        report_today = expr(e.REPORT_FUTURE_DAY, '今天',
                            **weather['daily_forecast'][0])
        report_tomorrow = expr(e.REPORT_FUTURE_DAY, '明天',
                               **weather['daily_forecast'][1])
        report_after_tomorrow = expr(e.REPORT_FUTURE_DAY, '后天',
                                     **weather['daily_forecast'][2])
        await session.send(f'{location_name}\n\n'
                           f'{report_now}\n\n'
                           f'{report_today}\n\n'
                           f'{report_tomorrow}\n\n'
                           f'{report_after_tomorrow}')
Пример #19
0
async def CurriculumSchedule(session: CommandSession):
    localtime = datetime.now()
    if 'from_schedule' in session.args.keys():
        result = "☕ 以下课程即将开始上课:\n"
    else:
        result = "课程信息:\n"
    if 'week' not in session.args.keys() and \
            'weekday' not in session.args.keys() and \
            'classnums' not in session.args.keys() and \
            'next_class' not in session.args.keys():
        session.get('classnums', prompt='你要查询今天的第几节课?')

    if 'weekday' not in session.args.keys():
        session.args['weekday'] = localtime.weekday()
    if 'week' not in session.args.keys():
        session.args['week'] = get_session_week(localtime)

    if 'group_id' not in session.ctx.keys():
        group_id = await get_user_group(session.ctx['user_id'])
    else:
        group_id = session.ctx['group_id']

    result += await ClassInfo(**session.args, group_id=group_id,)
    await session.send(result)
Пример #20
0
async def sign_in(session: CommandSession):
    ctx_id = context_id(session.ctx, mode='user')
    my_data = data[ctx_id]

    today = date.today()
    if my_data['last_signin_date'] and \
            today - my_data['last_signin_date'] < timedelta(days=1):
        session.finish('你今天已经签过到啦\n明天再来吧~')

    my_data['last_signin_date'] = today
    my_data['signin_count'] += 1

    earned = random.randint(1, 100)
    data[ctx_id]['wealth'] += earned

    url = QQ_AVATAR_URL_FORMAT.format(session.ctx['user_id'])
    reply = str(MessageSegment.image(url))

    if session.ctx['message_type'] != 'private':
        reply += '\n' + str(MessageSegment.at(session.ctx['user_id']))

    reply += f'\n你已经累计签到了{my_data["signin_count"]}次\n' \
        f'本次签到获得了{earned}个金币~'
    session.finish(reply)
Пример #21
0
async def alarm(session: CommandSession):
    time: datetime = session.get("time")
    target: str = session.get("target")

    # 过滤时间
    now = datetime.now()
    # 过去的时间
    if time <= now:
        session.finish(render_expression(EXPR_COULD_NOT))

    time_str = time.strftime("%Y-%m-%d %H:%M:%S")
    await add_job(
        remind,
        trigger="date",
        run_date=time,
        id=make_job_id(
            PLUGIN_NAME,
            session.event,
            (random_string(1, string.ascii_lowercase) +
             random_string(7, string.ascii_lowercase + string.digits)),
        ),
        args=[target, session.event],
        kwargs={"remark": target},
    )
    cmd, current_arg = CommandManager().parse_command(session.bot, target)
    if cmd:
        tmp_session = CommandSession(session.bot,
                                     session.event,
                                     cmd,
                                     current_arg=current_arg)
        if await cmd.run(tmp_session, dry=True):
            await add_scheduled_commands(
                ScheduledCommand(cmd.name, current_arg),
                job_id=make_job_id(
                    PLUGIN_NAME,
                    session.event,
                    (random_string(1, string.ascii_lowercase) +
                     random_string(7, string.ascii_lowercase + string.digits)),
                ),
                event=session.event,
                trigger="date",
                run_date=time,
                replace_existing=True,
            )

    session.finish(
        render_expression(
            EXPR_OK, time=time_str, action=target, escape_args=False) +
        f"\n提醒创建成功:\n"
        f"> 提醒时间:{time_str}\n"
        f"> 内容:{target}")
Пример #22
0
async def _(session: CommandSession):
    args = session.current_arg_text.strip().split()
    if len(args) == 1:
        session.state['type'] = 'geocoding'
        session.state['addr'] = args[0]
    elif len(args) == 2:
        session.state['type'] = 'place'
        session.state['query'], session.state['region'] = args
    else:
        session.finish('参数格式错误!')
Пример #23
0
async def Medusa(session: CommandSession):
    city = session.get('city', prompt='呐呐呐!对方的域名呐?')
    Url = city[7:]
    user_qq_id = session.self_id  #获取用户QQ
    url_refining = tldextract.extract(Url)
    if url_refining.suffix != "" and url_refining.domain != "":  #判断提炼出来的东西是否符合二级域名
        token = hashlib.md5(
            str(user_qq_id).encode("utf-8")).hexdigest()  #获取对方QQ的MD5加密
        await session.send("您的Key:" + token + "\r\n您的目标:" + Url)
        medusa_scan_success = await MedusaScan(Url, token)
        if medusa_scan_success == "1":
            #message.MessageSegment.at(user_qq_id)
            await session.send(message.MessageSegment.at(user_qq_id)
                               )  #艾特用户表示扫描完成科研查询了
    else:
        await session.send("")
Пример #24
0
async def entertain_switch(session: nonebot.CommandSession):
    ctx = session.ctx.copy()
    id_num = str(ctx['user_id'])
    if not get_privilege(id_num, perm.WHITELIST):
        await session.finish('您无权进行该操作')

    group_id = session.get('group_id', prompt='请输入要禁用所有功能的qq群')
    if not str(group_id).isdigit():
        await session.finish('这不是qq号哦~')

    if admin_control.get_data(group_id, 'enabled'):
        admin_control.set_data(group_id, 'enabled', False)
        await session.finish('已禁用娱乐功能!')
    else:
        admin_control.set_data(group_id, 'enabled', True)
        await session.finish('已开启娱乐功能!')
Пример #25
0
async def av_validator(session: nonebot.CommandSession):
    ctx = session.ctx.copy()
    if get_privilege(ctx['user_id'], perm.BANNED):
        await session.finish('略略略,我主人把你拉黑了。哈↑哈↑哈')

    if not admin_control.get_data(ctx['group_id'], 'R18'):
        await session.finish('请联系BOT管理员开启本群R18权限')

    key_word = session.get('key_word', prompt='在?你要让我查什么啊baka')
    validator = shadiao.Avalidator(text=key_word)
    await validator.get_page_text()
    if 'group_id' in ctx:
        sanity_meter.set_usage(ctx['group_id'], tag='yanche')
        sanity_meter.set_user_data(ctx['user_id'], 'yanche')

    await session.finish(await validator.get_content())
Пример #26
0
async def weather(session: CommandSession):
    city: str = session.get('city')
    isChinese: bool = util.isChinese(city)

    # AMAP
    if isChinese and util.isAmapSupported(city):
        weatherReport = await amap_weather(city)
    # OpenWeatherMap (delete block if you do not need)
    else:
        # openweathermap needs an English city name
        city = (city, util.translate2Eng(city))[isChinese]
        weatherReport = await openweathermap_weather(city)
    
    #log.logger.debug(city)
    await session.send(weatherReport)
    log.logger.debug(f'weather called: {weatherReport[:20]}...')
Пример #27
0
async def user_find_item(session: CommandSession):
    key_word = session.get('key_word', prompt=message.find_item.item_name_msg)
    if '全部' in key_word or '所有' in key_word:
        key_word = None
    if 'page' not in session.args.keys():
        session.args['page'] = 1

    if 'type' not in session.args.keys():
        session.args['type'] = "sell"
    if not 'continue' in session.args.keys():
        msg = await print_item_list_from_keys(key_word, session.args['page'],
                                              session.args['type'])
        await session.send(msg + message.find_item.item_list_msg)
        session.args['continue'] = True
    while True:
        cmd = session.get('cmd')
        if '下一页' in cmd or 'n' in cmd:
            session.args['page'] += 1
            session.args.pop('cmd')
            try:
                session.args.pop('continue')
            except Exception:
                pass
            await user_find_item(session)
            return
        elif '上一页' in cmd or 'n' in cmd:
            session.args['page'] -= 1
            session.args.pop('cmd')
            try:
                session.args.pop('continue')
            except Exception:
                pass
            await user_find_item(session)
            return
        else:
            try:
                id = int(cmd[0])
            except Exception:
                await session.send("已退出本次会话,请 @我 输入指令信息")
                session.finish()
                return
            await session.send(await print_item_info(id) +
                               message.find_item.item_detail_more)
            session.args.pop('cmd')
            session.args['continue'] = True
Пример #28
0
async def add_blacklist_word(session: nonebot.CommandSession):
    key_word = session.get('key_word', prompt='要加什么进来呢?')
    ctx = session.ctx.copy()
    if not get_privilege(ctx['user_id'], perm.OWNER):
        await session.finish('您无权使用本命令')

    keyWords = key_word.split()

    if len(keyWords) != 2:
        await session.finish('参数有误。应为!添加拉黑词 关键词 理智消耗倍数')

    try:
        sanity_meter.add_bad_word_dict(keyWords[0], int(keyWords[1]))
        await session.finish('Done!')
    except ValueError:
        await session.finish('第二输入非数字。')
Пример #29
0
async def call_admin(session: CommandSession):

    user_id = session.event['user_id']

    info = session.get('info', prompt='请输入要发送的消息')
    logger.info("Get Information: {} from ID: {}".format(info, user_id))

    sender_info = "\n\n——@{}({}) | {}".format(
        session.event['sender']['nickname'], user_id,
        time.strftime("%Y-%m-%d", time.localtime(session.event['time'])))

    await helpers.send_to_superusers(nonebot.get_bot(),
                                     message=("Message received:\n\n   " +
                                              info + sender_info))
    await session.send("消息发送成功 :)")
    logger.info("Send message to admin successfully")
Пример #30
0
async def game(session: CommandSession):
    question = init_game()
    message = session.get(
        'message',
        prompt='舰长想玩24点游戏了吗,用我给的4个数字通过加减乘除算出24点就是舰长赢了哦\n(๑> ₃ <)' +
        '这次的4个数字是:' + question + '\n舰长做完记得@我回复完整的表达式哦,觉得无解的话回复“end”可以结束游戏。')
    nickname = session.ctx.sender.get('nickname')
    response = ''
    game_result = await wait_for_judge(message)
    if game_result == 1:
        response = nickname + '舰长答对了,真是太厉害了!\n(●・◡・●)ノ♥'
    elif game_result == 2:
        response = nickname + '舰长结束了游戏。'
    else:
        response = nickname + '舰长答错了,游戏结束,下次要加油哦。'
    await session.send(response)