import itertools, re from kokkoro import util, R from kokkoro.common_interface import EventInterface from . import sv p1 = R.img('priconne/quick/r16-5-tw-0.png') p2 = R.img('priconne/quick/r16-5-tw-1.png') p4 = R.img('priconne/quick/r17-5-jp-1.png') p5 = R.img('priconne/quick/r17-5-jp-2.png') p6 = R.img('priconne/quick/r17-5-jp-3.png') cn_rank = R.img('priconne/quick/r10-3.jpg') @sv.on_rex(r'^(\*?([日台国陆b])服?([前中后]*)卫?)?rank(表|推荐|指南)?$') async def rank_sheet(bot, ev: EventInterface): match = ev.get_param().match is_jp = match.group(2) == '日' is_tw = match.group(2) == '台' is_cn = match.group(2) and match.group(2) in '国陆b' if not is_jp and not is_tw and not is_cn: await bot.kkr_send( ev, '\n请问您要查询哪个服务器的rank表?\n*日rank表\n*台rank表\n*B服rank表\n', at_sender=True) return msg = [ '\n※表格仅供参考,升r有风险,强化需谨慎\n※一切以会长要求为准——', ] if is_jp: msg.append('※不定期搬运自图中Q群\n※广告为原作者推广,与本bot无关\nR17-5 rank表:') await bot.kkr_send(ev, '\n'.join(msg), at_sender=True)
async def yukari_sheet(bot, ev): await bot.kkr_send(ev, R.img('priconne/quick/黄骑充电.jpg')) await bot.kkr_send(ev, YUKARI_SHEET, at_sender=True)
import itertools, re from kokkoro import util, R from kokkoro.common_interface import EventInterface from . import sv tw_1 = R.img('priconne/quick/r17-4-1-tw.png') tw_2 = R.img('priconne/quick/r17-4-2-tw.png') jp_1 = R.img('priconne/quick/r18-3-1-jp.png') jp_2 = R.img('priconne/quick/r18-3-2-jp.png') jp_3 = R.img('priconne/quick/r18-3-3-jp.png') cn_1 = R.img('priconne/quick/r10-4-1-cn.jpg') cn_2 = R.img('priconne/quick/r10-4-2-cn.jpg') cn_3 = R.img('priconne/quick/r10-4-3-cn.jpg') @sv.on_rex(r'^(\*?([日台国陆b])服?([前中后]*)卫?)?rank(表|推荐|指南)?$') async def rank_sheet(bot, ev: EventInterface): match = ev.get_param().match is_jp = match.group(2) == '日' is_tw = match.group(2) == '台' is_cn = match.group(2) and match.group(2) in '国陆b' if not is_jp and not is_tw and not is_cn: await bot.kkr_send( ev, '\n请问您要查询哪个服务器的rank表?\n*日rank表\n*台rank表\n*B服rank表\n', at_sender=True) return msg = [ '\n※表格仅供参考,升r有风险,强化需谨慎\n※一切以会长要求为准——', ] if is_jp:
async def jiuzhe(bot, ev): msglist = ['这是法刀吗?', f'恁搁着挠痒痒呢?', f'就这?', R.img('就这.jpg')] index = random.randint(0, len(msglist) - 1) await bot.kkr_send(ev, msglist[index])
def get_base_by_name(filename) -> R.ResImg: return R.img(os.path.join(BASE_LUCK_IMG_DIR, filename))
def random_base() -> R.ResImg: base_dir = R.img(BASE_LUCK_IMG_DIR).path random_img = random.choice(os.listdir(base_dir)) return R.img(os.path.join(BASE_LUCK_IMG_DIR, random_img))
from kokkoro.service import BroadcastTag, BroadcastService from kokkoro import R sv9 = BroadcastService('pcr-portion-reminder-utc9', broadcast_tag=BroadcastTag.jp_broadcast, enable_on_default=False, help_='药水购买小助手(UTC+9)') sv8 = BroadcastService( 'pcr-portion-reminder-utc8', broadcast_tag=[BroadcastTag.cn_broadcast, BroadcastTag.tw_broadcast], enable_on_default=False, help_='药水购买小助手(UTC+8)') img = R.img('提醒药水小助手.jpg') @sv8.scheduled_job('cron', hour='0,6,12,18', misfire_grace_time=60 * 10) async def pcr_portion_reminder_utc8(): await sv8.broadcast(img) @sv9.scheduled_job('cron', hour='23,5,11,17', misfire_grace_time=60 * 10) async def pcr_portion_reminder_utc9(): await sv9.broadcast(img)
import numpy as np import datetime from kokkoro.common_interface import KokkoroBot, EventInterface from kokkoro.service import Service from kokkoro.util import FreqLimiter from kokkoro import R from .. import sv, cb_cmd _time_limit = 30*60 _lmt = FreqLimiter(_time_limit) b_constellations = ["摩羯","水瓶","双鱼","白羊","金牛","双子","巨蟹","狮子","处女","天秤","天蝎","射手"] #国服的(预测) background1 = R.img('priconne/公会离职报告模板.jpg') background2 = R.img('priconne/公会本期报告模板.jpg') REPORT_RESIGN = 0 REPORT_NORMAL = 1 REPORT_UNDECLARED = -1 sv = Service('clanbattle-report') @sv.on_fullmatch(('离职报告', 'retire-report')) async def send_resign_report(bot:KokkoroBot, event:EventInterface): await send_report(bot, event, type=REPORT_RESIGN) @sv.on_fullmatch(('会战报告', 'clanbattle-report')) async def send_normal_report(bot:KokkoroBot, event:EventInterface): await send_report(bot, event, type=REPORT_NORMAL)
async def new_year_burst(bot: KokkoroBot, ev: EventInterface): cmd = ev.get_param().plain_text if cmd in util.join_iterable(_ue_sorry, _image_suffix) or random.random() < 0.02: await bot.kkr_send(ev, R.img('ue_sorry.jpg'))
async def new_year_burst(bot: KokkoroBot, ev: EventInterface): cmd = ev.get_param().plain_text if cmd in util.join_iterable(_ch, _image_suffix) or random.random() < 0.02: await bot.kkr_send(ev, R.img('newyearburst.gif')) await bot.kkr_send(ev, nyb_player)
async def africa(bot: KokkoroBot, ev: EventInterface): cmd = ev.get_param().plain_text if cmd in util.join_iterable(_africa, _image_suffix) or random.random() < 0.05: await bot.kkr_send(ev, R.img('非洲人.png'))
async def chat_queshi(bot: KokkoroBot, ev: EventInterface): cmd = ev.get_param().plain_text if cmd in ['确实.jpg'] or random.random() < 0.05: await bot.kkr_send(ev, R.img('确实.jpg'))
from kokkoro import R, log, util from . import _pcr_data logger = log.new_logger('chara') UNKNOWN = 1000 UnavailableChara = { 1067, # 穗希 1069, # 霸瞳 1072, # 可萝爹 1073, # 拉基拉基 1102, # 泳装大眼 } try: gadget_equip = R.img('priconne/gadget/equip.png').open() gadget_star = R.img('priconne/gadget/star.png').open() gadget_star_dis = R.img('priconne/gadget/star_disabled.png').open() gadget_star_pink = R.img('priconne/gadget/star_pink.png').open() unknown_chara_icon = R.img( f'priconne/unit/icon_unit_{UNKNOWN}31.png').open() except Exception as e: logger.exception(e) class Roster: def __init__(self): self._roster = pygtrie.CharTrie() self.update() def update(self):