Skip to content

Commit

Permalink
fix: 新增续火
Browse files Browse the repository at this point in the history
  • Loading branch information
yusheng929 committed Sep 17, 2024
1 parent 6e24a01 commit 4da9a7f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions apps/续火.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { karin } from 'node-karin'
import { Config } from '#components'

export const 续火 = karin.task("续火", Config.Cof.corn || "0 0 * * *", async () => {
for (const id of Config.Cof.List || '') {
try {
const elements = [segment.text(Config.Cof.msg)]
const contact = karin.contactFriend(id)
await e.bot.SendMessage(contact, elements)
} catch (error) { }
}
}, { name: "续火" })
4 changes: 4 additions & 0 deletions components/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ class Config {
return this.getDefOrConfig('other')
}

get Cof () {
return this.getDefOrConfig('COF')
}

get state () {
return this.getDefOrConfig('state')
}
Expand Down
3 changes: 3 additions & 0 deletions config/default_config/COF.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cron: "0 0 * * *" # cron表达式
msg: "续火" # 回复文本
List: [] # 续火对象列表

0 comments on commit 4da9a7f

Please sign in to comment.