Reputation: 179
i have a bot.js
file and set.js
file with the following code
const stage = new Stage([greeterScene,adminscene], { ttl: 1800 })
bot.use(session())
bot.use(stage.middleware())
the code in set.js
files requires modules imported in bot.js
file which is
const Telegraf = require('telegraf');
const Extra = require('telegraf/extra');
const Markup = require('telegraf/markup');
const bot = new Telegraf("token");
const Scene = require('telegraf/scenes/base')
const session = require('telegraf/session')
const Stage = require('telegraf/stage')
so how can i include my set.js
file in the main bot.js
file??
Upvotes: 1
Views: 47
Reputation: 807
You can require JS files.
E.g. Adding the following line in bot.js require("./set.js")
or let setFunctions = require("./set.js")
, ideally near the top, before you call any of the functions from that file.
Upvotes: 1