Skip to content

Control Mineflayer with a Discord Bot #1499

Answered by TheDudeFromCI
daaanii asked this question in Q&A
Discussion options

You must be logged in to vote

@Dani3l3-24

Your issue is here.
https://github.com/Dani3l3-24/MineflayerDiscord/blob/05bccadb81b1fb5509ef75c94494aaf145178020/commands/join.js#L20

You are trying to export the bot variable from within a function. You cannot do this. Each file should only have one export call. You might have a lot more luck returning the bot from within the function instead to access it.

module.exports = {
    name: 'join',
    description: "Join the bot on a server",
    execute(message, args, dbot) {

	const mbot = mineflayer.createBot({
            host: args[0].toString(),
            port: parseInt(args[1]),
            username: args[2],
            version: false,
        })

        mbot.on('login', (

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by rom1504
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1499 on December 13, 2020 22:27.