mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-03-10 04:39:57 +00:00
/quote deprecated
This commit is contained in:
parent
ac73a1fde8
commit
4e49350550
@ -1,30 +1,28 @@
|
|||||||
const Resources = require('../props/resources.json');
|
// const Resources = require('../props/resources.json');
|
||||||
const { getStrings } = require('../plugins/checklang.js');
|
// const { getStrings } = require('../plugins/checklang.js');
|
||||||
const { isOnSpamWatch } = require('../plugins/lib-spamwatch/spamwatch.js');
|
// const { isOnSpamWatch } = require('../plugins/lib-spamwatch/spamwatch.js');
|
||||||
const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(isOnSpamWatch);
|
// const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(isOnSpamWatch);
|
||||||
const axios = require('axios');
|
// const escape = require('markdown-escape');
|
||||||
|
// const axios = require('axios');
|
||||||
|
|
||||||
module.exports = (bot) => {
|
// module.exports = (bot) => {
|
||||||
bot.command("quote", spamwatchMiddleware, async (ctx) => {
|
// bot.command("quote", spamwatchMiddleware, async (ctx) => {
|
||||||
const Strings = getStrings(ctx.from.language_code);
|
// const Strings = getStrings(ctx.from.language_code);
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
const response = await axios.get(Resources.quoteApi);
|
// const response = await axios.get(Resources.quoteApi);
|
||||||
const data = response.data;
|
// 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}_`;
|
|
||||||
|
|
||||||
ctx.reply(escapedData, {
|
// ctx.reply(escape(`${escape(Strings.quoteResult)}\n> *${escape(data.quote)}*\n_${escape(data.author)}_`), {
|
||||||
reply_to_message_id: ctx.message.message_id,
|
// reply_to_message_id: ctx.message.message_id,
|
||||||
parse_mode: 'MarkdownV2'
|
// parse_mode: 'Markdown'
|
||||||
});
|
// });
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
console.error(error);
|
// console.error(error);
|
||||||
ctx.reply(Strings.quoteErr, {
|
// ctx.reply(Strings.quoteErr, {
|
||||||
reply_to_message_id: ctx.message.id,
|
// reply_to_message_id: ctx.message.id,
|
||||||
parse_mode: 'MarkdownV2'
|
// parse_mode: 'MarkdownV2'
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user