M
M
mrsakura522021-11-23 07:43:56
In contact with
mrsakura52, 2021-11-23 07:43:56

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

1 answer(s)
V
Vladlen Hellsite, 2021-11-24
@mrsakura52

// 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 question

Ask a Question

731 491 924 answers to any question