Closed ghost closed 3 years ago
please provide
Your current code
please provide
Your current code
It is very large, what exactly can be connected?
please provide
Your current code
This is the main part:
var bot = mineflayer.createBot(options)
navigatePlugin(bot);
bot.navigate.blocksToAvoid[132] = true;
bot.navigate.blocksToAvoid[59] = false;
bot.loadPlugin(tpsPlugin)
bot.settings.viewDistance = "tiny"
bot._client.on('map', ({ data,itemDamage })=> {
let invL = bot.inventory.slots.filter(el=> el !== null)
var itemD = (invL && invL[0] && invL[0].metadata || '')
if (itemDamage == itemD) {
if(!data) return;
const size = Math.sqrt(data.length);
const image = PNGImage.createImage(size, size);
for(let x = 0; x < size; x++) {
for(let z = 0; z < size; z++) {
const colorId = data[x + (z * size)];
image.setAt(x, z, md.getColor(colorId));
}
}
image.writeImage(`${__dirname}/captha.png`, function (err) {
if (err) throw err;
});
easyvk({access_token: token}).then(_vk => {
vk = _vk;
return vk.uploader.getUploadURL(
'photos.getMessagesUploadServer', {}, true
)
}).then(async ({url, vkr}) => {
const field = 'photo'
const server = vk.uploader
const filePath = path.join(__dirname, 'captha.png')
url = url.upload_url
let fileData = await server.uploadFile(url, filePath, field, {})
fileData = await vk.post('photos.saveMessagesPhoto', fileData)
fileData = fileData[0]
const attachments = [
`photo${fileData.owner_id}_${fileData.id}_${fileData.access_key}`
]
return vk.call('messages.send', {
user_id: ud,
attachment: attachments,
message: 'Капча',
random_id: easyvk.randomId()
});
});
}
});
bot.on('message', function (jsonMessage) {
if (chat == 1) {
easyvk({access_token: token}).then(_vk => {
vk = _vk;
return vk.call("messages.send", {
message: '[Чат]'+jsonMessage.toString(),
user_id: ud,
random_id: easyvk.randomId()
});
});
};
});
FixKick()
bot.on('respawn',() => {
bot.navigate.stop()
bot.waitForChunksToLoad(() => {
easyvk({access_token: token}).then(_vk => {
vk = _vk;
return vk.call("messages.send", {
message: "Бот заспавнился",
user_id: ud,
random_id: easyvk.randomId()
});
});
if (bot.currentWindow !== null) {
easyvk({access_token: token}).then(_vk => {
vk = _vk;
return vk.call("messages.send", {
message: "Закрыто окно",
user_id: ud,
random_id: easyvk.randomId()
})
})
bot.closeWindow(bot.currentWindow)
};
if (digging == 1) {
digging = 0
easyvk({access_token: token}).then(_vk => {
vk = _vk;
return vk.call("messages.send", {
message: "Бот прекратил копать.",
user_id: ud,
random_id: easyvk.randomId()
});
});
};
});
});
CLA()
bot.on("windowOpen", () => {
setTimeout(getW, 200)
});
bot.on("death", () => {
easyvk({access_token: token}).then(_vk => {
vk = _vk;
return vk.call("messages.send", {
message: 'Бот умер.',
user_id: ud,
random_id: easyvk.randomId()
});
});
})
bot.on('kicked', (reason, loggedIn) => {
easyvk({access_token: token}).then(_vk => {
vk = _vk;
return vk.call("messages.send", {
message: '['+options.username+']'+' '+'Вас кикнуло. Причина: '+reason+' '+loggedIn,
user_id: ud,
random_id: easyvk.randomId()
});
});
});
bot.on('end',() => {
easyvk({access_token: token}).then(_vk => {
vk = _vk;
return vk.call("messages.send", {
message: '['+options.username+']'+' '+'Бот выключен.',
user_id: ud,
random_id: easyvk.randomId()
}).then((vkr) => {
if (vkr.getFullResponse().response > 1) {
process.exit(1)
}
})
})
})
bot.on('error', err => {
easyvk({access_token: ''}).then(_vk => {
vk = _vk;
return vk.call("messages.send", {
message: 'У пользователя ошибка\n'+err+'\nник пользователя: '+options.username,
chat_id: 1,
random_id: easyvk.randomId()
});
});
})
if (message.body.toLowerCase() == 'пкм') {
bot.activateItem();
bot.deactivateItem()
};
//Next are the commands according to the user's message
if (message.body.toLowerCase().startsWith('окно клик')) {
bot.clickWindow(message.body.substr(10), 0, 0)
};
Try to create a minimal example that reproduces the problem
On Thu, Nov 12, 2020, 05:54 Aleksey Goncharov notifications@github.com wrote:
please provide
Your current code
This is the main part:
var bot = mineflayer.createBot(options)
navigatePlugin(bot); bot.navigate.blocksToAvoid[132] = true; bot.navigate.blocksToAvoid[59] = false; bot.loadPlugin(tpsPlugin)
bot.settings.viewDistance = "tiny"
bot._client.on('map', ({ data,itemDamage })=> { let invL = bot.inventory.slots.filter(el=> el !== null) var itemD = (invL && invL[0] && invL[0].metadata || '') if (itemDamage == itemD) { if(!data) return;
const size = Math.sqrt(data.length); const image = PNGImage.createImage(size, size); for(let x = 0; x < size; x++) { for(let z = 0; z < size; z++) { const colorId = data[x + (z * size)]; image.setAt(x, z, md.getColor(colorId)); } } image.writeImage(`${__dirname}/captha.png`, function (err) { if (err) throw err; }); easyvk({access_token: token}).then(_vk => { vk = _vk; return vk.uploader.getUploadURL( 'photos.getMessagesUploadServer', {}, true ) }).then(async ({url, vkr}) => { const field = 'photo' const server = vk.uploader const filePath = path.join(__dirname, 'captha.png') url = url.upload_url let fileData = await server.uploadFile(url, filePath, field, {}) fileData = await vk.post('photos.saveMessagesPhoto', fileData) fileData = fileData[0] const attachments = [ `photo${fileData.owner_id}_${fileData.id}_${fileData.access_key}` ] return vk.call('messages.send', { user_id: ud, attachment: attachments, message: 'Капча', random_id: easyvk.randomId() }); }); }
});
bot.on('message', function (jsonMessage) { if (jsonMessage.toString() == '[СкайБлок] Сервер будет перезагружен через 5 мин') { heroku.delete('/apps/'+process.env.APPNAME+'/dynos') } if (chat == 1) { easyvk({access_token: token}).then(_vk => { vk = _vk; return vk.call("messages.send", { message: '[Чат]'+jsonMessage.toString(), user_id: ud, random_id: easyvk.randomId() }); }); }; });
FixKick()
bot.on('respawn',() => { bot.navigate.stop() bot.waitForChunksToLoad(() => { easyvk({access_token: token}).then(_vk => { vk = _vk; return vk.call("messages.send", { message: "Бот заспавнился", user_id: ud, random_id: easyvk.randomId() }); }); if (bot.currentWindow !== null) { easyvk({access_token: token}).then(_vk => { vk = _vk; return vk.call("messages.send", { message: "Закрыто окно", user_id: ud, random_id: easyvk.randomId() }) }) bot.closeWindow(bot.currentWindow) }; if (digging == 1) { digging = 0 easyvk({access_token: token}).then(_vk => { vk = _vk; return vk.call("messages.send", { message: "Бот прекратил копать.", user_id: ud, random_id: easyvk.randomId() }); }); }; }); });
CLA()
bot.on("windowOpen", () => { setTimeout(getW, 200) });
bot.on("death", () => { easyvk({access_token: token}).then(_vk => { vk = _vk; return vk.call("messages.send", { message: 'Бот умер.', user_id: ud, random_id: easyvk.randomId() }); }); }) bot.on('kicked', (reason, loggedIn) => { easyvk({access_token: token}).then(_vk => { vk = _vk; return vk.call("messages.send", { message: '['+options.username+']'+' '+'Вас кикнуло. Причина: '+reason+' '+loggedIn, user_id: ud, random_id: easyvk.randomId() }); }); });
bot.on('end',() => { easyvk({access_token: token}).then(_vk => { vk = _vk; return vk.call("messages.send", { message: '['+options.username+']'+' '+'Бот выключен.', user_id: ud, random_id: easyvk.randomId() }).then((vkr) => { if (vkr.getFullResponse().response > 1) { process.exit(1) } }) }) }) bot.on('error', err => { easyvk({access_token: ''}).then(_vk => { vk = _vk; return vk.call("messages.send", { message: 'У пользователя ошибка\n'+err+'\nник пользователя: '+options.username, chat_id: 1, random_id: easyvk.randomId() }); }); }) if (message.body.toLowerCase() == 'пкм') { bot.activateItem(); bot.deactivateItem() };
//There is no receipt from the message in VKontakte
if (message.body.toLowerCase().startsWith('окно клик')) { bot.clickWindow(message.body.substr(10), 0, 0) };
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/mineflayer/issues/1444#issuecomment-725836431, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437QZHK5B4CX46SD2EPLSPNTBLANCNFSM4TSI2NZQ .
@rom1504
Will write "go" after message [Auth] Успешная регистрация, добро пожаловать!
To enter the server, you need to register with the command /reg [password] [password]
on message [Auth] Зарегистрируйтесь, используя /register <пароль> <повтор пароля>
const mineflayer = require('mineflayer')
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const bot = mineflayer.createBot({
host: "mc.prostocraft.ru",
port: 25565,
username: "nickname",
version: "1.16.1"
})
bot.on('message', (message) => {
console.log(message.toString())
})
rl.on('line', (input) => {
if (input == "go") {
bot.activateItem();
bot.deactivateItem();
bot.once('windowOpen', () => {
bot.clickWindow(11, 0, 0)
bot.once('windowOpen', () => {
bot.clickWindow(20, 0, 0)
})
})
}else{
bot.chat(input)
}
});
bot.on('spawn', () => {
console.log("Bot was spawned")
})
bot.on('error', err => {
console.log(err)
})
@rom1504
Will write "go" after message
[Auth] Успешная регистрация, добро пожаловать!
To enter the server, you need to register with the command/reg [password] [password]
on message[Auth] Зарегистрируйтесь, используя /register <пароль> <повтор пароля>
const mineflayer = require('mineflayer') const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); const bot = mineflayer.createBot({ host: "mc.prostocraft.ru", port: 25565, username: "nickname", version: "1.16.1" }) bot.on('message', (message) => { console.log(message.toString()) }) rl.on('line', (input) => { if (input == "go") { bot.activateItem(); bot.deactivateItem(); bot.once('windowOpen', () => { bot.clickWindow(11, 0, 0) bot.once('windowOpen', () => { bot.clickWindow(20, 0, 0) }) }) }else{ bot.chat(input) } }); bot.on('spawn', () => { console.log("Bot was spawned") }) bot.on('error', err => { console.log(err) })
@rom1504
Do you have any ideas?
Versions
Clear question
When choosing a server in the window, this error appears.
What did you try yet?
Your current code
Additional context