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) {
|
if (cooldown > 0) {
|
||||||
const recent = await client.pb.collection('scorekeeper_events').getList(1, 1, {
|
const recent = await client.pb.collection('scorekeeper_events').getList(1, 1, {
|
||||||
filter: `guildId = \"${guildId}\" && userId = \"${targetUser.id}\" && type = \"commendation\" && categoryId = \"${categoryId}\"`,
|
filter: `guildId = \"${guildId}\" && userId = \"${targetUser.id}\" && type = \"commendation\" && categoryId = \"${categoryId}\"`,
|
||||||
sort: '-timestamp'
|
sort: '-created'
|
||||||
});
|
});
|
||||||
const lastItem = recent.items?.[0];
|
const lastItem = recent.items?.[0];
|
||||||
if (lastItem) {
|
if (lastItem) {
|
||||||
const lastTs = new Date(lastItem.timestamp).getTime();
|
const lastTs = new Date(lastItem.created).getTime();
|
||||||
const elapsed = Date.now() - lastTs;
|
const elapsed = Date.now() - lastTs;
|
||||||
if (elapsed < cooldown) {
|
if (elapsed < cooldown) {
|
||||||
const expireTs = lastTs + cooldown;
|
const expireTs = lastTs + cooldown;
|
||||||
@ -643,14 +643,14 @@ export const commands = [
|
|||||||
try {
|
try {
|
||||||
await client.scorekeeper.addCommendation(interaction.guildId, targetUser.id, amount);
|
await client.scorekeeper.addCommendation(interaction.guildId, targetUser.id, amount);
|
||||||
// Log event
|
// Log event
|
||||||
|
// Log event (timestamp managed by PocketBase "created" field)
|
||||||
await client.pb.collection('scorekeeper_events').create({
|
await client.pb.collection('scorekeeper_events').create({
|
||||||
guildId: interaction.guildId,
|
guildId: interaction.guildId,
|
||||||
userId: targetUser.id,
|
userId: targetUser.id,
|
||||||
type: 'commendation',
|
type: 'commendation',
|
||||||
categoryId,
|
categoryId,
|
||||||
amount,
|
amount,
|
||||||
awardedBy: interaction.user.id,
|
awardedBy: interaction.user.id
|
||||||
timestamp: new Date().toISOString()
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await interaction.reply(`Added commendation to ${targetUser}.`);
|
await interaction.reply(`Added commendation to ${targetUser}.`);
|
||||||
@ -704,11 +704,11 @@ export const commands = [
|
|||||||
if (cooldown > 0) {
|
if (cooldown > 0) {
|
||||||
const recent = await client.pb.collection('scorekeeper_events').getList(1, 1, {
|
const recent = await client.pb.collection('scorekeeper_events').getList(1, 1, {
|
||||||
filter: `guildId = \"${guildId}\" && userId = \"${targetUser.id}\" && type = \"citation\" && categoryId = \"${categoryId}\"`,
|
filter: `guildId = \"${guildId}\" && userId = \"${targetUser.id}\" && type = \"citation\" && categoryId = \"${categoryId}\"`,
|
||||||
sort: '-timestamp'
|
sort: '-created'
|
||||||
});
|
});
|
||||||
const lastItem = recent.items?.[0];
|
const lastItem = recent.items?.[0];
|
||||||
if (lastItem) {
|
if (lastItem) {
|
||||||
const lastTs = new Date(lastItem.timestamp).getTime();
|
const lastTs = new Date(lastItem.created).getTime();
|
||||||
const elapsed = Date.now() - lastTs;
|
const elapsed = Date.now() - lastTs;
|
||||||
if (elapsed < cooldown) {
|
if (elapsed < cooldown) {
|
||||||
const expireTs = lastTs + cooldown;
|
const expireTs = lastTs + cooldown;
|
||||||
@ -726,14 +726,14 @@ export const commands = [
|
|||||||
try {
|
try {
|
||||||
await client.scorekeeper.addCitation(interaction.guildId, targetUser.id, amount);
|
await client.scorekeeper.addCitation(interaction.guildId, targetUser.id, amount);
|
||||||
// Log event
|
// Log event
|
||||||
|
// Log event (timestamp managed by PocketBase "created" field)
|
||||||
await client.pb.collection('scorekeeper_events').create({
|
await client.pb.collection('scorekeeper_events').create({
|
||||||
guildId: interaction.guildId,
|
guildId: interaction.guildId,
|
||||||
userId: targetUser.id,
|
userId: targetUser.id,
|
||||||
type: 'citation',
|
type: 'citation',
|
||||||
categoryId,
|
categoryId,
|
||||||
amount,
|
amount,
|
||||||
awardedBy: interaction.user.id,
|
awardedBy: interaction.user.id
|
||||||
timestamp: new Date().toISOString()
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await interaction.reply(`Added citation to ${targetUser}.`);
|
await interaction.reply(`Added citation to ${targetUser}.`);
|
||||||
|
|||||||
@ -199,7 +199,7 @@ export default {
|
|||||||
'scorekeeper',
|
'scorekeeper',
|
||||||
'scorekeeper-example',
|
'scorekeeper-example',
|
||||||
'scExecHangarStatus',
|
'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.
|
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 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.
|
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