mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-04-28 09:15:57 +00:00
This reverts commit 12ca87f4fe281be20b1eec5c2dcadc1f0fe8fce2.
This commit is contained in:
parent
3d125ffbf9
commit
8aaa60e78d
@ -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');
|
||||
|
||||
async function getDeviceList() {
|
||||
try {
|
||||
@ -24,10 +23,12 @@ module.exports = (bot) => {
|
||||
bot.command(['codename', 'whatis'], spamwatchMiddleware, async (ctx) => {
|
||||
const userInput = ctx.message.text.split(" ").slice(1).join(" ");
|
||||
const Strings = getStrings(ctx.from.language_code);
|
||||
const { noCodename } = Strings.codenameCheck
|
||||
|
||||
if(verifyInput(ctx, userInput, noCodename)){
|
||||
return;
|
||||
if (!userInput) {
|
||||
ctx.reply(Strings.codenameCheck.noCodename, {
|
||||
parse_mode: "Markdown",
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
}
|
||||
|
||||
const jsonRes = await getDeviceList()
|
||||
|
@ -3,18 +3,19 @@ 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');
|
||||
|
||||
module.exports = (bot) => {
|
||||
bot.command("http", spamwatchMiddleware, async (ctx) => {
|
||||
const Strings = getStrings(ctx.from.language_code);
|
||||
const userInput = ctx.message.text.split(' ')[1];
|
||||
const apiUrl = Resources.httpApi;
|
||||
const { invalidCode } = Strings.httpCodes
|
||||
|
||||
if (verifyInput(ctx, userInput, invalidCode, true)) {
|
||||
return;
|
||||
}
|
||||
if (!userInput || isNaN(userInput)) {
|
||||
return ctx.reply(Strings.httpCodes.invalidCode, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await axios.get(apiUrl);
|
||||
@ -49,10 +50,12 @@ module.exports = (bot) => {
|
||||
bot.command("httpcat", spamwatchMiddleware, async (ctx) => {
|
||||
const Strings = getStrings(ctx.from.language_code);
|
||||
const userInput = ctx.message.text.split(' ').slice(1).join(' ').replace(/\s+/g, '');
|
||||
const { invalidCode } = Strings.httpCodes
|
||||
|
||||
if (verifyInput(ctx, userInput, invalidCode, true)) {
|
||||
return;
|
||||
if (!userInput || isNaN(userInput)) {
|
||||
return ctx.reply(Strings.httpCodes.invalidCode, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
}
|
||||
|
||||
const apiUrl = `${Resources.httpCatApi}${userInput}`;
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,6 @@ const axios = require('axios');
|
||||
const { getStrings } = require('../plugins/checklang.js');
|
||||
const { isOnSpamWatch } = require('../spamwatch/spamwatch.js');
|
||||
const spamwatchMiddleware = require('../spamwatch/Middleware.js')(isOnSpamWatch);
|
||||
const { verifyInput } = require('../plugins/verifyInput.js');
|
||||
|
||||
const statusEmojis = {
|
||||
0: '⛈', 1: '⛈', 2: '⛈', 3: '⛈', 4: '⛈', 5: '🌨', 6: '🌨', 7: '🌨',
|
||||
@ -36,10 +35,12 @@ module.exports = (bot) => {
|
||||
const userLang = ctx.from.language_code || "en-US";
|
||||
const Strings = getStrings(userLang);
|
||||
const userInput = ctx.message.text.split(' ').slice(1).join(' ');
|
||||
const { provideLocation } = Strings.weatherStatus
|
||||
|
||||
if (verifyInput(ctx, userInput, provideLocation)) {
|
||||
return;
|
||||
if (!userInput) {
|
||||
return ctx.reply(Strings.weatherStatus.provideLocation, {
|
||||
parse_mode: "Markdown",
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
}
|
||||
|
||||
const location = userInput;
|
||||
|
Loading…
x
Reference in New Issue
Block a user