Update bot.js
Browse files
bot.js
CHANGED
|
@@ -175,6 +175,7 @@ let botActions = {
|
|
| 175 |
openCiftciAndSellAllManual: null,
|
| 176 |
goToIslandManual: null,
|
| 177 |
sendSkyblockManual: null,
|
|
|
|
| 178 |
};
|
| 179 |
|
| 180 |
function formatDurationMs(ms) {
|
|
@@ -1059,6 +1060,36 @@ async function createBot() {
|
|
| 1059 |
}
|
| 1060 |
}
|
| 1061 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1062 |
function scheduleNextCheck(delayMs) {
|
| 1063 |
if (periodicTimeoutHandle) {
|
| 1064 |
clearTimeout(periodicTimeoutHandle);
|
|
@@ -1580,6 +1611,7 @@ function activateEntityAtNoLook(entity, position) {
|
|
| 1580 |
botActions.openCiftciAndSellAllManual = openCiftciAndSellAllManual;
|
| 1581 |
botActions.goToIslandManual = goToIsland;
|
| 1582 |
botActions.sendSkyblockManual = sendSkyblockCommand;
|
|
|
|
| 1583 |
|
| 1584 |
startKaziciPeriodic();
|
| 1585 |
startCiftciPeriodic();
|
|
@@ -2102,6 +2134,40 @@ app.get("/bot/is-go", (req, res) => {
|
|
| 2102 |
res.send({ success: true, message: `${GO_ISLAND_COMMAND} komutu gönderildi.` });
|
| 2103 |
});
|
| 2104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2105 |
app.get("/", (req, res) => res.send("Bot Aktif"));
|
| 2106 |
|
| 2107 |
app.get("/messages", (req, res) => {
|
|
|
|
| 175 |
openCiftciAndSellAllManual: null,
|
| 176 |
goToIslandManual: null,
|
| 177 |
sendSkyblockManual: null,
|
| 178 |
+
antiBotMove: null
|
| 179 |
};
|
| 180 |
|
| 181 |
function formatDurationMs(ms) {
|
|
|
|
| 1060 |
}
|
| 1061 |
}
|
| 1062 |
|
| 1063 |
+
async function antiBotMove() {
|
| 1064 |
+
if (!bot || !botIsReady) return;
|
| 1065 |
+
try {
|
| 1066 |
+
const moves = ['forward', 'left', 'right', 'jump'];
|
| 1067 |
+
|
| 1068 |
+
const moveCount = Math.floor(Math.random() * 4) + 2; // 2-5 hareket
|
| 1069 |
+
|
| 1070 |
+
for (let i = 0; i < moveCount; i++) {
|
| 1071 |
+
const move = moves[Math.floor(Math.random() * moves.length)];
|
| 1072 |
+
const duration = 150 + Math.floor(Math.random() * 500);
|
| 1073 |
+
|
| 1074 |
+
bot.setControlState(move, true);
|
| 1075 |
+
await new Promise(r => setTimeout(r, duration));
|
| 1076 |
+
bot.setControlState(move, false);
|
| 1077 |
+
|
| 1078 |
+
await new Promise(r => setTimeout(r, 100 + Math.random() * 300));
|
| 1079 |
+
|
| 1080 |
+
}
|
| 1081 |
+
|
| 1082 |
+
// Rastgele kafa hareketi
|
| 1083 |
+
await bot.look(
|
| 1084 |
+
bot.entity.yaw + ((Math.random() - 0.5) * 1.5),
|
| 1085 |
+
bot.entity.pitch + ((Math.random() - 0.5) * 0.3),
|
| 1086 |
+
true
|
| 1087 |
+
);
|
| 1088 |
+
} catch (err) {
|
| 1089 |
+
logger.error(`[antiBotMove Hatası] Komut gönderilemedi: ${err && err.message ? err.message : err}`);
|
| 1090 |
+
}
|
| 1091 |
+
};
|
| 1092 |
+
|
| 1093 |
function scheduleNextCheck(delayMs) {
|
| 1094 |
if (periodicTimeoutHandle) {
|
| 1095 |
clearTimeout(periodicTimeoutHandle);
|
|
|
|
| 1611 |
botActions.openCiftciAndSellAllManual = openCiftciAndSellAllManual;
|
| 1612 |
botActions.goToIslandManual = goToIsland;
|
| 1613 |
botActions.sendSkyblockManual = sendSkyblockCommand;
|
| 1614 |
+
botActions.antiBotMove = antiBotMove();
|
| 1615 |
|
| 1616 |
startKaziciPeriodic();
|
| 1617 |
startCiftciPeriodic();
|
|
|
|
| 2134 |
res.send({ success: true, message: `${GO_ISLAND_COMMAND} komutu gönderildi.` });
|
| 2135 |
});
|
| 2136 |
|
| 2137 |
+
app.get("/bot/sendmsg", (req, res) => {
|
| 2138 |
+
if (!bot || !botIsReady) {
|
| 2139 |
+
return res.status(503).send({ success: false, message: "Bot hazır değil." });
|
| 2140 |
+
}
|
| 2141 |
+
|
| 2142 |
+
const message = req.query.message;
|
| 2143 |
+
if (!message || typeof message !== "string" || message.trim().length === 0) {
|
| 2144 |
+
return res.status(400).send({ success: false, message: "message query parametresi zorunlu." });
|
| 2145 |
+
}
|
| 2146 |
+
|
| 2147 |
+
try {
|
| 2148 |
+
bot.chat(message);
|
| 2149 |
+
logger.info(`[${bot.username}] /sendmsg üzerinden chat mesajı gönderildi: ${message}`);
|
| 2150 |
+
res.send({ success: true, message: "Mesaj gönderildi.", sent: message });
|
| 2151 |
+
} catch (err) {
|
| 2152 |
+
logger.error(`[/bot/sendmsg Hatası] ${err && err.message ? err.message : err}`);
|
| 2153 |
+
res.status(500).send({ success: false, message: "Mesaj gönderilirken hata oluştu." });
|
| 2154 |
+
}
|
| 2155 |
+
});
|
| 2156 |
+
|
| 2157 |
+
app.get("/bot/antibotmove", (req, res) => {
|
| 2158 |
+
if (!bot || !botIsReady) {
|
| 2159 |
+
return res.status(503).send({ success: false, message: "Bot hazır değil." });
|
| 2160 |
+
}
|
| 2161 |
+
|
| 2162 |
+
try {
|
| 2163 |
+
botActions.antiBotMove().catch(e => logger.error(`[/bot/antibotmove Hatası] ${e && e.stack ? e.stack : e}`));
|
| 2164 |
+
res.send({ success: true, message: "Anti Bot Yürüyüşü Yapıldı."});
|
| 2165 |
+
} catch (err) {
|
| 2166 |
+
logger.error(`[/bot/antibotmove Hatası] ${err && err.message ? err.message : err}`);
|
| 2167 |
+
res.status(500).send({ success: false, message: "Anti Bot Move sırasında hata oluştu." });
|
| 2168 |
+
}
|
| 2169 |
+
});
|
| 2170 |
+
|
| 2171 |
app.get("/", (req, res) => res.send("Bot Aktif"));
|
| 2172 |
|
| 2173 |
app.get("/messages", (req, res) => {
|