Skip to content Skip to sidebar Skip to footer

Getting Bot Variable Into Different Commando Files

I use commando for my discord.js bot, and it's linked to the client. I want to be able to use the bot variable in a different file, mainly to help check if the bot has the correct

Solution 1:

You could do

index.js

const bot = new commando.Client({
commandPrefix: '!',
owner: config.ownerID,
unknownCommandResponse: false
});

this.bot = bot

This would then be accessed in another file like:

this.bot.(property)

All the properties of bot will be accessible as long as you use the above mentioned method.

Post a Comment for "Getting Bot Variable Into Different Commando Files"