Something go wrong with my discord bot

Hey everyone, I had deployed my discord bot on fly.io for a while and everything just worked fine except one small problem.

When someone joins the server, the bot always sends welcome messages three times, but when I host on my computer it only sends once.
Is this a problem about the number of VMs I used? And how can I fix it??

Thanks for all your replies!

  • What is your run script like?
  • Are there any differences in environment variables from local to production that would cause any routes to sending information twice?
  • What happens if you try to use just 1 vm instance and test the bot with a test discord account and see what happens?

Thanks!! :slight_smile:

  1. Here is my docker file contents:

`ARG NODE_VERSION=19.8.1
FROM node:${NODE_VERSION}-slim as base

LABEL fly_launch_runtime=“Node.js”

Node.js app lives here

WORKDIR /app

Set production environment

ENV NODE_ENV=“production”

Throw-away build stage to reduce size of final image

FROM base as build

Install packages needed to build node modules

RUN apt-get update -qq &&
apt-get install -y build-essential pkg-config python-is-python3

Install node modules

COPY --link package-lock.json package.json ./
RUN npm ci

Copy application code

COPY --link . .

Final stage for app image

FROM base

Copy built application

COPY --from=build /app /app

Start the server by default, this can be overwritten at runtime

EXPOSE 3000
CMD [ “npm”, “run”, “start” ]`

  1. Seems like not, all variables are just the same, and I used .env to set global variables on my local computer

  2. Actually I haven’t tried it yet, is there any command to do that??

Thanks for your reply!!!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.