/quote deprecated

This commit is contained in:
Lucas Gabriel 2025-02-08 20:45:52 -03:00
parent ac73a1fde8
commit 4e49350550
No known key found for this signature in database
GPG Key ID: D9B075FC6DC93985

View File

@ -1,30 +1,28 @@
const Resources = require('../props/resources.json');
const { getStrings } = require('../plugins/checklang.js');
const { isOnSpamWatch } = require('../plugins/lib-spamwatch/spamwatch.js');
const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(isOnSpamWatch);
const axios = require('axios');
// const Resources = require('../props/resources.json');
// const { getStrings } = require('../plugins/checklang.js');
// const { isOnSpamWatch } = require('../plugins/lib-spamwatch/spamwatch.js');
// const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(isOnSpamWatch);
// const escape = require('markdown-escape');
// const axios = require('axios');
module.exports = (bot) => {
bot.command("quote", spamwatchMiddleware, async (ctx) => {
const Strings = getStrings(ctx.from.language_code);
// module.exports = (bot) => {
// bot.command("quote", spamwatchMiddleware, async (ctx) => {
// const Strings = getStrings(ctx.from.language_code);
try {
const response = await axios.get(Resources.quoteApi);
const data = response.data;
const escapedQuote = data.quote.replace(/([\\_*~`>.!-])/g, '\\$1');
const escapedAuthor = `- ${data.author}.`.replace(/([\\_*~`>.!-])/g, '\\$1');
const escapedData = `${Strings.quoteResult}\n>*${escapedQuote}*\n_${escapedAuthor}_`;
// try {
// const response = await axios.get(Resources.quoteApi);
// const data = response.data;
ctx.reply(escapedData, {
reply_to_message_id: ctx.message.message_id,
parse_mode: 'MarkdownV2'
});
} catch (error) {
console.error(error);
ctx.reply(Strings.quoteErr, {
reply_to_message_id: ctx.message.id,
parse_mode: 'MarkdownV2'
});
};
});
};
// ctx.reply(escape(`${escape(Strings.quoteResult)}\n> *${escape(data.quote)}*\n_${escape(data.author)}_`), {
// reply_to_message_id: ctx.message.message_id,
// parse_mode: 'Markdown'
// });
// } catch (error) {
// console.error(error);
// ctx.reply(Strings.quoteErr, {
// reply_to_message_id: ctx.message.id,
// parse_mode: 'MarkdownV2'
// });
// };
// });
// };