mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 16:06:59 +01:00
add monthly and alltime stat commands
This commit is contained in:
@@ -11,3 +11,29 @@ export async function createTimeoutRecord(user: User, target: User, item: string
|
||||
logger.err(err as string);
|
||||
};
|
||||
};
|
||||
|
||||
export async function getTimeoutsAsUser(user: User, monthData?: string) {
|
||||
try {
|
||||
const monthquery = monthData ? ` && created~"${monthData}"` : '';
|
||||
const data = await pb.getFullList({
|
||||
filter: `user="${user.id}"${monthquery}`
|
||||
});
|
||||
return data;
|
||||
} catch (e) {
|
||||
logger.err(`Failed to get timeouts as user: ${user.id}, month: ${monthData}`);
|
||||
logger.err(e as string);
|
||||
};
|
||||
};
|
||||
|
||||
export async function getTimeoutsAsTarget(user: User, monthData?: string) {
|
||||
try {
|
||||
const monthquery = monthData ? ` && created~"${monthData}"` : '';
|
||||
const data = await pb.getFullList({
|
||||
filter: `target="${user.id}"${monthquery}`
|
||||
});
|
||||
return data;
|
||||
} catch (e) {
|
||||
logger.err(`Failed to get timeouts as target: ${user.id}, month: ${monthData}`);
|
||||
logger.err(e as string);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -11,3 +11,17 @@ export async function createUsedItemRecord(user: User, item: string): Promise<vo
|
||||
logger.err(err as string);
|
||||
};
|
||||
};
|
||||
|
||||
export async function getItemsUsed(user: User, monthData?: string) {
|
||||
try {
|
||||
const monthquery = monthData ? ` && created~"${monthData}"` : '';
|
||||
const data = await pb.getFullList({
|
||||
filter: `user="${user.id}"${monthquery}`
|
||||
});
|
||||
return data;
|
||||
} catch (e) {
|
||||
logger.err(`Failed to get items used for user: ${user.id}, month: ${monthData}`);
|
||||
logger.err(e as string);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user