diff --git a/readme.md b/readme.md index ca910af..21d5bcb 100644 --- a/readme.md +++ b/readme.md @@ -12,4 +12,5 @@ ### 指令 * 强娶 -* 求婚 \ No newline at end of file +* 求婚 +* 离婚 \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 0018beb..28778fa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,6 +19,7 @@ export interface Config { activeDays: number forceMarry: boolean propose: boolean + divorce: boolean excludeUsers: { uid: string note?: string @@ -40,6 +41,7 @@ export const Config: Schema = Schema.intersect([ Schema.object({ forceMarry: Schema.boolean().description('是否启用强娶指令').default(false), propose: Schema.boolean().description('是否启用求婚指令').experimental().default(false), + divorce: Schema.boolean().description('是否启用离婚指令').experimental().default(false), }).description('附加指令') ]) @@ -270,4 +272,25 @@ export function apply(ctx: Context, cfg: Config) { } }) } + + + if (cfg.divorce) { + ctx.command('divorce') + .alias('离婚') + .action(async ({ session }) => { + const { gid } = session + + const marriage = await ctx.cache.get(`waifu_marriages_${gid}`, session.userId) + if (!marriage) { + return session.text('.not-married', { + quote: h.quote(session.messageId) + }) + } else { + ctx.cache.delete(`waifu_marriages_${gid}`, session.userId) + return session.text('.divorcement', { + quote: h.quote(session.messageId) + }) + } + }) + } } \ No newline at end of file diff --git a/src/locales/zh-CN.yml b/src/locales/zh-CN.yml index 936413b..787637e 100644 --- a/src/locales/zh-CN.yml +++ b/src/locales/zh-CN.yml @@ -30,4 +30,9 @@ commands: already-marriage: '{quote}你已经有对象了,今天别再求婚啦!' members-too-few: 能求婚的群友没有这位,或许可以先把对方骗出来聊天?! target-self: '{quote}向自己求婚干嘛!' - request: '{targetAt} {targetAvatar}
群友「{name}」向你求婚,那么...你愿意嫁给ta吗?在{time}秒内发送【{agree}】或者【{reject}】,回应对方哦!' \ No newline at end of file + request: '{targetAt} {targetAvatar}
群友「{name}」向你求婚,那么...你愿意嫁给ta吗?在{time}秒内发送【{agree}】或者【{reject}】,回应对方哦!' + divorce: + description: 和群友离婚 + messages: + not-married: '{quote}你还是只单身狗,不能离婚!' + divorcement: '{quote}你已经离婚, 江湖有缘再相见~' \ No newline at end of file