messageCount: Add docs
This commit is contained in:
parent
339ef06ff9
commit
e194c1d81a
1 changed files with 10 additions and 0 deletions
|
@ -11,6 +11,10 @@ export default class MessageCount implements IQuota {
|
|||
lookback: number;
|
||||
defaultQuota: number;
|
||||
|
||||
/**
|
||||
* @param defaultQuota the default quota for users that don't have override
|
||||
* @param lookback lookback to check
|
||||
*/
|
||||
constructor(
|
||||
defaultQuota: number = 25,
|
||||
lookback: number = 1000 * 60 * 60 * 24
|
||||
|
@ -19,6 +23,9 @@ export default class MessageCount implements IQuota {
|
|||
this.lookback = lookback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrives the quota from the database
|
||||
*/
|
||||
private getUserQuota(id: string) {
|
||||
return database.limits.findUnique({
|
||||
where: { user: BigInt(id) },
|
||||
|
@ -78,6 +85,9 @@ export default class MessageCount implements IQuota {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* helper funtion to create userQuotaData
|
||||
*/
|
||||
private createUserQuotaData(quota: number, used: number): userQuotaData {
|
||||
const humanReadable = milisecondsToHumanReadable(this.lookback);
|
||||
return {
|
||||
|
|
Loading…
Reference in a new issue