
Lv.1
签名:正在代码岛,有时候你可以找到我() 正在学js
在 吉吉喵表情包第一弹:猜猜我是谁? 中回复
+叹气吉
2+比心吉
3+打call吉
4+点赞吉
5+狗头吉
6+害羞吉
7+开心吉
8+辣眼吉
9+流汗吉
10+难过吉
11+冷漠吉
12+膜拜吉
13+探头吉
14+生气吉
15+耍帅吉
16+cure吉
我复制的()
2021-07-17T15:38:48 点赞:0
在 #创作节#紧急招人 中回复
// 查询自己的历史最高分
async function getMyBestTime(player) {
// 搜索数据
const rows = await db.sql`SELECT * FROM leaderboard WHERE name=${player} ORDER BY record ASC LIMIT 1`;
// 找不到数据
if (rows && !rows.length) {
console.log('还没有比赛记录');
return null;
}
world.say(`${row[0].name} : ${row[0].record}`)
return rows[0];
}
// 在聊天窗口回复 '1', 查询自己历史最高分
world.onChat(async ({entity:user,message})=>{
if(message==='1'){
const personalBest = await getMyBestTime(user.player.name);
msg = personalBest ? `你的历史最高分是 ${personalBest.record}` : `你还没有比赛记录`
user.player.directMessage(msg)
}
});
2021-07-23T11:24:17 点赞:0
在 【岛3创作节】下半场开启:疯狂30秒! 中回复
2021-07-23T16:08:18 点赞:1