Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:
- uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
Expand All @@ -26,12 +24,12 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
run: pnpm turbo build
- name: Build production image
run: docker build -t quest-bot:test .
- name: Test production image
run: >
docker run --rm --entrypoint sh quest-bot:test -c
"set -e;
test -f /app/dist/index.js;
node --check /app/dist/index.js"
test -f /app/apps/bot/dist/index.js;
node --check /app/apps/bot/dist/index.js"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
generated
dist
.vscode
.turbo
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ RUN corepack enable

COPY package.json pnpm-lock.yaml ./
COPY pnpm-workspace.yaml ./
COPY prisma ./prisma/
COPY apps/bot/package.json ./apps/bot/package.json
COPY apps/bot/prisma ./apps/bot/prisma/
RUN pnpm install --frozen-lockfile

COPY . .
RUN pnpm run build
RUN pnpm --filter @quest/bot build

FROM node:24-alpine
WORKDIR /app
Expand All @@ -18,10 +19,11 @@ RUN corepack enable

COPY package.json pnpm-lock.yaml ./
COPY pnpm-workspace.yaml ./
COPY prisma.config.ts ./
COPY prisma ./prisma/
RUN pnpm install --prod --frozen-lockfile
COPY apps/bot/package.json ./apps/bot/package.json
COPY apps/bot/prisma.config.ts ./apps/bot/prisma.config.ts
COPY apps/bot/prisma ./apps/bot/prisma/
RUN pnpm install --prod --frozen-lockfile --filter @quest/bot

COPY --from=builder /app/dist ./dist
COPY --from=builder /app/apps/bot/dist ./apps/bot/dist

CMD ["sh", "-c", "pnpm prisma db push && pnpm start"]
CMD ["sh", "-c", "pnpm --filter @quest/bot db:push && pnpm --filter @quest/bot start"]
1 change: 1 addition & 0 deletions apps/bot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.turbo
49 changes: 49 additions & 0 deletions apps/bot/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@quest/bot",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"build": "rimraf dist && prisma generate && tsc",
"lint": "prettier --check . && eslint --ext .ts --format=pretty src",
"format": "prettier --write . && eslint --ext .ts --fix --format=pretty src",
"predev": "pnpm build",
"start": "node --env-file-if-exists=../../.env dist/sharder.js",
"dev": "concurrently \"tsc --watch\" \"node --watch --env-file-if-exists=../../.env dist/index.js\"",
"db:push": "prisma db push",
"db:generate": "prisma generate"
},
"dependencies": {
"@discordjs/core": "^2.3.0",
"@prisma/adapter-pg": "^7.7.0",
"@prisma/client": "^7.7.0",
"@sapphire/framework": "^5.5.0",
"@types/ms": "^2.1.0",
"discord.js": "^14.24.0",
"dotenv": "^17.4.2",
"ms": "^2.1.3",
"prisma": "^7.7.0",
"zod": "^4.3.6"
},
"devDependencies": {
"@sapphire/ts-config": "^5.0.1",
"@types/node": "^22.18.8",
"concurrently": "^9.2.1",
"eslint": "^9.39.4",
"eslint-config-neon": "^0.2.7",
"eslint-formatter-compact": "^8.40.0",
"eslint-formatter-pretty": "^7.0.0",
"prettier": "^3.6.2",
"rimraf": "^6.1.3",
"typescript": "~5.9.3"
},
"engines": {
"node": ">=22.12.0"
},
"imports": {
"#utils/*": "./dist/util/*",
"#lib/*": "./dist/lib/*",
"#prisma/*": "./dist/generated/prisma/*"
}
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ export class AutoModCommand extends Command {
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
registry.registerChatInputCommand((builder: any) =>
builder
.setName('automod')
.setDescription('Block words from being said!')
.addSubcommand((sub) =>
.addSubcommand((sub: any) =>
sub
.setName('add')
.setDescription('Create a new automod rule.')
.addStringOption((option) =>
.addStringOption((option: any) =>
option.setName('word').setDescription('The word to block').setRequired(true)
)
)
.addSubcommand((sub) =>
.addSubcommand((sub: any) =>
sub
.setName('remove')
.setDescription('Remove words from the automod list.')
.addStringOption((option) =>
.addStringOption((option: any) =>
option
.setName('word')
.setDescription('The word to remove')
.setAutocomplete(true)
.setRequired(true)
)
)
.addSubcommand((sub) =>
.addSubcommand((sub: any) =>
sub
.setName('list')
.setDescription('List all blocked words.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@ export class AutoRoleCommand extends Command {
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
registry.registerChatInputCommand((builder: any) =>
builder
.setName('autorole')
.setDescription('Automatically assign roles to new members!')
.addSubcommand((sub) =>
.addSubcommand((sub: any) =>
sub
.setName('add')
.setDescription('Create a new auto role.')
.addRoleOption((option) =>
.addRoleOption((option: any) =>
option.setName('role').setDescription('The role to assign to new members').setRequired(true)
)
.addBooleanOption((option) =>
.addBooleanOption((option: any) =>
option.setName('bot_role').setDescription('Whether this role should be assigned to bots').setRequired(true)
)
)
.addSubcommand((sub) =>
.addSubcommand((sub: any) =>
sub
.setName('remove')
.setDescription('Remove an auto role.')
.addStringOption((option) =>
.addStringOption((option: any) =>
option
.setName('role')
.setDescription('The auto role to remove')
.setAutocomplete(true)
.setRequired(true)
)
)
.addSubcommand((sub) =>
.addSubcommand((sub: any) =>
sub
.setName('list')
.setDescription('List all auto roles.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ export class BanCommand extends Command {
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
registry.registerChatInputCommand((builder: any) =>
builder
.setName('ban')
.setDescription('Ban someone from the discord server.')
.addUserOption((option) =>
.addUserOption((option: any) =>
option.setName('member').setDescription('Select a member to ban').setRequired(true)
)
.addStringOption((option) =>
.addStringOption((option: any) =>
option.setName('reason').setDescription('Provide a reason for their ban')
)
.addStringOption((option) =>
.addStringOption((option: any) =>
option.setName('duration').setDescription('Provide a duration for their ban (if needed)')
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export class UnbanCommand extends Command {
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
registry.registerChatInputCommand((builder: any) =>
builder
.setName('unban')
.setDescription('Unban someone from the discord server.')
.addUserOption((option) =>
.addUserOption((option: any) =>
option.setName('member').setDescription('The member to unban').setRequired(true)
)
.addStringOption((option) =>
.addStringOption((option: any) =>
option.setName('reason').setDescription('Provide a reason for their unban')
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export class KickCommand extends Command {
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
registry.registerChatInputCommand((builder: any) =>
builder
.setName('kick')
.setDescription('Kick someone from the discord server.')
.addUserOption((option) =>
.addUserOption((option: any) =>
option.setName('member').setDescription('Select a member to kick').setRequired(true)
)
.addStringOption((option) =>
.addStringOption((option: any) =>
option.setName('reason').setDescription('Provide a reason for their kick')
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ export class MuteCommand extends Command {
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
registry.registerChatInputCommand((builder: any) =>
builder
.setName('mute')
.setDescription('Mute someone in the discord server.')
.addUserOption((option) =>
.addUserOption((option: any) =>
option.setName('member').setDescription('Select a member to mute').setRequired(true)
)
.addStringOption((option) =>
.addStringOption((option: any) =>
option.setName('duration').setDescription('Specify a duration for the mute')
)
.addStringOption((option) =>
.addStringOption((option: any) =>
option.setName('reason').setDescription('Provide a reason for their mute')
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export class UnmuteCommand extends Command {
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
registry.registerChatInputCommand((builder: any) =>
builder
.setName('unmute')
.setDescription('Unmute someone in the discord server.')
.addUserOption((option) =>
.addUserOption((option: any) =>
option.setName('member').setDescription('Select a member to unmute').setRequired(true)
)
.addStringOption((option) =>
.addStringOption((option: any) =>
option.setName('reason').setDescription('Provide a reason for their unmute')
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export class PurgeCommand extends Command {
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
registry.registerChatInputCommand((builder: any) =>
builder
.setName('purge')
.setDescription('Purge messages from a channel.')
.addIntegerOption((option) =>
.addIntegerOption((option: any) =>
option
.setName('amount')
.setDescription('The number of messages to purge')
Expand Down Expand Up @@ -75,8 +75,8 @@ export class PurgeCommand extends Command {
if (!fetched.size) break;

const now = Date.now();
const recentMessages = fetched.filter((message) => now - message.createdTimestamp < FOURTEEN_DAYS);
const oldMessages = fetched.filter((message) => now - message.createdTimestamp >= FOURTEEN_DAYS);
const recentMessages = fetched.filter((message: any) => now - message.createdTimestamp < FOURTEEN_DAYS);
const oldMessages = fetched.filter((message: any) => now - message.createdTimestamp >= FOURTEEN_DAYS);

if (recentMessages.size) {
const deleted = await channel.bulkDelete(recentMessages, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export class SlowmodeCommand extends Command {
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
registry.registerChatInputCommand((builder: any) =>
builder
.setName('slowmode')
.setDescription('Set or clear the slowmode for the current channel.')
.addStringOption((option) =>
.addStringOption((option: any) =>
option.setName('duration').setDescription('Provide a duration for slowmode, or leave blank to remove it')
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export class UnwarnCommand extends Command {
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
registry.registerChatInputCommand((builder: any) =>
builder
.setName('unwarn')
.setDescription('Unwarn someone in the discord server.')
.addStringOption((option) =>
.addStringOption((option: any) =>
option.setName('id').setDescription('The ID of the warn to remove').setRequired(true)
)
.addStringOption((option) =>
.addStringOption((option: any) =>
option.setName('reason').setDescription('Provide a reason for removing the warn')
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ export class WarnCommand extends Command {
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
registry.registerChatInputCommand((builder: any) =>
builder
.setName('warn')
.setDescription('Warn someone in the discord server.')
.addUserOption((option) =>
.addUserOption((option: any) =>
option.setName('member').setDescription('Select a member to warn').setRequired(true)
)
.addStringOption((option) =>
.addStringOption((option: any) =>
option.setName('reason').setDescription('Provide a reason for their warn')
)
.addStringOption((option) =>
.addStringOption((option: any) =>
option.setName('duration').setDescription('Specify a duration for the warn')
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export class WarnsCommand extends Command {
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
registry.registerChatInputCommand((builder: any) =>
builder
.setName('warns')
.setDescription('View (someones) warns.')
.addUserOption((option) =>
.addUserOption((option: any) =>
option.setName('member').setDescription('Member to view warns of')
)
);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/ping.ts → apps/bot/src/commands/ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class PingCommand extends Command {
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
registry.registerChatInputCommand((builder: any) =>
builder.setName('ping').setDescription("Return the bot's latency.")
);
}
Expand Down
Loading