UNPKG

stalkee

Version:

a Telegram bot who can send voice messages via inline mode added by admin with sorting them by numbers of uses

30 lines (29 loc) 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.info = void 0; const telegraf_1 = require("telegraf"); const utils_1 = require("../../utils"); const controllers_1 = require("../../controllers"); const info = async (ctx) => { try { const message = ctx.message?.reply_to_message; if (!message || !('voice' in message)) { return; } const audio = await (0, controllers_1.getAudio)(message.voice.file_unique_id); if (!audio) { await ctx.reply(ctx.t.commands.info.res.not_found, telegraf_1.Extra.HTML()); return; } await ctx.reply(ctx.t.commands.info.res.ok .replace('{actor}', audio.actor || '') .replace('{location}', audio.location || '') .replace('{n_uses}', '' + audio.nUses || '') .replace('{quote}', audio.quote || '')); } catch (err) { utils_1.logger.error(err, 'command.info'); await ctx.reply(ctx.t.commands.info.res.not_found, telegraf_1.Extra.HTML()); } }; exports.info = info;