✨ add option to disable all rate limits

This commit is contained in:
Flam3rboy
2021-09-20 23:35:32 +02:00
parent 8d611abe45
commit cc33e87a14
6 changed files with 10 additions and 6 deletions
+2
View File
@@ -77,6 +77,7 @@ export interface ConfigValue {
maxWebhooks: number;
};
rate: {
disabled: boolean;
ip: Omit<RateLimitOptions, "bot_count">;
global: RateLimitOptions;
error: RateLimitOptions;
@@ -188,6 +189,7 @@ export const DefaultConfigOptions: ConfigValue = {
maxWebhooks: 10,
},
rate: {
disabled: true,
ip: {
count: 500,
window: 5,
+1 -3
View File
@@ -161,15 +161,13 @@ export class User extends BaseClass {
}
static async getPublicUser(user_id: string, opts?: FindOneOptions<User>) {
const user = await User.findOne(
return await User.findOneOrFail(
{ id: user_id },
{
...opts,
select: [...PublicUserProjection, ...(opts?.select || [])],
}
);
if (!user) throw new HTTPError("User not found", 404);
return user;
}
}