koishi-plugin-ll-schedule 1.6.1 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +9 -3
  2. package/package.json +3 -1
package/index.js CHANGED
@@ -276,6 +276,9 @@ const Config = Schema.object({
276
276
  unsubAllNotice: Schema.string()
277
277
  .default('本群已取消「{task}」的推送')
278
278
  .description('管理员用 schedule.unsuball 取消全部订阅时,发到每个被取消群的提示语({task}=任务名;留空则不发送提示)'),
279
+ permDeniedHint: Schema.string()
280
+ .default('❌ 权限不足,请联系李浅浅,或成为群主/管理员')
281
+ .description('权限不足时的提示语(管理命令/订阅命令都会用它;可改成你自己的联系方式)'),
279
282
  subscribeAuthority: Schema.number()
280
283
  .min(1).max(4).default(1)
281
284
  .description('执行订阅命令所需的最低权限等级(Koishi 用户权限等级,与QQ群主/管理员身份无关;默认 1=所有人都能订阅。如需限制,先在控制台"用户管理"给指定账号提权,再调高此值)'),
@@ -761,8 +764,7 @@ function apply(ctx, config) {
761
764
  }
762
765
 
763
766
  function permDeniedHint() {
764
- return '❌ 权限不足:需要 Koishi 用户权限等级 ≥ ' + config.subscribeAuthority +
765
- (config.subscribeAdminBypass ? ',或为本群群主/群管理' : '')
767
+ return config.permDeniedHint || '❌ 权限不足,请联系李浅浅,或成为群主/管理员'
766
768
  }
767
769
 
768
770
  // 列出所有可订阅的任务(含时间概览 + 本群是否已订阅)
@@ -859,9 +861,13 @@ function apply(ctx, config) {
859
861
 
860
862
  // 管理员:取消指定任务的全部群订阅(并通知每个被取消的群)
861
863
  // 任务名可填 all / * 表示清空所有任务的全部订阅
862
- ctx.command('schedule.unsuball <name>', '取消某任务的全部群订阅(管理员;填 all 清空全部)', { authority: 3 })
864
+ ctx.command('schedule.unsuball <name>', '取消某任务的全部群订阅(管理员;填 all 清空全部)')
863
865
  .action(async ({ session }, name) => {
864
866
  logger.info(`[schedule] 命令被调用: schedule.unsuball name=${name}`)
867
+ // 权限:Koishi 权限 ≥ 3,或(开启群主绕过时)本群群主/群管理
868
+ const isAdmin = (session.user?.authority >= 3) ||
869
+ (config.subscribeAdminBypass && await isGroupAdmin(session))
870
+ if (!isAdmin) return permDeniedHint()
865
871
  const tasks = config.tasks || {}
866
872
  const all = name === 'all' || name === '*'
867
873
  if (!all && (!name || !tasks[name])) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-ll-schedule",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "Scheduled message sender with weekly slots (per-day time & content), QQ official markdown card support",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -29,3 +29,5 @@
29
29
 
30
30
 
31
31
 
32
+
33
+