Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.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(...)
}
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));
}
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);
});
});
});
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);
});
});
});
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)
)
}
}