Update index.js

This commit is contained in:
m_c_player 2024-10-27 18:32:25 -04:00
parent 87a10ab00c
commit 7d19d08ec4

View file

@ -9,6 +9,7 @@ class MinecraftBot {
this.commands = new Map(); this.commands = new Map();
this.setupBot(); this.setupBot();
this.setupConsoleInput(); this.setupConsoleInput();
this.cloopIntv = null;
} }
generateRandom(length) { generateRandom(length) {
@ -43,7 +44,7 @@ class MinecraftBot {
setupBot() { setupBot() {
this.bot = mineflayer.createBot({ this.bot = mineflayer.createBot({
host: 'chipmunk.land', host: 'kaboom.pw',
port: 25565, port: 25565,
username: `${this.generateRandom(3)}_iBot_${this.generateRandom(3)}`, username: `${this.generateRandom(3)}_iBot_${this.generateRandom(3)}`,
version: '1.19.4', version: '1.19.4',
@ -72,7 +73,7 @@ class MinecraftBot {
setTimeout(() => { setTimeout(() => {
const readyMessage = new Tellraw() const readyMessage = new Tellraw()
.add(new Text("Bot is ready!").color("white")) .add(new Text("Ibot Core").color("red"))
this.bot.core.fancyTellraw(readyMessage.get()); this.bot.core.fancyTellraw(readyMessage.get());
setTimeout(() => { setTimeout(() => {
@ -85,14 +86,15 @@ class MinecraftBot {
registerCommands() { registerCommands() {
this.commands.set('help', () => { this.commands.set('help', () => {
const helpMessage = new Tellraw() const helpMessage = new Tellraw()
.add(new Text("Commands:").color("white")) .add(new Text("Commands: [ §fPublic §cTrusted §4Owner §f] \n").color("white"))
.add(new Text("!hash [trusted/owner]").color("white")) .add(new Text("").color("white"))
.add(new Text("!tp").color("white")) .add(new Text("").color("white"))
.add(new Text("!credits ").color("white")) .add(new Text("!credits ").color("white"))
.add(new Text("!prefix ").color("white")) .add(new Text("!prefix ").color("white"))
.add(new Text("!auth").color("purple")) .add(new Text("!auth ").color("red"))
.add(new Text("!cloop ").color("red")) .add(new Text("!cloop ").color("red"))
.add(new Text("!refill ").color("white")) .add(new Text("!refill ").color("white"))
.add(new Text("!hash ").color("red"))
this.bot.core.fancyTellraw(helpMessage.get()); this.bot.core.fancyTellraw(helpMessage.get());
}); });
this.commands.set('tp', () => { this.commands.set('tp', () => {
@ -101,7 +103,7 @@ class MinecraftBot {
this.commands.set('credits', () => { this.commands.set('credits', () => {
const creditsMessage = new Tellraw() const creditsMessage = new Tellraw()
.add(new Text("By itzrealviktor").color("yellow")) .add(new Text("Itzrealviktor,Werkku,Yaode.owo,Imgloriz,t0rnado,PloatnO,mc_ce_player,Kuta222,Morgan.").color("yellow"))
this.bot.core.fancyTellraw(creditsMessage.get()); this.bot.core.fancyTellraw(creditsMessage.get());
}); });
@ -111,13 +113,23 @@ class MinecraftBot {
this.commands.set('auth', () => { this.commands.set('auth', () => {
const authMessage = new Tellraw() const authMessage = new Tellraw()
.add(new Text("idk").color("white")) .add(new Text("Comming soon!").color("white"))
this.bot.core.fancyTellraw(authMessage.get()); this.bot.core.fancyTellraw(authMessage.get());
}); });
this.commands.set('cloop', () => { this.commands.set('cloop', () => {
const cloopMessage = new Tellraw() //const cloopMessage = new Tellraw()
.add(new Text("idk").color("white")) //.add(new Text("Comming soon!").color("white"));
if(this.cloopIntv != null) {//if cloop exists then remove it
clearInterval(this.cloopIntv);
this.cloopIntv = null;
} else {
let interv = 1000;//ms
this.cloopIntv = setInterval(() => {
this.bot.core.run("say gex");
}, interv);
}
this.bot.core.fancyTellraw(cloopMessage.get()); this.bot.core.fancyTellraw(cloopMessage.get());
}); });
@ -155,15 +167,15 @@ class MinecraftBot {
this.generateNewHash('owner'); this.generateNewHash('owner');
} else { } else {
const errorMessage = new Tellraw() const errorMessage = new Tellraw()
.add(new Text("Invalid hash dude.").color("red")) .add(new Text("Invalid hash.").color("red"))
this.bot.core.fancyTellraw(errorMessage.get()); this.bot.core.fancyTellraw(errorMessage.get());
} }
} }
handlePrefixCommand() { handlePrefixCommand() {
const commands = [ const commands = [
() => this.bot.chat('/rank &1Bot'), () => this.bot.chat('/c on'),
() => this.bot.chat('/rank &7{Prefix:!help} ') () => this.bot.chat('/rank &7[Prefix: %s]', this.prefix)
]; ];
commands.forEach((cmd, index) => { commands.forEach((cmd, index) => {