async def handle_short(bot: Bot, event: GroupMessageEvent, state: T_State): group = state["_matched_dict"] number = int(group["number"]) full_name = get_group_bind_repo(str(event.group_id)) if not full_name: await issue_short.finish("此群尚未与仓库绑定!") return match = re.match(REPO_REGEX, full_name) if not match: await issue_short.finish("绑定的仓库名不合法!请重新尝试绑定~") owner = match.group("owner") repo = match.group("repo") token = None if get_user_token: token = get_user_token(event.get_user_id()) try: issue_ = await get_issue(owner, repo, number, token) except HTTPStatusError: await issue.finish(f"Issue #{number} not found for repo {owner}/{repo}" ) return img = await issue_to_image(issue_) if img: await send_github_message( issue_short, owner, repo, number, MessageSegment.image(f"base64://{base64.b64encode(img).decode()}"))
async def _deal_fake(bot: Bot, event: GroupMessageEvent, state: T_State): content = state["content"] group_id = event.group_id user_id = event.get_user_id() node = Funny().fake_msg(content) await bot.send_group_forward_msg(group_id=group_id, messages=node) _fake_flmt.start_cd(user_id) _fake_daliy_max.increase(user_id)
async def _ready_fake(bot: Bot, event: GroupMessageEvent, state: T_State): user_id = event.get_user_id() if not _fake_daliy_max.check(user_id): await fake_msg.finish(_fake_max_notice) if not _fake_flmt.check(user_id): await fake_msg.finish(_fake_flmt_notice) msg = str(event.message).strip() if msg: state["content"] = msg
async def _(bot: Bot, event: GroupMessageEvent): tem = str(event.get_message()) qid = re.findall(r"\d+", tem)[0] print(qid) if event.get_user_id() in nonebot.get_driver().config.superusers: try: mid = readJson()[qid][1] except Exception as e: print(e) await withdraw.finish('只能撤回他最后一次涩图') return await bot.delete_msg(message_id=mid) else: await withdraw.finish('你没有权利撤回哦')
async def h_r(bot: Bot, event: GroupMessageEvent, state: T_State): id_ = event.get_user_id() at_ = "[CQ:at,qq={}]".format(id_) msg = at_ + '你最帅,帅的一批' msg = Message(msg) await test.finish(msg)
async def _(bot: Bot, event: GroupMessageEvent, state: T_State): state["at"] = MessageSegment.at(event.get_user_id()) state["test"] = "test" # message: /template {at} hello {test}! ft = event.message.template(event.message) await template.send(ft)