|
|
@@ -1,19 +1,38 @@
|
|
|
-const Telegram = require('telegraf/telegram')
|
|
|
-const Telegraf = require('telegraf')
|
|
|
-const fs = require('fs')
|
|
|
+const Telegram = require('telegraf/telegram');
|
|
|
+const Telegraf = require('telegraf');
|
|
|
+const fs = require('fs');
|
|
|
const https = require('https');
|
|
|
-const telegram = new Telegram(process.env.BOT_TOKEN)
|
|
|
-const bot = new Telegraf(process.env.BOT_TOKEN)
|
|
|
-
|
|
|
+const telegram = new Telegram(process.env.BOT_TOKEN);
|
|
|
+const bot = new Telegraf(process.env.BOT_TOKEN);
|
|
|
+const admin = 170276072;
|
|
|
+const langData=fs.readFileSync('./string/lang.json', 'utf8');
|
|
|
+const language = JSON.parse(langData);
|
|
|
+var lang = language.en;
|
|
|
|
|
|
bot.start( (ctx) => {
|
|
|
console.log('started:', ctx.from.id)
|
|
|
- return ctx.reply('Welcome!')
|
|
|
+ return ctx.reply(lang.welcome)
|
|
|
+})
|
|
|
+
|
|
|
+bot.command('spanish', (ctx) => {
|
|
|
+ lang = language.es;
|
|
|
+ ctx.reply(lang.langChanged)
|
|
|
})
|
|
|
-bot.command('help', (ctx) => ctx.reply('Try send a sticker!'))
|
|
|
-bot.hears('hi', (ctx) => ctx.reply('Hey there!'))
|
|
|
-bot.hears(/buy/i, (ctx) => ctx.reply('Buy-buy!'))
|
|
|
-bot.on('sticker', (ctx) => ctx.reply('👍'))
|
|
|
+
|
|
|
+bot.command('english', (ctx) => {
|
|
|
+ lang = language.en;
|
|
|
+ ctx.reply(lang.langChanged)
|
|
|
+})
|
|
|
+
|
|
|
+bot.command('help', (ctx) => ctx.reply(lang.help))
|
|
|
+
|
|
|
+
|
|
|
+//bot.hears('hi', (ctx) => ctx.reply('Hey there!'))
|
|
|
+
|
|
|
+//bot.hears(/buy/i, (ctx) => ctx.reply('Buy-buy!'))
|
|
|
+
|
|
|
+//bot.on('sticker', (ctx) => ctx.reply('👍'))
|
|
|
+
|
|
|
bot.on('audio', (ctx) => {
|
|
|
console.log('message received: ', ctx.from.id)
|
|
|
telegram.getFile( ctx.message.audio.file_id, (ctx) => {
|