'Discord vanity sniper bot error: no such file or directory

Below code is for this discord vanity sniper bot I want to run on replit.com.

It shows up with a error.

Error:

internal/fs/utils.js:269
throw err;
^

Error:
ENOENT: no such file or directory, open '/home/runner/RudePartialBuckets/index.js'
at Object.openSync (fs.js:462:3)
at Object.readFileSync (fs.js:364:35)
at Object. (/run_dir/interp.js:195:19)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/home/runner/RudePartialBuckets/index.js'
}

Code:

const Discord = require('discord.js'),
client = new Discord.Client(),
moment = require("moment-timezone"),
fetch = require('node-fetch');

class Main {
constructor() {
this.sniperInterval;
}

async setVanityURL(url, guild) {
const time = moment.tz(Date.now(), "Europe/Paris").format("HH:mm:ss");
console.log(`[${time}] [LOG] Sniping discord.gg/${url}`);
return await fetch(`https://discord.com/api/v8/guilds/${guild.id}/vanity-url`, {
    "credentials": "include",
    "headers": {
        "accept": "*/*",
        "authorization": "Bot " + client.token,
        "content-type": "application/json",
    },
    "referrerPolicy": "no-referrer-when-downgrade",
    "body": JSON.stringify({
        "code": url
    }),
    "method": "PATCH",
    "mode": "cors"
});
}
async checkVanityURL(url) {
return await fetch(`https://discord.com/api/v8/guilds/${guild.id}/vanity-url`, {
    "credentials": "include",
    "headers": {
        "accept": "*/*",
        "authorization": "Bot " + client.token,
        "content-type": "application/json",
    },
    "referrerPolicy": "no-referrer-when-downgrade",
    "method": "GET",
    "mode": "cors"
});
}

async startSnipe(url, guild) {
this.sniperInterval = setInterval(async () => {
    await this.setVanityURL(url, guild);
}, 1000);
}

stopSnipe() {
return clearInterval(this.sniperInterval);
}
}
const prefix = ".";

let handler = new Main();

client.on('message', async (message) => {
let messageArray = message.content.split(" "),
args = messageArray.slice(1);
const args1 = message.content.slice(prefix.length).split(/ +/),
  command = args1.shift().toLowerCase();

if (command === "start-snipe") {
let url = args[0];


if (!message.guild.features.includes('VANITY_URL')) {
    return message.reply("You don't have level 3 boost !");
};

message.reply(`Start sniping the url ${url} now!`);
console.log(`[LOG] Start sniping the url ${url} now!`);
await handler.startSnipe(url, message.guild);
};

if (command === "stop-snipe") {
handler.stopSnipe();
};


});
client.login("YOUR BOT TOKEN"); 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source