koishi-plugin-toram 4.2.0-test.6 → 4.2.1-test.1

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.
package/lib/index.js CHANGED
@@ -195,7 +195,7 @@ function scheduleMonthlyCardReminders(groupId, hours) {
195
195
  }
196
196
  }
197
197
  __name(scheduleMonthlyCardReminders, "scheduleMonthlyCardReminders");
198
- async function executeMonthlyCardReminder(item) {
198
+ function executeMonthlyCardReminder(item) {
199
199
  const payload = item.payload || {};
200
200
  const groupId = payload.groupId;
201
201
  const timeIndex = payload.timeIndex;
@@ -687,19 +687,18 @@ var _BotTodoMgr = class _BotTodoMgr {
687
687
  });
688
688
  }
689
689
  // 持久化内存中的 todo
690
- saveTodos() {
691
- const data = [];
692
- this._todos.forEach((list) => data.push(...list));
693
- this.ctx.database.upsert("toram_todo", data);
690
+ async saveTodos() {
691
+ const data = Array.from(this._todos.values()).flat();
692
+ await this.ctx.database.upsert("toram_todo", data);
694
693
  }
695
694
  // 新增一条 todo,返回 id
696
- addTodo(ts, type, payload) {
695
+ async addTodo(ts, type, payload) {
697
696
  const id = `${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
698
697
  const todo = { id, ts, type, payload };
699
698
  const list = this._todos.get(ts) || [];
700
699
  list.push(todo);
701
700
  this._todos.set(ts, list);
702
- this.saveTodos();
701
+ await this.saveTodos();
703
702
  if (this._started) {
704
703
  if (this._nextTs === void 0 || ts < this._nextTs) {
705
704
  this.scheduleNext();
@@ -889,7 +888,7 @@ async function apply(ctx, config) {
889
888
  TalkMgr.Inst().setTalks();
890
889
  await UserMgr.Inst().setUsers(ctx);
891
890
  MonsterMgr.Inst().setMonsters();
892
- BotTodoMgr.Inst().setTodos(ctx);
891
+ await BotTodoMgr.Inst().setTodos(ctx);
893
892
  registerBotTodoHandlers();
894
893
  BotTodoMgr.Inst().start();
895
894
  scheduleMonthlyCardReminders(config.groupId, [
@@ -31,5 +31,23 @@
31
31
  "@_atUsers_@ \n今天的月卡记得领取哦!",
32
32
  "@_atUsers_@ \n布谷布谷,领月卡的时间到啦~",
33
33
  "@_atUsers_@ \n快去领今天的月卡吧!"
34
+ ],
35
+ "月卡确认领取": [
36
+ "领月卡是好文明!",
37
+ "看来今天也有好好领月卡呢~",
38
+ "你领月卡啦?这是好的~",
39
+ "明天也不要忘记领月卡哦?"
40
+ ],
41
+ "戳一戳": [
42
+ "呜哇哇哇啊?",
43
+ "为什么要戳书!",
44
+ "错误发生!魔导书重启中……骗你的~",
45
+ "【小声】看不见我看不见我……",
46
+ "【魔导书假装睡着了】",
47
+ "【魔导书尝试戳回去,但是因为没有手失败了】",
48
+ "【魔导书快速翻页制造微风试图飞走】",
49
+ "救命!有人要吃书!【逃走】",
50
+ "魔导书对突然乱戳的行为表示强烈谴责!",
51
+ "戳一戳收费:一枚众神币!"
34
52
  ]
35
53
  }
@@ -21,7 +21,7 @@ export declare class BotTodoMgr {
21
21
  private _started;
22
22
  setTodos(ctx: Context): Promise<void>;
23
23
  private saveTodos;
24
- addTodo(ts: number, type: string, payload?: any): string;
24
+ addTodo(ts: number, type: string, payload?: any): Promise<string>;
25
25
  getTodosAt(ts: number): BotTodoItem[];
26
26
  removeTodo(ts: number, id: string): void;
27
27
  removeTodosAt(ts: number): void;
@@ -1,4 +1,4 @@
1
1
  import { BotTodoItem } from "../BotTodoMgr";
2
2
  export declare const MONTHLY_CARD_REMINDER_TYPE = "monthly-card-reminder";
3
3
  export declare function scheduleMonthlyCardReminders(groupId: string, hours: number[]): void;
4
- export declare function executeMonthlyCardReminder(item: BotTodoItem): Promise<void>;
4
+ export declare function executeMonthlyCardReminder(item: BotTodoItem): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-toram",
3
3
  "description": "托拉姆物语小工具",
4
- "version": "4.2.0-test.6",
4
+ "version": "4.2.1-test.1",
5
5
  "contributors": [
6
6
  "青灯 <1874053520@qq.com>"
7
7
  ],
@@ -1 +0,0 @@
1
- []