koishi-plugin-toram 4.2.0-test.5 → 4.2.0-test.6

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
@@ -695,7 +695,7 @@ var _BotTodoMgr = class _BotTodoMgr {
695
695
  // 新增一条 todo,返回 id
696
696
  addTodo(ts, type, payload) {
697
697
  const id = `${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
698
- const todo = { todoId: id, ts, type, payload };
698
+ const todo = { id, ts, type, payload };
699
699
  const list = this._todos.get(ts) || [];
700
700
  list.push(todo);
701
701
  this._todos.set(ts, list);
@@ -716,7 +716,7 @@ var _BotTodoMgr = class _BotTodoMgr {
716
716
  removeTodo(ts, id) {
717
717
  const list = this._todos.get(ts);
718
718
  if (!list) return;
719
- const next = list.filter((x) => x.todoId !== id);
719
+ const next = list.filter((x) => x.id !== id);
720
720
  if (next.length > 0) this._todos.set(ts, next);
721
721
  else this._todos.delete(ts);
722
722
  this.saveTodos();
@@ -859,20 +859,28 @@ var Config = import_koishi.Schema.intersect([
859
859
  ]);
860
860
  async function apply(ctx, config) {
861
861
  const logger = ctx.logger("toram");
862
- ctx.model.extend("toram_user", {
863
- // 各字段的类型声明
864
- qq: "string",
865
- nickname: "string",
866
- otherNames: "list",
867
- monthlyCardRemindTimeIndex: "integer",
868
- lastGetMonthlyCardDate: "string"
869
- });
862
+ ctx.model.extend(
863
+ "toram_user",
864
+ {
865
+ // 各字段的类型声明
866
+ qq: "string",
867
+ nickname: "string",
868
+ otherNames: "list",
869
+ monthlyCardRemindTimeIndex: "integer",
870
+ lastGetMonthlyCardDate: "string"
871
+ },
872
+ {
873
+ primary: "qq"
874
+ }
875
+ );
870
876
  ctx.model.extend("toram_todo", {
871
877
  // 各字段的类型声明
872
- todoId: "string",
878
+ id: "string",
873
879
  ts: "double",
874
880
  type: "string",
875
881
  payload: "json"
882
+ }, {
883
+ primary: "id"
876
884
  });
877
885
  JsonMgr.Inst().setLogger(logger);
878
886
  await JsonMgr.Inst().loadJson();
@@ -1,6 +1,6 @@
1
1
  import { Context } from "koishi";
2
2
  export interface BotTodoItem {
3
- todoId: string;
3
+ id: string;
4
4
  ts: number;
5
5
  type: string;
6
6
  payload?: any;
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.5",
4
+ "version": "4.2.0-test.6",
5
5
  "contributors": [
6
6
  "青灯 <1874053520@qq.com>"
7
7
  ],