Answer the question
In order to leave comments, you need to log in
How can you access methods from another file?
I have a file with VK constant:
How can I call its methods let's say vk.api.messages.send from other files?
Export didn't work...
const vk = new VK({})
module.exports = {
vk: vk
}
Answer the question
In order to leave comments, you need to log in
// core.js
const { VK } = require('vk-io');
const vk = new VK({})
module.exports = {
vk: vk
};
// bot.js
const { vk } = require('./core.js');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question