Enhance bot functionality with AutoMod, Logging, Welcome, and Verification features

- Implemented AutoMod capabilities including spam filtering, anti-raid, and anti-nuke actions.
- Added Logging module to track moderation actions and events across the bot.
- Introduced Welcome module for customizable welcome messages and autoroles.
- Developed Verification system with captcha and role assignment features.
- Updated Prisma schema to include new models for AutoMod, Logging, Welcome, and Verification.
- Enhanced command localization for new features in both German and English.
- Improved health server to handle captcha verification requests.
- Added new environment variable for public base URL to support captcha links.
This commit is contained in:
smueller
2026-07-22 12:28:42 +02:00
parent a44f4d6641
commit 2518119257
37 changed files with 3002 additions and 108 deletions

View File

@@ -0,0 +1,148 @@
-- CreateTable
CREATE TABLE "AutoModConfig" (
"id" TEXT NOT NULL,
"guildId" TEXT NOT NULL,
"enabled" BOOLEAN NOT NULL DEFAULT true,
"antiRaidEnabled" BOOLEAN NOT NULL DEFAULT false,
"antiRaidJoinThreshold" INTEGER NOT NULL DEFAULT 10,
"antiRaidWindowSeconds" INTEGER NOT NULL DEFAULT 10,
"antiRaidAction" TEXT NOT NULL DEFAULT 'LOCKDOWN',
"antiNukeEnabled" BOOLEAN NOT NULL DEFAULT false,
"antiNukeBanThreshold" INTEGER NOT NULL DEFAULT 5,
"antiNukeChannelThreshold" INTEGER NOT NULL DEFAULT 3,
"antiNukeWindowSeconds" INTEGER NOT NULL DEFAULT 60,
"lockdownActive" BOOLEAN NOT NULL DEFAULT false,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "AutoModConfig_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "AutoModRule" (
"id" TEXT NOT NULL,
"guildId" TEXT NOT NULL,
"ruleType" TEXT NOT NULL,
"enabled" BOOLEAN NOT NULL DEFAULT true,
"action" TEXT NOT NULL DEFAULT 'DELETE',
"threshold" JSONB,
"exceptions" JSONB,
"wordList" JSONB,
"durationMs" INTEGER,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "AutoModRule_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "LoggingConfig" (
"id" TEXT NOT NULL,
"guildId" TEXT NOT NULL,
"enabled" BOOLEAN NOT NULL DEFAULT true,
"ignoreBots" BOOLEAN NOT NULL DEFAULT true,
"ignoredChannelIds" TEXT[] DEFAULT ARRAY[]::TEXT[],
"ignoredRoleIds" TEXT[] DEFAULT ARRAY[]::TEXT[],
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "LoggingConfig_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "LogChannel" (
"id" TEXT NOT NULL,
"guildId" TEXT NOT NULL,
"eventType" TEXT NOT NULL,
"channelId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "LogChannel_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "WelcomeConfig" (
"id" TEXT NOT NULL,
"guildId" TEXT NOT NULL,
"welcomeEnabled" BOOLEAN NOT NULL DEFAULT false,
"leaveEnabled" BOOLEAN NOT NULL DEFAULT false,
"welcomeChannelId" TEXT,
"leaveChannelId" TEXT,
"welcomeType" TEXT NOT NULL DEFAULT 'TEXT',
"welcomeContent" TEXT,
"welcomeEmbed" JSONB,
"leaveContent" TEXT,
"leaveEmbed" JSONB,
"welcomeDmEnabled" BOOLEAN NOT NULL DEFAULT false,
"welcomeDmContent" TEXT,
"userAutoroleIds" TEXT[] DEFAULT ARRAY[]::TEXT[],
"botAutoroleIds" TEXT[] DEFAULT ARRAY[]::TEXT[],
"imageTitle" TEXT,
"imageSubtitle" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "WelcomeConfig_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "VerificationConfig" (
"id" TEXT NOT NULL,
"guildId" TEXT NOT NULL,
"enabled" BOOLEAN NOT NULL DEFAULT false,
"channelId" TEXT,
"verifiedRoleId" TEXT,
"unverifiedRoleId" TEXT,
"mode" TEXT NOT NULL DEFAULT 'BUTTON',
"minAccountAgeDays" INTEGER NOT NULL DEFAULT 0,
"failAction" TEXT NOT NULL DEFAULT 'KICK',
"panelChannelId" TEXT,
"panelMessageId" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "VerificationConfig_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "AutoModConfig_guildId_key" ON "AutoModConfig"("guildId");
-- CreateIndex
CREATE INDEX "AutoModRule_guildId_enabled_idx" ON "AutoModRule"("guildId", "enabled");
-- CreateIndex
CREATE UNIQUE INDEX "AutoModRule_guildId_ruleType_key" ON "AutoModRule"("guildId", "ruleType");
-- CreateIndex
CREATE UNIQUE INDEX "LoggingConfig_guildId_key" ON "LoggingConfig"("guildId");
-- CreateIndex
CREATE INDEX "LogChannel_guildId_idx" ON "LogChannel"("guildId");
-- CreateIndex
CREATE UNIQUE INDEX "LogChannel_guildId_eventType_key" ON "LogChannel"("guildId", "eventType");
-- CreateIndex
CREATE UNIQUE INDEX "WelcomeConfig_guildId_key" ON "WelcomeConfig"("guildId");
-- CreateIndex
CREATE UNIQUE INDEX "VerificationConfig_guildId_key" ON "VerificationConfig"("guildId");
-- AddForeignKey
ALTER TABLE "AutoModConfig" ADD CONSTRAINT "AutoModConfig_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "AutoModRule" ADD CONSTRAINT "AutoModRule_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "LoggingConfig" ADD CONSTRAINT "LoggingConfig_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "LogChannel" ADD CONSTRAINT "LogChannel_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "WelcomeConfig" ADD CONSTRAINT "WelcomeConfig_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "VerificationConfig" ADD CONSTRAINT "VerificationConfig_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@@ -14,6 +14,12 @@ model Guild {
settings GuildSettings?
cases Case[]
escalationRules EscalationRule[]
autoModConfig AutoModConfig?
autoModRules AutoModRule[]
loggingConfig LoggingConfig?
logChannels LogChannel[]
welcomeConfig WelcomeConfig?
verificationConfig VerificationConfig?
}
model GuildSettings {
@@ -96,3 +102,104 @@ model EscalationRule {
@@unique([guildId, warnCount])
@@index([guildId, enabled])
}
model AutoModConfig {
id String @id @default(cuid())
guildId String @unique
enabled Boolean @default(true)
antiRaidEnabled Boolean @default(false)
antiRaidJoinThreshold Int @default(10)
antiRaidWindowSeconds Int @default(10)
antiRaidAction String @default("LOCKDOWN")
antiNukeEnabled Boolean @default(false)
antiNukeBanThreshold Int @default(5)
antiNukeChannelThreshold Int @default(3)
antiNukeWindowSeconds Int @default(60)
lockdownActive Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
}
model AutoModRule {
id String @id @default(cuid())
guildId String
ruleType String
enabled Boolean @default(true)
action String @default("DELETE")
threshold Json?
exceptions Json?
wordList Json?
durationMs Int?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
@@unique([guildId, ruleType])
@@index([guildId, enabled])
}
model LoggingConfig {
id String @id @default(cuid())
guildId String @unique
enabled Boolean @default(true)
ignoreBots Boolean @default(true)
ignoredChannelIds String[] @default([])
ignoredRoleIds String[] @default([])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
}
model LogChannel {
id String @id @default(cuid())
guildId String
eventType String
channelId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
@@unique([guildId, eventType])
@@index([guildId])
}
model WelcomeConfig {
id String @id @default(cuid())
guildId String @unique
welcomeEnabled Boolean @default(false)
leaveEnabled Boolean @default(false)
welcomeChannelId String?
leaveChannelId String?
welcomeType String @default("TEXT")
welcomeContent String?
welcomeEmbed Json?
leaveContent String?
leaveEmbed Json?
welcomeDmEnabled Boolean @default(false)
welcomeDmContent String?
userAutoroleIds String[] @default([])
botAutoroleIds String[] @default([])
imageTitle String?
imageSubtitle String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
}
model VerificationConfig {
id String @id @default(cuid())
guildId String @unique
enabled Boolean @default(false)
channelId String?
verifiedRoleId String?
unverifiedRoleId String?
mode String @default("BUTTON")
minAccountAgeDays Int @default(0)
failAction String @default("KICK")
panelChannelId String?
panelMessageId String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
}