blockly里新写的key无法正常显示在koishi的仓库里,且偶尔无法被正常调取(更新:判断可能是数据库显示问题)

我也不知道是blockly还是koishi的问题,刷新重登都没用。
blockly是0.5.5

写入了约81条key,但只能正常显示33条:

此外,执行命令调取key对应值时,时不时就无法调取


但是在查看key值时好像又是正常的

log如下:

log

2023-02-19 18:27:10 [W] command 求签 试试
Error: no such column: NaN
at f.handleError (C:\dev\koishi-app\node_modules@minatojs\sql.js\dist\sql-wasm.js:91:290)
at f.prepare (C:\dev\koishi-app\node_modules@minatojs\sql.js\dist\sql-wasm.js:90:46)
at SQLiteDriver.#exec (C:\dev\koishi-app\node_modules@minatojs\driver-sqlite\src\index.ts:208:28)
at SQLiteDriver.#all (C:\dev\koishi-app\node_modules@minatojs\driver-sqlite\src\index.ts:220:12)
at SQLiteDriver.get (C:\dev\koishi-app\node_modules@minatojs\driver-sqlite\src\index.ts:274:18)
at Selection.execute (C:\dev\koishi-app\node_modules@minatojs\core\src\selection.ts:97:40)
at Selection.execute (C:\dev\koishi-app\node_modules@minatojs\core\src\selection.ts:216:33)
at DatabaseService.get (C:\dev\koishi-app\node_modules@minatojs\core\src\driver.ts:139:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-02-19 18:27:16 [W] sqlite > SELECT key, value FROM blockly_key_value vdapmmoj WHERE key = NaN
2023-02-19 18:27:16 [W] command 求签 试试
Error: no such column: NaN
at f.handleError (C:\dev\koishi-app\node_modules@minatojs\sql.js\dist\sql-wasm.js:91:290)
at f.prepare (C:\dev\koishi-app\node_modules@minatojs\sql.js\dist\sql-wasm.js:90:46)
at SQLiteDriver.#exec (C:\dev\koishi-app\node_modules@minatojs\driver-sqlite\src\index.ts:208:28)
at SQLiteDriver.#all (C:\dev\koishi-app\node_modules@minatojs\driver-sqlite\src\index.ts:220:12)
at SQLiteDriver.get (C:\dev\koishi-app\node_modules@minatojs\driver-sqlite\src\index.ts:274:18)
at Selection.execute (C:\dev\koishi-app\node_modules@minatojs\core\src\selection.ts:97:40)
at Selection.execute (C:\dev\koishi-app\node_modules@minatojs\core\src\selection.ts:216:33)
at DatabaseService.get (C:\dev\koishi-app\node_modules@minatojs\core\src\driver.ts:139:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-02-19 18:27:22 [I] blockly Loading 5 plugin(s)
2023-02-19 18:27:22 [I] blockly Loaded 5 plugin(s)
2023-02-19 18:27:32 [W] sqlite > SELECT key, value FROM blockly_key_value dmghcmbe WHERE key = NaN
2023-02-19 18:27:32 [W] command 求签 试试
Error: no such column: NaN
at f.handleError (C:\dev\koishi-app\node_modules@minatojs\sql.js\dist\sql-wasm.js:91:290)
at f.prepare (C:\dev\koishi-app\node_modules@minatojs\sql.js\dist\sql-wasm.js:90:46)
at SQLiteDriver.#exec (C:\dev\koishi-app\node_modules@minatojs\driver-sqlite\src\index.ts:208:28)
at SQLiteDriver.#all (C:\dev\koishi-app\node_modules@minatojs\driver-sqlite\src\index.ts:220:12)
at SQLiteDriver.get (C:\dev\koishi-app\node_modules@minatojs\driver-sqlite\src\index.ts:274:18)
at Selection.execute (C:\dev\koishi-app\node_modules@minatojs\core\src\selection.ts:97:40)
at Selection.execute (C:\dev\koishi-app\node_modules@minatojs\core\src\selection.ts:216:33)
at DatabaseService.get (C:\dev\koishi-app\node_modules@minatojs\core\src\driver.ts:139:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

块如下

插件名称: 求签系统
导出时间: 2023/2/21 18:53:29
-=-=-=-=–=-=-=-=- BEGIN KOISHI BLOCKLY BLOCK V1 -=-=–=-=-=–=-=–=-=-=-
H4sIAAAAAAAAA+VZaXOiShT9LamEKhP3BQSnUgYU3HBJXJMvFkIrGAVlcfvgb38X
NBqJOMzEmnn1XhWlDfbtc/rc2/d2I5ZmsERigXRD0VRoZeIh+Bxo0tq+wZxfBxNN
fDeO9xNBHVnCCHWOVrHQaT+c2XU11zPkPEgkRG06FVQJWnZfRdo/RjdIHAzNURPn
ipNETH5Mtdv7Piu7S5jEnc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tvrOJNVLUMOxdhKM0
EjJEXZkdDsmuv14un7qhAcWHYZwGY7/m3rGyrAMvUSIFfJAUwgNEJsIpiSTDVAI+
CGjhOImnSSTuEP8BuUpCYu4cAAA=
-=-=–=-=-=–=-=-=-=- END KOISHI BLOCKLY BLOCK V1 -=-=–=-=-=–=-=–=-=-=-

编译后

import { h } from “koishi”
export const name = “求签系统”
export const using =
export async function apply(ctx){
ctx.database.extend(“blockly_key_value”,{
key: “string”,
value: “string”
},{
primary: “key”
})

ctx.command(‘写签 <参数名称:string> <参数名称:string>’).action(async ({session},…args)=>{
await ctx.database.upsert(‘blockly_key_value’,[{key:(args[0]),value:(args[1])}],[‘key’])

});

ctx.command(‘检查签 <参数名称:string>’).action(async ({session},…args)=>{
{
let 第几签 = args[0];
return ([session.content,第几签,(await ctx.database.get(‘blockly_key_value’,{key:第几签}))[0]?.value].join(‘’));
}

});

ctx.command(‘求签 <参数名称:string>’).action(async ({session},…args)=>{
{
let 时间戳 = Math.round(new Date() / 1000), qq = session.messageId;
{
let 求签数 = (qq + 时间戳) % 81 + 1;
return ([h(‘at’,{ id: (session.userId) }),session.content,(await ctx.database.get(‘blockly_key_value’,{key:求签数}))[0]?.value].join(‘’));
}
}

});

}

补充:而且在koishi的数据库那点插入还会冒出这个东西:


添加数据失败:Error: UNIQUE constraint failed: blockly_key_value.key

更新:不反馈签的问题已经基本解决,但是已经写入的签不能在数据库中完全显示的问题仍然没有解决。
如图:


在我删除前面的一些条目后,后面无法显示的条目就可以正常显现了。但是仅限于此,只能显示33条,后面的虽然可以调用但是没法显示。

1 个赞

cc @TimeBather

你把块和编译完的代码也放一下?

我也遇到了这个问题,koishi数据库里显示不了全部的key。

感觉更像是dataview的bug(