import { definePlugin, http } from 'kivibot' export default definePlugin({ name: 'fb', version: '1.0.0', setup(ctx) { ctx.handle('message.group', async (e) => { const reg = /^\s*(每日)?发病\s*(.*)$/ const matches = e.raw_message.match(reg) if (matches) { const name = matches[2] || (e.sender.card ?? e.sender.nickname) e.reply(await fetchFbMsgs(name)) } }) ctx.handle('notice.group.poke', async (e) => { const { target_id, operator_id } = e if (target_id === ctx.bot.uin) { const member = e.group.pickMember(operator_id) const msg = await fetchFbMsgs((member.card || operator_id).toString()) e.group.sendMsg(msg) } }) }, }) async function fetchFbMsgs(name: string) { const { data } = await http.get('https://fb.viki.moe', { params: { name } }) return data }