Aethel Bot OSS repository! aethel.xyz
bot fun ai discord discord-bot aethel

fix: try and expose the frontend correctly and remove the bot's ability to ping everyone/here

+28 -9
+14 -3
Dockerfile
··· 17 17 RUN corepack prepare pnpm@latest --activate 18 18 19 19 COPY package.json pnpm-lock.yaml ./ 20 - 21 20 RUN pnpm install --frozen-lockfile 22 21 23 22 COPY src ./src ··· 32 31 WORKDIR /app/web 33 32 34 33 COPY web/package.json web/pnpm-lock.yaml ./ 35 - 36 34 RUN pnpm install --frozen-lockfile 35 + 37 36 COPY web/src ./src 38 37 COPY web/public ./public 39 38 COPY web/index.html ./ ··· 47 46 48 47 FROM node:20-alpine AS production 49 48 49 + ARG SOURCE_COMMIT 50 + ARG VITE_BOT_API_URL 51 + ARG VITE_STATUS_API_KEY 52 + ARG VITE_FRONTEND_URL 53 + 54 + ENV SOURCE_COMMIT=${SOURCE_COMMIT} 55 + ENV NODE_ENV=production 56 + ENV VITE_BOT_API_URL=${VITE_BOT_API_URL} 57 + ENV VITE_STATUS_API_KEY=${VITE_STATUS_API_KEY} 58 + ENV VITE_FRONTEND_URL=${VITE_FRONTEND_URL} 59 + 50 60 RUN addgroup -g 1001 -S nodejs && \ 51 61 adduser -S aethel -u 1001 52 62 53 63 WORKDIR /app 54 64 55 - RUN npm install -g pnpm 65 + RUN corepack enable 66 + RUN corepack prepare pnpm@latest --activate 56 67 57 68 COPY package.json pnpm-lock.yaml ./ 58 69 COPY .env* ./
+14 -6
src/events/messageCreate.ts
··· 247 247 } 248 248 249 249 if (!aiResponse) { 250 - await message.reply( 251 - 'Sorry, I encountered an error processing your message. Please try again later.', 252 - ); 250 + await message.reply({ 251 + content: 'Sorry, I encountered an error processing your message. Please try again later.', 252 + allowedMentions: { parse: ['users'] as const }, 253 + }); 253 254 return; 254 255 } 255 256 256 257 aiResponse.content = processUrls(aiResponse.content); 258 + aiResponse.content = aiResponse.content.replace(/@(everyone|here)/gi, '@\u200b$1'); 257 259 258 260 await this.sendResponse(message, aiResponse); 259 261 ··· 290 292 291 293 const maxLength = 2000; 292 294 if (fullResponse.length <= maxLength) { 293 - await message.reply(fullResponse); 295 + await message.reply({ 296 + content: fullResponse, 297 + allowedMentions: { parse: ['users'] as const }, 298 + }); 294 299 } else { 295 300 const chunks = splitResponseIntoChunks(fullResponse, maxLength); 296 301 297 - await message.reply(chunks[0]); 302 + await message.reply({ content: chunks[0], allowedMentions: { parse: ['users'] as const } }); 298 303 299 304 for (let i = 1; i < chunks.length; i++) { 300 305 if ('send' in message.channel) { 301 - await message.channel.send(chunks[i]); 306 + await message.channel.send({ 307 + content: chunks[i], 308 + allowedMentions: { parse: ['users'] as const }, 309 + }); 302 310 } 303 311 } 304 312 }