Fixed bad pb request in scorekeeper.
This commit is contained in:
parent
669fcf58f8
commit
5bbb02c2bb
@ -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}.`);
|
||||
|
||||
@ -199,7 +199,7 @@ export default {
|
||||
'scorekeeper',
|
||||
'scorekeeper-example',
|
||||
'scExecHangarStatus',
|
||||
'condimentX'
|
||||
//'condimentX'
|
||||
]
|
||||
|
||||
},
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user