import { Notifier, NotifyParams, NotifyResult, NotifierParam } from './notifier.types'; const params: NotifierParam[] = [ { key: 'key', label: 'API Key', type: 'password', required: true, placeholder: 'Qmsg API Key' }, { key: 'qq', label: 'QQ 号', type: 'text', required: false, placeholder: '留空则推送到所有绑定QQ' }, { key: 'title', label: '标题', type: 'text', default: 'CloudSearch', required: false }, { key: 'content', label: '内容', type: 'text', required: true }, ]; export const qmsgNotifier: Notifier = { name: 'qmsg', label: 'Qmsg (QQ)', params, async notify(params: NotifyParams): Promise { try { const body: Record = { msg: `[${params.title || 'CloudSearch'}]\n${params.content || ''}`, type: 'send', }; if (params.qq) body.qq = params.qq; const resp = await fetch(`https://qmsg.zendee.cn/api/${params.key}`, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams(body).toString(), }); const data: any = await resp.json(); if (data.code === 0) return { success: true, message: 'Qmsg 推送成功' }; return { success: false, message: data.reason || `HTTP ${resp.status}` }; } catch (err: any) { return { success: false, message: err.message }; } }, };