i want to use
tg.api.sendMessage(chatid, message)
in the controller, which is a different file from index.js.
tg is defined in index.js
how can i pass tg to my controller?
I tried to pass it when creating the controller in index.js:
const pingctrl = new PingController(tg);
and in the constructor i said:
class PingController extends Telegram.TelegramBaseController{
constructor(tg) {
super();
this.tg = tg;
}
It still says tg is not defined. any ideas?