Revert "ref: create separated verifyUserInput function (#34)" (#42)

This reverts commit 12ca87f4fe.
This commit is contained in:
Lucas Gabriel 2025-04-19 23:52:51 -03:00 committed by GitHub
parent 3d125ffbf9
commit 8aaa60e78d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 39 additions and 28 deletions

View file

@ -3,7 +3,6 @@ const { getStrings } = require('../plugins/checklang.js');
const { isOnSpamWatch } = require('../spamwatch/spamwatch.js');
const spamwatchMiddleware = require('../spamwatch/Middleware.js')(isOnSpamWatch);
const axios = require("axios");
const { verifyInput } = require('../plugins/verifyInput.js');
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
@ -23,9 +22,12 @@ module.exports = (bot) => {
bot.command("mlpchar", spamwatchMiddleware, async (ctx) => {
const Strings = getStrings(ctx.from.language_code);
const userInput = ctx.message.text.split(' ').slice(1).join(' ').replace(" ", "+");
const { noCharName } = Strings.ponyApi
if (verifyInput(ctx, userInput, noCharName)) {
if (!userInput) {
ctx.reply(Strings.ponyApi.noCharName, {
parse_mode: 'Markdown',
reply_to_message_id: ctx.message.message_id
});
return;
};
@ -97,9 +99,11 @@ module.exports = (bot) => {
const Strings = getStrings(ctx.from.language_code);
const userInput = ctx.message.text.split(' ').slice(1).join(' ').replace(" ", "+");
const { noEpisodeNum } = Strings.ponyApi
if (verifyInput(ctx, userInput, noEpisodeNum, true)) {
if (!userInput) {
ctx.reply(Strings.ponyApi.noEpisodeNum, {
parse_mode: 'Markdown',
reply_to_message_id: ctx.message.message_id
});
return;
};
@ -165,9 +169,11 @@ module.exports = (bot) => {
const Strings = getStrings(ctx.from.language_code);
const userInput = ctx.message.text.split(' ').slice(1).join(' ').replace(" ", "+");
const { noComicName } = Strings.ponyApi
if (verifyInput(ctx, userInput, noComicName)) {
if (!userInput) {
ctx.reply(Strings.ponyApi.noComicName, {
parse_mode: 'Markdown',
reply_to_message_id: ctx.message.message_id
});
return;
};