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 { 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'
|
||||
// });
|
||||
// };
|
||||
// });
|
||||
// };
|
||||
|
Loading…
x
Reference in New Issue
Block a user