How to use the telegraf/extra.inReplyTo function in telegraf

To help you get started, we’ve selected a few telegraf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github phoenixlzx / telegram-stickerimage-bot / bot.js View on Github external
.catch(function (err) {
            ctx.reply(
                messages[langSession[chatId]].msg.err_get_filelink.replace('%fileId%', fileId),
                inReplyTo ? Extra.inReplyTo(inReplyTo) : null);
            logger(chatId, 'error', 'Get File Link for ' + fileId + ': ' + err);
            callback(err, null);
        }); // no more finally(...)
}
github phoenixlzx / telegram-stickerimage-bot / bot.js View on Github external
function addSticker(ctx) {
    let chatId = ctx.message.chat.id;
    if (ramdb[chatId].files.indexOf(ctx.message.sticker.file_id) !== -1) {
        return ctx.reply(messages[langSession[chatId]].msg.duplicated_sticker, Extra.inReplyTo(ctx.message.message_id));
    }
    if (ramdb[chatId].files.length >= config.maximages) {
        return ctx.reply(messages[langSession[chatId]].msg.taskfull);
    }
    ramdb[chatId].files.push(ctx.message.sticker.file_id);
    let remain = config.maximages - ramdb[chatId].files.length;
    ctx.reply(remain === 0 ?
        messages[langSession[chatId]].msg.taskfull :
        messages[langSession[chatId]].msg.saved.replace('%remain%', remain));
}
github phoenixlzx / telegram-stickerimage-bot / bot.js View on Github external
convert(ctx, destFile, fpath, {format: 'png'}, function (err, png) {
                            if (err) {
                                cleanup(chatId);
                                return ctx.reply(
                                    messages[langSession[chatId]].msg.convert_error,
                                    Extra.inReplyTo(messageId)
                                );
                            }
                            ctx.replyWithDocument({
                                source: fs.readFileSync(png),
                                filename: path.basename(png)
                            }, Extra.inReplyTo(messageId))
                                .then(function () {
                                    ctx.deleteMessage(pendingMsg.message_id);
                                    cleanup(chatId);
                                });
                        });
                    });
github phoenixlzx / telegram-stickerimage-bot / bot.js View on Github external
convert(ctx, destFile, fpath, {format: 'png'}, function (err, png) {
                            if (err) {
                                cleanup(chatId);
                                return ctx.reply(
                                    messages[langSession[chatId]].msg.convert_error,
                                    Extra.inReplyTo(messageId)
                                );
                            }
                            ctx.replyWithDocument({
                                source: fs.readFileSync(png),
                                filename: path.basename(png)
                            }, Extra.inReplyTo(messageId))
                                .then(function () {
                                    ctx.deleteMessage(pendingMsg.message_id);
                                    cleanup(chatId);
                                });
                        });
                    });
github telegram-ru / ru-bot / src / features / readonly-mode / index.js View on Github external
const chatInstance = getChat(chat.id)

    await chatInstance.restrictMember(flooder, {
      until_date: Math.floor((Date.now() / SECOND) + RO_TIME),
    })
    await privateChannel.notifyReadonly({
      fluder: flooder,
      chat,
      reason: reason && reason.trim(),
      moder: from,
    })
  }
  else {
    reply(
      text.common.commandShouldBeReplied(text.commands.readonly()),
      Extra.inReplyTo(message.message_id)
    )
  }
}