Using proxies

Hi there! Im trying to make a Minecraft bot and i cant figure out how can i route its trafic through a proxy. This is my code:
import { createBot } from "npm:mineflayer";
import { handleLogin } from "./handlers/login.ts";
import { handleError } from "./handlers/error.ts";
import { handleSpawn } from "./handlers/spawn.ts";
import { handlePhysickTick } from "./handlers/physickTick.ts";

declare module "npm:mineflayer" {
  interface BotOptions {
    debug?: boolean;
  }

  interface Bot {
    debug?: boolean;
    state: number;
  }
}

const env = Deno.env.toObject();

const bot = createBot({
  host: env.HOST,
  port: Number(env.PORT),
  username: "..",
  version: env.VERSION,
});

bot.debug = env.DEBUG === "true" || false;
bot.state = 0;

bot.on("error", (err) => handleError(err));
bot.on("login", () => handleLogin(bot));
bot.on("physicTick", () => handlePhysickTick());
bot.on("spawn", () => handleSpawn(bot));
Was this page helpful?