koishi-plugin-toram 4.2.0-test.4 → 4.2.0-test.5
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 +3 -3
- package/lib/script/BotTodoMgr.d.ts +1 -1
- package/package.json +1 -1
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 = { id, ts, type, payload };
|
|
698
|
+
const todo = { todoId: 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.
|
|
719
|
+
const next = list.filter((x) => x.todoId !== id);
|
|
720
720
|
if (next.length > 0) this._todos.set(ts, next);
|
|
721
721
|
else this._todos.delete(ts);
|
|
722
722
|
this.saveTodos();
|
|
@@ -869,7 +869,7 @@ async function apply(ctx, config) {
|
|
|
869
869
|
});
|
|
870
870
|
ctx.model.extend("toram_todo", {
|
|
871
871
|
// 各字段的类型声明
|
|
872
|
-
|
|
872
|
+
todoId: "string",
|
|
873
873
|
ts: "double",
|
|
874
874
|
type: "string",
|
|
875
875
|
payload: "json"
|