Discord.js bot works on local machines but not on azure linux vm

Viewed 98

I have been working on a discord bot using discord.js and it works perfectly on my local machines (Windows and Linux Ubuntu). I recently got a Microsoft Azure Linux virtual machine and installed node.js, npm, and discord.js on it successfully in order to run my bot. I made a "test" bot to see if the virtual machine works with the following code:

    const {Client, Intents } = require('discord.js');
    const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
    token = "hidden";
    client.on("ready", () => {
      console.log(`Logged in as ${client.user.tag}!`);
    });
    client.on("message", message => {
      if (message.content === "ping") {
        message.reply("pong");
      }
    });

    client.login(token);

When I run this code on my Linux virtual machine the console will display the correct client user tag(the right account), but the bot won't reply pong as it is supposed to. I have run this exact code on other machines, and it has worked fine. Any help is appreciated.

0 Answers
Related