19 lines
523 B
JavaScript
19 lines
523 B
JavaScript
|
|
/**
|
||
|
|
* Отправляет список команд в Telegram, не поднимая бота.
|
||
|
|
*
|
||
|
|
* npm run sync
|
||
|
|
*/
|
||
|
|
import { Bot } from 'grammy';
|
||
|
|
|
||
|
|
import { assertConfig, config } from '../src/config.js';
|
||
|
|
import { loadCommands } from '../src/core/loader.js';
|
||
|
|
|
||
|
|
assertConfig();
|
||
|
|
|
||
|
|
const registry = await loadCommands();
|
||
|
|
const bot = new Bot(config.token);
|
||
|
|
const commands = registry.forTelegram();
|
||
|
|
|
||
|
|
await bot.api.setMyCommands(commands);
|
||
|
|
console.log(`Готово. Отправлено команд: ${commands.length}`);
|