Maks-gaming / mineflayer-plasmovoice

A lightweight plugin for Mineflayer that allows use VoiceChat for PlasmoVoice plugin
MIT License
19 stars 2 forks source link

Readme Instructions are incorrect? #65

Closed Humpfry closed 5 months ago

Humpfry commented 5 months ago

Still trying to learn how to use python and it's syntax so bare with me as I might not understand some things fully, just FYI. hah

I got mineflayer itself running eventually, the base of all of this and was able to get the bot to come on command. So, Eventually, working through adding modules and came across yours. Very interesting to add voice support to the bot I thought.

But, not being familiar with how modules work and using python instead of just javascript, putting me in a for a challenge for sure. Anyway, I finally figured out how to get your example setup in your readme to work to a point. But I am not fully sure why I need to add the .plugin after the plasmavoice variable to get it to load this plugin.

Your's is bot.loadPlugin(plasmo)

And I have to use: bot.loadPlugin(plasmovoice.plugin);

Working through the code it seems to be an issue with the index.ts and how exports work that I don't fully understand. I am not sure even if I am on the right track, but is to do with wanting something to do with this [ export function plugin(bot: Bot) { ] and/or [ export default plugin; ]

Thinking it was an issue with the python conversion to javascript wrapper I tried only using the javascript example without any changes and sure enough the same error.

node:assert:408 throw err; ^

AssertionError [ERR_ASSERTION]: plugin needs to be a function at EventEmitter.loadPlugin (/home/jovyan/node_modules/mineflayer/lib/plugin_loader.js:16:12) at Object. (/home/jovyan/work/testPlasmovoice.js:13:5) at Module._compile (node:internal/modules/cjs/loader:1369:14) at Module._extensions..js (node:internal/modules/cjs/loader:1427:10) at Module.load (node:internal/modules/cjs/loader:1206:32) at Module._load (node:internal/modules/cjs/loader:1022:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49 { generatedMessage: false, code: 'ERR_ASSERTION', actual: false, expected: true, operator: '==' }

Node.js v20.12.2

Might be an issue with my setup or something, I don't know but here is the code:

// testPlasmovoice.js const mineflayer = require('mineflayer'); const plasmovoice = require('mineflayer-plasmovoice'); const path = require('path') plasmovoice.setLoggingLevel(0)

const bot = mineflayer.createBot({ host: "host.docker.internal", // Minecraft server IP port: 25565, username: "bot" });

bot.loadPlugin(plasmovoice);

And I ran this from the console terminal in my docker container:

node testPlasmovoice2.js

Thanks for your cool project!

Maks-gaming commented 5 months ago

Thanks for the correction! The commit 4cf3c93 solved the issue