Modernize Discord bot to v14 and Node.js 22
Major upgrades and architectural improvements: - Upgrade Discord.js from v12 to v14.21.0 - Upgrade Node.js from 14 to 22 LTS - Switch to pnpm package manager - Complete rewrite with modern Discord API patterns New Features: - Hybrid command system: prefix commands + slash commands - /sfx slash command with autocomplete for sound discovery - Modern @discordjs/voice integration for audio - Improved voice connection management - Enhanced logging for SFX commands - Multi-stage Docker build for optimized images Technical Improvements: - Modular architecture with services and command handlers - Proper intent management for Discord gateway - Better error handling and logging - Hot-reload capability maintained - Environment variable support - Optimized Docker container with Alpine Linux Breaking Changes: - Moved main entry from index.js to src/index.js - Updated configuration structure for v14 compatibility - Replaced deprecated voice APIs with @discordjs/voice - Updated audio dependencies (opus, ffmpeg) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
34
Dockerfile
34
Dockerfile
@@ -1,17 +1,33 @@
|
||||
# Use the official Node.js image as the base image
|
||||
FROM node:14
|
||||
# Build stage
|
||||
FROM node:22-alpine AS builder
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json to the working directory
|
||||
COPY package*.json ./
|
||||
# Copy package files
|
||||
COPY package*.json pnpm-lock.yaml* ./
|
||||
|
||||
# Install the dependencies
|
||||
RUN npm install
|
||||
# Install latest pnpm and build dependencies (including ffmpeg for audio processing)
|
||||
RUN npm install -g pnpm@latest && \
|
||||
apk add --no-cache python3 make g++ ffmpeg opus-dev
|
||||
|
||||
# Copy the rest of the application code to the working directory
|
||||
# Install dependencies (including native modules that need compilation)
|
||||
RUN pnpm install --force
|
||||
|
||||
# Production stage
|
||||
FROM node:22-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install latest pnpm and runtime dependencies
|
||||
RUN npm install -g pnpm@latest && \
|
||||
apk add --no-cache ffmpeg opus
|
||||
|
||||
# Copy package files and installed dependencies from builder
|
||||
COPY package*.json pnpm-lock.yaml* ./
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
|
||||
# Copy application code
|
||||
COPY . .
|
||||
|
||||
# Start the bot
|
||||
CMD [ "node", "index.js" ]
|
||||
CMD [ "node", "src/index.js" ]
|
||||
Reference in New Issue
Block a user