event.user_id) if passive: operator_info = await bot.get_group_member_info( group_id=event.group_id, user_id=event.operator_id) operator_name = operator_info["card"] or operator_info[ "nickname"] or str(event.operator_id) msg = f'{operator_name}撤回了被{litigant_name}掌握的{fake_id}号援交证据!' else: msg = f'{litigant_name}撤回了{ta_map[litigant_info["sex"]]}的{fake_id}号援交记录!' await recall_trigger.finish(msg) recorder = antirecall.on_endswith( '号记录是什么', rule=sv_sw(plugin_name, plugin_usage, hierarchy='其它') & comman_rule(GroupMessageEvent)) @recorder.handle() async def show_record(bot: Bot, event: GroupMessageEvent): arg = str(event.message).split('号记录')[0] if not arg.isdigit(): await recorder.finish(reply_header(event, '哪有这种代号的记录啊?!')) fake_id = int(arg) if fake_id not in recalled[event.group_id]: await recorder.finish(reply_header(event, '这条记录不存在或者因为太久所以被消除了~')) msg_id, passive, timestamp = recalled[event.group_id][fake_id] try: msginfo = await bot.get_msg(message_id=msg_id) logger.debug(
from nonebot.adapters.cqhttp.message import MessageSegment from nonebot.adapters.cqhttp.event import GroupMessageEvent from nonebot.adapters.cqhttp.permission import GROUP from omega_miya.utils.Omega_plugin_utils import has_command_permission, permission_level from .resources import MiyaVoice """ miya按钮bot实现版本 测试中 """ button = MatcherGroup(type='message', rule=to_me() & has_command_permission() & permission_level(level=10), permission=GROUP, priority=100, block=False) miya_button = button.on_endswith(msg='喵一个') @miya_button.handle() async def miya_button(bot: Bot, event: GroupMessageEvent, state: T_State): arg = str(event.get_plaintext()).strip().lower() voice = re.sub('喵一个', '', arg) voice_file = MiyaVoice().get_voice_filepath(voice=voice) if not os.path.exists(voice_file): await bot.send(event=event, message='喵?') else: msg = MessageSegment.record(file=f'file:///{voice_file}') await bot.send(event=event, message=msg)