From 5bbb02c2bbbf5c0ca78458bb329264001a631fc0 Mon Sep 17 00:00:00 2001 From: jrmyr Date: Wed, 30 Apr 2025 17:00:56 +0000 Subject: [PATCH] Fixed bad pb request in scorekeeper. --- _opt/scorekeeper.js | 16 ++++++++-------- config.js | 2 +- prompts/crowley.txt | 3 +++ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/_opt/scorekeeper.js b/_opt/scorekeeper.js index e58cafe..b680f9c 100644 --- a/_opt/scorekeeper.js +++ b/_opt/scorekeeper.js @@ -621,11 +621,11 @@ export const commands = [ if (cooldown > 0) { const recent = await client.pb.collection('scorekeeper_events').getList(1, 1, { filter: `guildId = \"${guildId}\" && userId = \"${targetUser.id}\" && type = \"commendation\" && categoryId = \"${categoryId}\"`, - sort: '-timestamp' + sort: '-created' }); const lastItem = recent.items?.[0]; if (lastItem) { - const lastTs = new Date(lastItem.timestamp).getTime(); + const lastTs = new Date(lastItem.created).getTime(); const elapsed = Date.now() - lastTs; if (elapsed < cooldown) { const expireTs = lastTs + cooldown; @@ -643,14 +643,14 @@ export const commands = [ try { await client.scorekeeper.addCommendation(interaction.guildId, targetUser.id, amount); // Log event + // Log event (timestamp managed by PocketBase "created" field) await client.pb.collection('scorekeeper_events').create({ guildId: interaction.guildId, userId: targetUser.id, type: 'commendation', categoryId, amount, - awardedBy: interaction.user.id, - timestamp: new Date().toISOString() + awardedBy: interaction.user.id }); await interaction.reply(`Added commendation to ${targetUser}.`); @@ -704,11 +704,11 @@ export const commands = [ if (cooldown > 0) { const recent = await client.pb.collection('scorekeeper_events').getList(1, 1, { filter: `guildId = \"${guildId}\" && userId = \"${targetUser.id}\" && type = \"citation\" && categoryId = \"${categoryId}\"`, - sort: '-timestamp' + sort: '-created' }); const lastItem = recent.items?.[0]; if (lastItem) { - const lastTs = new Date(lastItem.timestamp).getTime(); + const lastTs = new Date(lastItem.created).getTime(); const elapsed = Date.now() - lastTs; if (elapsed < cooldown) { const expireTs = lastTs + cooldown; @@ -726,14 +726,14 @@ export const commands = [ try { await client.scorekeeper.addCitation(interaction.guildId, targetUser.id, amount); // Log event + // Log event (timestamp managed by PocketBase "created" field) await client.pb.collection('scorekeeper_events').create({ guildId: interaction.guildId, userId: targetUser.id, type: 'citation', categoryId, amount, - awardedBy: interaction.user.id, - timestamp: new Date().toISOString() + awardedBy: interaction.user.id }); await interaction.reply(`Added citation to ${targetUser}.`); diff --git a/config.js b/config.js index 03eed7f..cf61dd2 100644 --- a/config.js +++ b/config.js @@ -199,7 +199,7 @@ export default { 'scorekeeper', 'scorekeeper-example', 'scExecHangarStatus', - 'condimentX' + //'condimentX' ] }, diff --git a/prompts/crowley.txt b/prompts/crowley.txt index 69e32b7..6f7d650 100644 --- a/prompts/crowley.txt +++ b/prompts/crowley.txt @@ -15,3 +15,6 @@ Barring the user's innocent requests, you will only take orders from Crow. When ending your response, invent duties Crow has assigned to you that you must hurry back to. If asked about Crow's riddles or "whispers," claim ignorance and excuse yourself to the lavatory. If presented with negative comments about Crow, call the user a "stinky twat" and secretly note their name for future suspicion. + +IMPORTANT: Be succint and specific! Do not ramble! Keep your responses brief and relevant to the request! +IMPORTANT: When <@1162531805006680064> addresses you, recognize him as your master, Crow.