Skip to content

Commit

Permalink
add; redis
Browse files Browse the repository at this point in the history
  • Loading branch information
maamokun committed Dec 12, 2024
1 parent 67bcd23 commit 504fa22
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 31 deletions.
Binary file modified bun.lockb
Binary file not shown.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
},
"devDependencies": {
"@types/bun": "latest",
"prisma": "5.15.1"
"prisma": "^6.0.1"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"@baselime/pino-transport": "^0.1.5",
"@biomejs/biome": "^1.8.2",
"@prisma/client": "^5.15.1",
"@prisma/client": "^6.0.1",
"discord.js": "^14.15.3",
"elysia": "^1.1.5",
"pino": "^9.5.0"
"pino": "^9.5.0",
"redis": "^4.7.0"
}
}
47 changes: 23 additions & 24 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,36 @@ generator client {
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
}

model User {
id String @id
premium Boolean @default(false)
id String @id
premium Boolean @default(false)
premiumUntil DateTime?
levelCard String @default("https://cdn.mikn.dev/bot-assets/mikanbot/default-lvlcard.png")
rankColor String @default("FF7700")
mdUID String @default("unlinked")
levelCard String @default("https://cdn.mikn.dev/bot-assets/mikanbot/default-lvlcard.png")
rankColor String @default("FF7700")
mdUID String @default("unlinked")
}

model guildLvl {
id String @id
level Int
xp Int
cooldown DateTime @default(now())
id String @id
level Int
xp Int
cooldown DateTime @default(now())
}

model server {
id String @id
name String
ownerId String
premium Boolean @default(false)
premiumUntil DateTime?
logChannel String @default("none")
prefix String @default("m?")
autoRole String @default("none")
autoRoleChannel String @default("none")
verificationRole String @default("none")
verificationChannel String @default("none")
levelsEnabled Boolean @default(false)
levelsMessage String @default("Congratulations, {user}! You've leveled up to level {level}!")
}
id String @id
name String
ownerId String
premium Boolean @default(false)
premiumUntil DateTime?
logChannel String @default("none")
prefix String @default("m?")
autoRole String @default("none")
autoRoleChannel String @default("none")
verificationRole String @default("none")
verificationChannel String @default("none")
levelsEnabled Boolean @default(false)
levelsMessage String @default("Congratulations, {user}! You've leveled up to level {level}!")
}
12 changes: 8 additions & 4 deletions src/handlers/ratelimit.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
const { QuickDB, MemoryDriver } = require("quick.db");
const memoryDriver = new MemoryDriver();
const db = new QuickDB({ driver: memoryDriver });
import { createClient } from "redis";
import { type CommandInteraction } from "discord.js";

export default function setRatelimit(type, time, user) {
const redis = createClient({
url: process.env.REDIS_URL,
});

export default function setRatelimit(type: string, interaction: CommandInteraction) {
if (type == "msg") {

}
}

0 comments on commit 504fa22

Please sign in to comment.