Exemplo n.º 1
0
async def voiceguess(bot, ev: CQEvent):

    if ev['message_type'] != 'group':
        await bot.send(ev, '小游戏仅支持群组游玩,好孩子要学会和伙伴一起玩哦~')
        return

    try:
        gid = str(ev.group_id)
        if _group_game[gid]:
            await bot.send(ev, '游戏进行中,好孩子要学会耐心等候哦~')
            return
        _group_game[gid] = 'voiceguess'
        voice = random.choice(os.listdir(voicepath))
        voice_id = int('1' + re.compile(
            r'^vo_title_(customize_)?(\d{4}).*').match(voice).group(2)[-3:])
        c = chara.fromid(voice_id)
        _group_parameter[gid] = voice_id

        await bot.send(ev, f'猜猜这个语音来自哪位角色? ({ONE_TURN_TIME}s后公布答案)')
        await bot.send(ev, R.record(f"title_silk/{voice}").cqcode)
        glmt.start_cd(gid)
        await asyncio.sleep(ONE_TURN_TIME)
        msg = [f'锵锵,正确答案是: \n{c.icon.cqcode}{c.name}']
        if not _group_winner[gid]:
            msg.append('很遗憾,没有人答对呢~')
            await bot.send(ev, '\n'.join(msg))
        else:
            _group_winner[gid] = list(set(_group_winner[gid]))
            msg.append(f'ヤバイですね!一共有{len(_group_winner[gid])}人答对,他们是:')
            for n in _group_winner[gid]:
                msg.append(str(n))
            await bot.send(ev, '\n'.join(msg))
    except Exception as e:
        logger.error(f'{e}')
        await bot.send(ev, '佩可似乎出错了o(╥﹏╥)o,快联系主人来看看吧~')
    del _group_game[gid]
    del _group_winner[gid]
Exemplo n.º 2
0
async def chat_pahu(bot, ev):
    return
    await bot.send(ev, R.record(f"pahu/{random.randint(1, 3)}.m4a").cqcode)
Exemplo n.º 3
0
async def chat_liantong(bot, ev):
    await bot.send(ev, R.record('hentai.wav').cqcode)