def flash(self) -> MessageSegment: if hoshino.config.RES_PROTOCOL == 'http': return MessageSegment(type_='image', data={'url': self.url, 'type': 'flash'}) elif hoshino.config.RES_PROTOCOL == 'file': return MessageSegment(type_='image', data={'file': f'file:///{os.path.abspath(self.path)}', 'type': 'flash'}) else: return MessageSegment.text('[图片出错]')
def gacha_info(pool=DEFAULT_POOL): # 重载卡池数据,然后返回UP角色信息 init_role_arms_list() # 重新载入config.json的卡池数据 info_txt = f'当前卡池为 {pool} ,UP信息如下:\n' _5_star_up_info = POOL[pool]["5星up"] _4_star_up_info = POOL[pool]["4星up"] up_info = "" for _5_star in ROLE_ARMS_LIST[_5_star_up_info]: im = Image.open(Gacha.get_png_path(_5_star)) im = Gacha.pic2b64(im) up_info += str(MessageSegment.image(im)) up_info += "\n" up_info += f"{_5_star} ★★★★★" for _4_star in ROLE_ARMS_LIST[_4_star_up_info]: im = Image.open(Gacha.get_png_path(_4_star)) im = Gacha.pic2b64(im) up_info += str(MessageSegment.image(im)) up_info += "\n" up_info += f"{_4_star} ★★★★" if up_info == "": # 如果up_info是空的,表示当前是常驻池没有UP up_info += "常驻池没有UP" info_txt += up_info return info_txt
async def gacha_10(session: CommandSession): SUPER_LUCKY_LINE = 170 uid = session.ctx['user_id'] at = str(MessageSegment.at(session.ctx['user_id'])) if not check_gacha_num(uid): await session.finish(f'{at} {GACHA_EXCEED_NOTICE}') _user_gacha_count[uid] += 1 gacha = Gacha() result, hiishi = gacha.gacha_ten() silence_time = hiishi * 6 if hiishi < SUPER_LUCKY_LINE else hiishi * 60 if get_bot().config.IS_CQPRO: res1 = Chara.gen_team_pic(result[:5], star_slot_verbose=False) res2 = Chara.gen_team_pic(result[5:], star_slot_verbose=False) res = concat_pic([res1, res2]) res = pic2b64(res) res = MessageSegment.image(res) result = [f'{c.name}{"★"*c.star}' for c in result] res1 = ' '.join(result[0:5]) res2 = ' '.join(result[5:]) res = res + f'{res1}\n{res2}' else: result = [f'{c.name}{"★"*c.star}' for c in result] res1 = ' '.join(result[0:5]) res2 = ' '.join(result[5:]) res = f'{res1}\n{res2}' await silence(session.ctx, silence_time) msg = f'{at}\n素敵な仲間が増えますよ!\n{res}' await session.send(msg) if hiishi >= SUPER_LUCKY_LINE: await session.send('恭喜海豹!おめでとうございます!')
async def cough(session: CommandSession): session.finish('请见丁香园: https://ncov.dxy.cn/ncovh5/view/pneumonia') name = session.current_arg_text if name: # look up province or city # data = nCoV2019.get_status(name) # if not data: # return "未知省市" # info = '\n'.join([f"{city['cityName']} 确诊{city['confirmedCount']}例" for city in data['cities'] ]) # text = f"新型冠状病毒肺炎疫情\n{info}\n💊 全国疫情 → t.cn/A6v1xgC0" # await session.send(text) await session.finish('省市查询维护中...') else: # show overall if not nCoV2019.cache['overall']: await nCoV2019.get_overall() data = nCoV2019.cache['overall'] if data: data['updateTimeStr'] = datetime.fromtimestamp( data['updateTime'] / 1000).strftime(r'%Y-%m-%d %H:%M') data['pic1'] = MessageSegment.image(data['dailyPics'][0]) # 新增图 data['pic2'] = MessageSegment.image(data['dailyPics'][2]) # 累积图 data['pic3'] = MessageSegment.image(data['dailyPics'][3]) # 治愈死亡图 text = "新型冠状病毒肺炎疫情\n更新时间:{updateTimeStr}\n确诊{confirmedCount}例(+{confirmedIncr})\n疑似{suspectedCount}例(+{suspectedIncr})\n重症{seriousCount}例(+{seriousIncr})\n死亡{deadCount}例(+{deadIncr})\n治愈{curedCount}例(+{curedIncr})\n{pic1!s}{pic2!s}{pic3!s}\n更多请见丁香园:ncov.dxy.cn/ncovh5/view/pneumonia".format( **data) await session.send(text) else: await session.send('查询出错')
def cqcode(self) -> MessageSegment: if hoshino.config.RES_PROTOCOL == 'http': return MessageSegment.record(self.url) elif hoshino.config.RES_PROTOCOL == 'file': return MessageSegment.record(f'file:///{os.path.abspath(self.path)}') else: return MessageSegment.text('[不支持的协议]')
async def _(session: CommandSession): account = session.state['account'] today = dt.beijing_now().date() if account.last_sign_in_date and \ today - account.last_sign_in_date < timedelta(days=1): session.finish('签到系统正处于删档测试阶段。你今天已经签过到啦\n明天再来吧~') last_sign_in_date = today total_sign_in = account.total_sign_in + 1 earned = random.randint(1, 100) total_coins = account.total_coins + earned succeeded = await da.update( account, last_sign_in_date=last_sign_in_date, total_sign_in=total_sign_in, total_coins=total_coins, ) if not succeeded: session.finish('签到失败,请稍后再试~') reply = str(MessageSegment.image(account.avatar_url)) if session.ctx['message_type'] != 'private': reply += '\n' + str(MessageSegment.at(session.ctx['user_id'])) reply += f'\n你已经累计签到了 {total_sign_in} 次\n' \ f'本次签到获得了 {earned} 个金币~' session.finish(reply)
async def _(session: NoticeSession): user_id = session.ctx.get('user_id') msg = MessageSegment.at(session.ctx['user_id']) + ' ' + MessageSegment.text( '欢迎新进群的小伙伴:\n并仔细阅读本群【所有公告】和【帮助文档】,进群先看【群文件和群相册】,看完有问题再问,为了让你安心看群文件,先禁言三分钟哈~请见谅') msg = f'[CQ:at, qq = {user_id}]' +'\n'+msg await session.send(msg) await bot.set_group_ban(group_id=session.ctx['group_id'], user_id=session.ctx['user_id'], duration=180)
async def _(session: NoticeSession): msg = MessageSegment.at(session.ctx['user_id']) + ' ' + MessageSegment.text( '欢迎新进群的小伙伴:\n请按照群公告的要求改好自己的【群名片】,并仔细阅读本群【所有公告】和【2019帮助文档】,进群先看【群文件和群相册】,看完有问题再问,为了让你安心看群文件,先禁言三分钟哈~请见谅' ) await session.send(msg) await bot.set_group_ban(group_id=session.ctx['group_id'], user_id=session.ctx['user_id'], duration=180)
def cqcode(self) -> MessageSegment: if get_bot().config.RESOURCE_URL: return MessageSegment.image(self.url) else: try: return MessageSegment.image(pic2b64(self.open())) except Exception as e: logger.exception(e) return MessageSegment.text('[图片]')
def cqcode(self) -> MessageSegment: if get_bot().config.RESOURCE_URL: return MessageSegment.image(self.url) else: try: return MessageSegment.image('file:///' + self.path) except Exception as e: logger.exception(e) return MessageSegment.text('[图片]')
async def query_blacklist(session, bot): msg = M() if BLACKLIST['user']: msg.append( MS.text( f'用户黑名单:{",".join([str(i) for i in BLACKLIST["user"]])}。\n')) if BLACKLIST['group']: msg.append( MS.text(f'群黑名单:{",".join([str(i) for i in BLACKLIST["group"]])}。')) await session.send(msg)
def cqcode(self) -> MessageSegment: if hoshino.config.RES_PROTOCOL == 'http': return MessageSegment.image(self.url) elif hoshino.config.RES_PROTOCOL == 'file': return MessageSegment.image(f'file:///{os.path.abspath(self.path)}') else: try: return MessageSegment.image(util.pic2b64(self.open())) except Exception as e: hoshino.logger.exception(e) return MessageSegment.text('[图片出错]')
async def kuangwo(bot, event): uid = event.user_id url = 'https://chp.shadiao.app/api.php' txt = requests.get(url=url, timeout=10).text msg = MessageSegment(type_='text', data={'text': txt}) await bot.send(event, msg, at_sender=True) if not lmt.check(uid): return lmt.increase(uid) giftlist = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] gift = random.choice(giftlist) sendgift = MessageSegment(type_='gift', data={'qq': uid, 'id': gift}) await bot.send(event, sendgift)
async def avatar_guess(bot, ev: CQEvent): try: uid = ev.user_id if winner_judger.get_on_off_status(ev.group_id): await bot.send(ev, "此轮游戏还没结束,请勿重复使用指令") return if not lmt.check(uid): await bot.send(ev, '您今天已经玩了10次猜群友了,休息一下,明天再来吧!', at_sender=True) return lmt.increase(uid) winner_judger.turn_on(ev.group_id) user_card_dict = await get_user_card_dict(bot, ev.group_id) user_id_list = list(user_card_dict.keys()) while True: random.shuffle(user_id_list) if user_id_list[0] !=ev.self_id: break winner_judger.set_correct_chara_id(ev.group_id, user_id_list[0]) dir_path = os.path.join(os.path.expanduser(hoshino.config.RES_DIR), 'img', 'memavatar') if not os.path.exists(dir_path): os.makedirs(dir_path) apiPath=f' http://q1.qlogo.cn/g?b=qq&nk={user_id_list[0]}&s=100' img = requests.get(apiPath, timeout=20).content ava_path = os.path.join(dir_path, f'{ev.group_id}_memavatar.png') with open(ava_path, 'wb') as f: f.write(img) avaimg = R.img(f'{os.path.abspath(ava_path)}').open() avaimage = MessageSegment.image(f'file:///{os.path.abspath(ava_path)}') left = math.floor(random.random() * (100 - PIC_SIDE_LENGTH)) upper = math.floor(random.random() * (100 - PIC_SIDE_LENGTH)) cropped = avaimg.crop((left, upper, left + PIC_SIDE_LENGTH, upper + PIC_SIDE_LENGTH)) file_path = os.path.join(dir_path, f'{ev.group_id}_cropped_memavatar.png') cropped.save(file_path) image = MessageSegment.image(f'file:///{os.path.abspath(file_path)}') msg = f'猜猜这个图片是哪位群友头像的一部分?({ONE_TURN_TIME}s后公布答案){image}' await bot.send(ev, msg) await asyncio.sleep(ONE_TURN_TIME) if winner_judger.get_winner(ev.group_id) != '': winner_judger.turn_off(ev.group_id) return msg = f'正确答案是: {user_card_dict[user_id_list[0]]}{avaimage}\n很遗憾,没有人答对~' winner_judger.turn_off(ev.group_id) await bot.send(ev, msg) except Exception as e: winner_judger.turn_off(ev.group_id) await bot.send(ev, '错误:\n' + str(e))
async def xcw_jiaochuan(bot, ev) -> MessageSegment: roll = random.random() if roll <= 0.05: filename = '喘息声.mp3' file = R.get('img/xcw/record', filename) try: rec = MessageSegment.record( f'file:///{os.path.abspath(file.path)}') await bot.send(ev, rec) except CQHttpError: sv.logger.error("发送失败") elif 0.05 < roll <= 0.15: file = get_xcw_biantai() try: rec = MessageSegment.record( f'file:///{os.path.abspath(file.path)}') await bot.send(ev, rec) except CQHttpError: sv.logger.error("发送失败") elif 0.15 < roll <= 0.4: filename = '叹气声.mp3' file = R.get('img/xcw/record', filename) try: rec = MessageSegment.record( f'file:///{os.path.abspath(file.path)}') await bot.send(ev, rec) except CQHttpError: sv.logger.error("发送失败") elif 0.4 < roll <= 0.75: filename = '叹气声2.mp3' file = R.get('img/xcw/record', filename) try: rec = MessageSegment.record( f'file:///{os.path.abspath(file.path)}') await bot.send(ev, rec) except CQHttpError: sv.logger.error("发送失败") elif 0.75 < roll <= 0.95: filename = '叹气声2.mp3' file = R.get('img/xcw/record', filename) try: rec = MessageSegment.record( f'file:///{os.path.abspath(file.path)}') await bot.send(ev, rec) except CQHttpError: sv.logger.error("发送失败") else: await bot.send(ev, '我懂了你是变态吧~', at_sender=True)
async def random_echo(bot, event): echo_folder = R.get('record/echo/').path files = os.listdir(echo_folder) filename = random.choice(files) file = R.get('record/echo/', filename) rec = MessageSegment.record(f'file:///{os.path.abspath(file.path)}') await bot.send(event, rec)
async def pixiv(session: CommandSession): send = True params = { # "apikey":"", "r18": 0, "keyword": "", "size1200": True } params['keyword'] = session.current_arg_text.split() try: web = requests.get('https://api.lolicon.app/setu/', params=params).json() if web['code'] != 0: await session.send(web['msg']) else: await session.send( f"PID:{str(web['data'][0]['pid'])}\n若图片发不出来请自行查看") web_image = requests.get(web['data'][0]['url'], timeout=10) if web_image.status_code == 200: with open(path + r"\Pixiv.jpg", "wb") as f: f.write(web_image.content) await session.send( str(MessageSegment.image("file:///" + path + r"\Pixiv.jpg"))) except: pass session.finish()
async def send_time_dist(bot, event): gid = event['group_id'] year, month = get_ym() try: name, times = get_time(gid, year, month) except Exception as e: await bot.send(event, f"出现错误: {str(e)}\n请联系开发组调教。") return plt.rcParams['axes.unicode_minus'] = False prop = fm.FontProperties(fname=font_path) prop.set_size('large') fig, ax = plt.subplots(figsize=(12, 6), facecolor='white') ax.set_xlabel('时间', fontproperties=prop) ax.set_ylabel('刀数', fontproperties=prop) ax.set_title(f'{name}{year}年{month}月会战出刀时间统计', fontproperties=prop) ax.set_xlim((0 - 0.5, 24)) ax.spines['top'].set_visible(False) ax.spines['right'].set_visible(False) colors = (['#808080'] * 6) + (['#9bc5af'] * 6) + (['#c54731'] * 6) + (['#3a4a59'] * 6) labels = list(range(5, 24)) + list(range(5)) labels = [str(s) for s in labels] plt.xticks(range(24), labels, fontproperties=prop) plt.bar(range(24), times, color=colors) pic = fig2b64(plt) plt.close() await bot.send(event, ms.image(pic))
async def longwang(session): global imgbase_path uid = session.ctx['user_id'] if not _nlmt.check(uid): await session.send(EXCEED_NOTICE, at_sender=True) return if not _flmt.check(uid): await session.send('龙王她生气了,并堵上了你的嘴', at_sender=True) return _flmt.start_cd(uid) gid = session.ctx['group_id'] dragon_king = await session.bot.get_group_honor_info(group_id=gid, type='talkative') if not 'current_talkative' in dragon_king: await session.send('本群暂时还没有龙王哦……', at_sender=True) return dragon_king = dragon_king['current_talkative']['user_id'] dir_list = os.listdir(imgbase_path) img_path = path.join(imgbase_path, random.choice(dir_list)) count = 0 while os.path.isdir(img_path) == True: img_path = path.join(imgbase_path, random.choice(dir_list)) count += 1 if count % 5 == 0: hoshino.logger.error('缺少龙王图片资源或目录下文件夹过多') return longwang_img = R.img(img_path).open() longwang_img_message = MessageSegment.image(pic2b64(longwang_img)) reply = random.choice(['龙王出来挨透', '龙王出来喷水']) _nlmt.increase(uid) await session.finish( f'[CQ:at,qq={dragon_king}]\n{reply}\n{longwang_img_message}')
async def avatar_guess(bot, ev: CQEvent): try: if winner_judger.get_on_off_status(): await bot.send(ev, "此轮游戏还没结束,请勿重复使用指令") return winner_judger.turn_on() chara_id_list = list(_pcr_data.CHARA_NAME.keys()) while True: random.shuffle(chara_id_list) if chara_id_list[0] not in BLACKLIST_ID: break winner_judger.set_correct_chara_id(chara_id_list[0]) dir_path = os.path.join(os.path.expanduser(hoshino.config.RES_DIR), 'img', 'priconne', 'unit') if not os.path.exists(dir_path): os.makedirs(dir_path) c = chara.fromid(chara_id_list[0]) img = c.icon.open() left = math.floor(random.random() * (129 - PIC_SIDE_LENGTH)) upper = math.floor(random.random() * (129 - PIC_SIDE_LENGTH)) cropped = img.crop( (left, upper, left + PIC_SIDE_LENGTH, upper + PIC_SIDE_LENGTH)) file_path = os.path.join(dir_path, 'cropped_avatar.png') cropped.save(file_path) image = MessageSegment.image(f'file:///{os.path.abspath(file_path)}') msg = f'猜猜这个图片是哪位角色头像的一部分?({ONE_TURN_TIME}s后公布答案)' await bot.send(ev, msg + image) await asyncio.sleep(ONE_TURN_TIME) if winner_judger.winner != '': winner_judger.turn_off() return msg = f'正确答案是: {c.name}{c.icon.cqcode}\n很遗憾,没有人答对~' winner_judger.turn_off() await bot.send(ev, msg) except Exception as e: await bot.send(ev, '错误:\n' + str(e))
async def new_longwang(session: NoticeSession): if session.event['sub_type'] == 'honor' and session.event[ 'honor_type'] == 'talkative': uid = session.event['user_id'] at = MessageSegment.at(uid) msg = f'新的龙王已经出现{at}' await session.send(msg)
async def show_remain(session: CommandSession): parser = ArgumentParser(session=session, usage='show-remain [--cid]') parser.add_argument('--cid', type=int, default=1) args = parser.parse_args(session.argv) group_id = session.ctx['group_id'] cid = args.cid battlemaster = BattleMaster(group_id) if not battlemaster.has_clan(cid): session.finish(f'本群还没有{cid}会哦!使用list-clan查看本群所有公会') stat = battlemaster.list_challenge_remain(cid, datetime.now()) is_admin = await perm.check_permission(session.bot, session.ctx, perm.GROUP_ADMIN) msg1 = [] for uid, alt, name, rem_n, rem_e in stat: if rem_n or rem_e: line = ( str(MessageSegment.at(uid)) if is_admin else name ) + \ ( f'的小号{alt} ' if alt else '' ) + \ ( f' 余{rem_n}刀 补时{rem_e}刀\n' if rem_e else f'余{rem_n}刀\n' ) msg1.append(line) if msg1: await session.send('今日余刀统计:\n' + ''.join(msg1)) else: await session.send(f'{cid}会所有成员均已出完刀!各位辛苦了!')
async def avatar_guess(bot, ev: CQEvent): if winner_judger.get_on_off_status(ev.group_id): await bot.send(ev, "此轮游戏还没结束,请勿重复使用指令") return winner_judger.turn_on(ev.group_id) chara_id_list = list(_pcr_data.CHARA_NAME.keys()) list_len = len(chara_id_list) - 1 while True: index = random.randint(0, list_len) if chara_id_list[index] not in BLACKLIST_ID: break winner_judger.set_correct_chara_id(ev.group_id, chara_id_list[index]) dir_path = os.path.join(os.path.expanduser(hoshino.config.RES_DIR), 'img', 'priconne', 'unit') if not os.path.exists(dir_path): os.makedirs(dir_path) c = chara.fromid(chara_id_list[index]) img = c.icon.open() left = math.floor(random.random()*(129-PIC_SIDE_LENGTH)) upper = math.floor(random.random()*(129-PIC_SIDE_LENGTH)) cropped = img.crop((left, upper, left+PIC_SIDE_LENGTH, upper+PIC_SIDE_LENGTH)) cropped = MessageSegment.image(util.pic2b64(cropped)) msg = f'猜猜这个图片是哪位角色头像的一部分?({ONE_TURN_TIME}s后公布答案){cropped}' await bot.send(ev, msg) await asyncio.sleep(ONE_TURN_TIME) if winner_judger.get_winner(ev.group_id) != '': winner_judger.turn_off(ev.group_id) return msg = f'正确答案是: {c.name}{c.icon.cqcode}\n很遗憾,没有人答对~' winner_judger.turn_off(ev.group_id) await bot.send(ev, msg)
async def kkp(bot, ev): file = get_xcw_kkp() try: rec = MessageSegment.record(f'file:///{os.path.abspath(file.path)}') await bot.send(ev, rec) except CQHttpError: sv.logger.error("发送失败")
async def xcw_huhuhu(bot, ev) -> MessageSegment: file = get_xcw_huhuhu() try: rec = MessageSegment.image(f'file:///{os.path.abspath(file.path)}') await bot.send(ev, rec) except CQHttpError: sv.logger.error("发送失败")
async def chuli(session: CommandSession): try: ev = session.event if ev.self_id != five: return None if ev.user_id != 614867321: raise Exception('只有管理员才有权限处理加群') if session.current_arg: res = re.match(r'(\d+) *([01]) *(.+)?', session.current_arg) group_id = int(res.group(1)) approve = True if int(res.group(2)) == 1 else False flag = group_list[group_id]['flag'] sub_type = group_list[group_id]['sub_type'] group_name = group_list[group_id]['group_name'] self_id = group_list[group_id]['self_id'] comment = res.group(3) at2 = MessageSegment.at(group_list[group_id]['user_id']) del group_list[group_id] try: if approve: await session.bot.set_group_add_request(self_id=self_id, flag=flag, sub_type=sub_type, approve=approve) await session.send(f'{at2}已同意\n✅群号:{group_id}\n✅群名:{group_name}') else: await session.bot.set_group_add_request(self_id=self_id, flag=flag, sub_type=sub_type, approve=approve, reason=comment) await session.send(f'{at2}已拒绝\n❌群号:{group_id}\n❌群名:{group_name}\n拒绝理由:{comment}') except Exception as e: await session.bot.send_group_msg(group_id=messageGroup, message=f'处理失败\n❗群号:{group_id}\n❗群名:{group_name}\n{e}', self_id=self_id) else: group_list.clear() except Exception as e: await session.send(f'{e}')
async def record_send(bot, ev: CQEvent): name = ev.message.extract_plain_text().strip() if not name: await bot.send(ev, '请发送"语音"+角色名,如"语音ue"') return cid = chara.name2id(name) if cid == chara.UNKNOWN: msg = f'兰德索尔似乎没有叫"{name}"的人...' await bot.send(ev, msg) return dir_path = R.get('record', str(cid)).path if not os.path.exists(dir_path): msg = f'未找到"{name}"的语音数据' await bot.send(ev, msg) return file_list = os.listdir(dir_path) file_path = None while not file_path or not os.path.isfile(file_path): filename = random.choice(file_list) file_path = os.path.join(dir_path, filename) if not file_path: msg = f'未找到"{name}"的语音数据' await bot.send(ev, msg) return rec = MessageSegment.record(f'file:///{os.path.abspath(file_path)}') await bot.send(ev, rec)
async def command_check(session: CommandSession, permission=PRIVATE_FRIEND): global spiders qqid = str(session.event['user_id']) spider = get_spider(qqid) if spider.state != 2: await carobot.send_private_msg(user_id=qqid, message='请先绑定scu账号\n输入 "绑定" 进行绑定操作') return if spider.need_reverify(): spider.state = 3 status, b64_img = spider.get_captcha(spider.student_id, spider.password) if not status: await carobot.send_private_msg(user_id=qqid, message='error: %s' % b64_img) return await carobot.send_private_msg( user_id=qqid, message='请输入验证码:(输入 "刷新"或"refresh" 更换验证码)') await carobot.send_private_msg(user_id=session.event['user_id'], message=MessageSegment({ "type": "image", "data": { "file": b64_img } })) else: status, name = spider.get_name() await carobot.send_private_msg(user_id=session.event['user_id'], message="验证成功!\n姓名:%s" % name) spiders[qqid] = spider
async def tex(session: CommandSession): if session.is_first_run: stripped_text = session.current_arg_text.strip() if stripped_text: session.state['tex_code'] = stripped_text tex_code = session.get('tex_code', prompt='请发送你想要生成图片的 TeX 公式', arg_filters=[ extractors.extract_text, str.strip, validators.not_empty('公式不能为空,请重新发送~'), ]) await session.send('正在生成,请稍后……') resp = await requests.post(LATEX2PNG_API_URL, data={ 'latex': tex_code, 'res': '600', 'color': '000000' }) if not resp.ok: session.finish('服务暂时不可用,请稍后再试') html = await resp.text m = re.search(r'latex_[0-9a-z]+\.png', html) if not m: session.finish('生成公式图片失败,请稍后再试') session.finish( MessageSegment.image(LATEX2PNG_IMAGE_URL_FORMAT.format(m.group(0))) + '\n' + ZHIHU_TEX_SVG_URL_FORMAT.format(quote_plus(tex_code)))
async def send_manual_image(session: CommandSession, plugin_name: str) -> None: url_format = session.bot.config.MANUAL_IMAGE_URL_FORMAT if url_format.startswith('file:'): url = url_format.format(plugin_name) else: url = url_format.format(quote_plus(plugin_name)) await session.send(MessageSegment.image(url))