Skip to content

Commit 38ac7b7

Browse files
committed
Prevent view count increment for specific usernames
1 parent 4c72d55 commit 38ac7b7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/database/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import "./patch";
33
export async function increaseViews(username: string, env: Cloudflare.Env): Promise<number> {
44
if (username === "example") return 0;
55

6+
// No views for thebabayaga or thebabayagakiller, don't spam the api bro
7+
if (username === "thebabayaga" || username === "thebabayagakiller") return 0;
8+
69
const kv = env.views;
710
if (!kv) throw new Error("KV Namespace not available! Check your configuration - The KV namespace should be named 'views'.");
811

912
const currentViews = Number((await kv.get(username)) || 0);
10-
11-
// Increase views by 1
1213
const newViews = currentViews + 1;
1314
await kv.put(username, newViews.toString());
1415

0 commit comments

Comments
 (0)