34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
JavaScript
import { RmqTelegramBot } from './RmqTelegramBot.js'
|
||
// Предположим, что ваш ext.id и имя бота — 'BusinessTrips'
|
||
const botName = 'BusinessTrips'
|
||
const botToken = 'неважен_здесь'; // нужен лишь для инициализации, но API не вызывается
|
||
|
||
import { initRabbit, getChannel } from './utils/rmq.js';
|
||
|
||
async function main() {
|
||
const channel = await initRabbit(process.env.RABBIT_URL || 'amqp://telegram_main:PASSWORD@rabbit.vidi.one:5672/telegram_main');
|
||
|
||
const bot = new RmqTelegramBot(botName, botToken)
|
||
|
||
// регистрируем обработчик апдейтов «как обычно»
|
||
bot.on('message', async msg => {
|
||
|
||
console.log('message',msg);
|
||
|
||
// const resp = await bot.requestSessionState(msg.innerUserId);
|
||
// console.log('resp',resp);
|
||
// bot.lockSession(msg.innerUserId);
|
||
bot.sendMessage(
|
||
msg.chat.id,
|
||
'Тест окей'
|
||
)
|
||
})
|
||
|
||
// ваш сервис не вызывает bot.launch() и не запускает polling/webhook
|
||
console.log(`🚀 RMQ‑bot for ${botName} ready, listening InMessage${botName}`)
|
||
|
||
}
|
||
|
||
main().catch(console.error)
|
||
|