make it better
This commit is contained in:
parent
71d0923731
commit
6e60fb6d5f
17
.env.example
17
.env.example
|
@ -1,13 +1,8 @@
|
||||||
# @BotFather => /newbot
|
|
||||||
#TG API SERVICING
|
|
||||||
# http://127.0.0.1:8081
|
|
||||||
TG_APIROOT = 'https://api.telegram.org'
|
TG_APIROOT = 'https://api.telegram.org'
|
||||||
# @BotFather => /newbot
|
|
||||||
BOT_TOKEN = '1745011940:AAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
BOT_TOKEN = '1745011940:AAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
||||||
# ADMIN for report message
|
ADMIN_ID = 1872887287
|
||||||
ADMIN_ID = 1159809878
|
BOT_CLUSTER_CORE = 0
|
||||||
# Example ( BOT_CLUSTER_CORE = 2 ) or AutoScale ( BOT_CLUSTER_CORE = 0 )
|
MONGOOSE_URL = 'mongodb+srv://:@cluster0.myekb.mongodb.net/secven'
|
||||||
BOT_CLUSTER_CORE = 2
|
|
||||||
# Mongoose databse
|
DADATA_TOKEN = '1b333051049e4edbgffffffffffffffffffffffgg'
|
||||||
#MONGOOSE_URL = 'mongodb+srv://secven:secvennotabugsecven@cluster0.myekb.mongodb.net/secven'
|
DADATA_SECRET = '303bd4ac15aegggggggggggggggggggggggggggg'
|
||||||
MONGOOSE_URL = 'mongodb://127.0.0.1/secven'
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
apps: [
|
apps: [
|
||||||
{
|
{
|
||||||
name: 'APP-BOT',
|
name: require('package.json').name,
|
||||||
script: './index.js',
|
script: require('package.json').main,
|
||||||
max_memory_restart: '1000M',
|
max_memory_restart: '1000M',
|
||||||
wait_ready: true,
|
wait_ready: true,
|
||||||
restart_delay: 5000,
|
restart_delay: 5000,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "bot-pattern-telegraf",
|
"name": "bot-eye-leak",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "<secven@riseup.net>",
|
"author": "<secven@riseup.net>",
|
||||||
|
@ -9,8 +9,8 @@
|
||||||
"start": "cross-env NODE_ENV=development node index.js",
|
"start": "cross-env NODE_ENV=development node index.js",
|
||||||
"dev": "cross-env NODE_ENV=development nodemon index.js",
|
"dev": "cross-env NODE_ENV=development nodemon index.js",
|
||||||
"prod": "cross-env NODE_ENV=production node index.js",
|
"prod": "cross-env NODE_ENV=production node index.js",
|
||||||
"pm:stop": "cross-env NODE_ENV=production pm2 stop ecosystem.config.js",
|
"pm:stop": "pm2 stop ecosystem.config.js",
|
||||||
"pm:prod": "cross-env NODE_ENV=production pm2 start ecosystem.config.js",
|
"pm:prod": "pm2 start ecosystem.config.js",
|
||||||
"pm:up": "pm2 startup"
|
"pm:up": "pm2 startup"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -16,11 +16,9 @@ config.consignOpts = {
|
||||||
|
|
||||||
config.limitSecurity = {
|
config.limitSecurity = {
|
||||||
window: ms('15s'),
|
window: ms('15s'),
|
||||||
limit: 5,
|
limit: 4,
|
||||||
onLimitExceeded: ({ message, replyWithHTML }) =>
|
onLimitExceeded: ({ answerCbQuery }) =>
|
||||||
replyWithHTML('❗️Please wait a second (5s)', {
|
answerCbQuery('❗️Please wait a second !', true)
|
||||||
disable_notification: true
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config.i18nOpts = {
|
config.i18nOpts = {
|
||||||
|
|
|
@ -43,6 +43,7 @@ const Route = new Router(({ callbackQuery }) => {
|
||||||
})()
|
})()
|
||||||
|
|
||||||
bot.route = Route
|
bot.route = Route
|
||||||
|
bot.rateLimit = rateLimit
|
||||||
bot.context.db = db
|
bot.context.db = db
|
||||||
bot.context.extra = Extra
|
bot.context.extra = Extra
|
||||||
bot.context.markup = Markup
|
bot.context.markup = Markup
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
|
const { SERVICE } = require('../util/service')
|
||||||
|
|
||||||
class EyeofgodTask {
|
class EyeofgodTask {
|
||||||
checkLeak = async ({ db, i18n, extra, message, session, replyWithHTML }) => {
|
checkLeak = async ({ db, i18n, extra, message, session, replyWithHTML }) => {
|
||||||
try {
|
try {
|
||||||
const id = (session.eyeof = message.text.trim())
|
const id = (session.eyeof = message.text.trim())
|
||||||
const base = await db.Eye.findOne({ id }).sort({ id: 1 }).lean()
|
const base = await db.Eye.findOne({ id }).sort({ id: 1 }).lean()
|
||||||
|
/// const expectData = await SERVICE.getInfoOperator(base?.phone)
|
||||||
|
|
||||||
return await replyWithHTML(
|
return await replyWithHTML(
|
||||||
i18n.t('eyeofgod', {
|
i18n.t('eyeofgod', {
|
||||||
id: base.id,
|
id: base.id,
|
||||||
phone: base?.phone,
|
nPhone: base?.phone,
|
||||||
username: base?.username,
|
username: base?.username,
|
||||||
fullName: `${base?.first_name} | ${base?.last_name}`
|
fullName: `${base?.first_name ?? ''} | ${base?.last_name ?? ''}`
|
||||||
|
// ...expectData
|
||||||
}),
|
}),
|
||||||
extra
|
extra
|
||||||
.HTML()
|
.HTML()
|
||||||
|
@ -25,10 +29,9 @@ class EyeofgodTask {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
} catch (e) {
|
} catch {
|
||||||
// console.log(e.message)
|
|
||||||
return await replyWithHTML(
|
return await replyWithHTML(
|
||||||
'💮 <b>No in Database</b>',
|
'📍 <b>There is no database !</b>',
|
||||||
extra
|
extra
|
||||||
.HTML()
|
.HTML()
|
||||||
.inReplyTo(message.message_id)
|
.inReplyTo(message.message_id)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const fetch = require('node-fetch')
|
const fetch = require('node-fetch')
|
||||||
|
|
||||||
class JokeTask {
|
class JokeTask {
|
||||||
async getRandomAnimation(ctx) {
|
async getRandomAnimation({ replyWithAnimation }) {
|
||||||
const page = Math.floor(Math.random() * 100)
|
const page = Math.floor(Math.random() * 100)
|
||||||
return Promise.resolve(
|
return Promise.resolve(
|
||||||
await fetch(`https://developerslife.ru/top/${page}?json=true`)
|
await fetch(`https://developerslife.ru/top/${page}?json=true`)
|
||||||
|
@ -11,7 +11,7 @@ class JokeTask {
|
||||||
const index = Number(Math.floor(Math.random() * data.result.length))
|
const index = Number(Math.floor(Math.random() * data.result.length))
|
||||||
// eslint-disable-next-line security/detect-object-injection
|
// eslint-disable-next-line security/detect-object-injection
|
||||||
const { videoURL: sendGif, description: caption } = data.result[index]
|
const { videoURL: sendGif, description: caption } = data.result[index]
|
||||||
return ctx.replyWithAnimation(sendGif, {
|
return replyWithAnimation(sendGif, {
|
||||||
caption,
|
caption,
|
||||||
parse_mode: 'HTML'
|
parse_mode: 'HTML'
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
class StartTask {
|
class StartTask {
|
||||||
async start({ reply, replyWithSticker, message, i18n, from, extra }) {
|
async start({ reply, replyWithSticker, message, i18n, from, extra }) {
|
||||||
await replyWithSticker(
|
await replyWithSticker(
|
||||||
'CAACAgIAAxkBAAIBs2DeqZIZBIYgeFBsno36780WxeHsAAIQAAPDVgMednAUKnTod-sgBA'
|
'CAACAgIAAxkBAAIZH2DvF-OAI9Kzy_QazXqHYR0rUD7-AAIXAAPDVgMeQjlqcLJ92EYgBA'
|
||||||
)
|
)
|
||||||
const markup = extra
|
const markup = extra
|
||||||
.HTML()
|
.HTML()
|
||||||
.inReplyTo(message.message_id)
|
.inReplyTo(message.message_id)
|
||||||
// .webPreview(false)
|
.webPreview(false)
|
||||||
.markup(m =>
|
.markup(m =>
|
||||||
m.inlineKeyboard(
|
m.inlineKeyboard(
|
||||||
[
|
[
|
||||||
m.urlButton('Subscribe', 'https://t.me/ThisOpenSource'),
|
m.callbackButton('💰 Donate', 'startMenu|donate'),
|
||||||
m.callbackButton('Subscribe ACQ', 'startMenu|test'),
|
|
||||||
m.urlButton('❤️ My Notabug', 'https://notabug.org/Secven'),
|
m.urlButton('❤️ My Notabug', 'https://notabug.org/Secven'),
|
||||||
m.callbackButton('❌ Delete', 'delete')
|
m.urlButton('😊 Subscribe', 'https://t.me/ThisOpenSource'),
|
||||||
|
m.callbackButton(i18n.t('default.closeMessage'), 'delete')
|
||||||
],
|
],
|
||||||
{ columns: 2 }
|
{ columns: 2 }
|
||||||
)
|
)
|
||||||
|
@ -21,8 +21,17 @@ class StartTask {
|
||||||
return await reply(i18n.t('main.start', { ...from }), markup)
|
return await reply(i18n.t('main.start', { ...from }), markup)
|
||||||
}
|
}
|
||||||
|
|
||||||
subscribe = async ctx => {
|
donateMe = async ({ i18n, extra, editMessageText }) => {
|
||||||
return await ctx.answerCbQuery('https://t.me/ThisOpenSource', true)
|
return editMessageText(
|
||||||
|
i18n.t('main.donate'),
|
||||||
|
extra
|
||||||
|
.HTML()
|
||||||
|
.markup(m =>
|
||||||
|
m.inlineKeyboard([
|
||||||
|
m.callbackButton(i18n.t('default.closeMessage'), 'delete')
|
||||||
|
])
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,34 @@
|
||||||
eyeofgod: |
|
eyeofgod: |
|
||||||
👁 <b>EyeOfGod Leak:</b>
|
👁 <b>EyeOfGod Leak:</b>
|
||||||
├ 🆔 ID: <code>${id}</code>
|
├ 🆔 ID: <code>${id}</code>
|
||||||
├ 📱 Phone: <code>${phone}</code>
|
├ 📱 Phone: <code>+${nPhone}</code>
|
||||||
├ 👤 Username: <code>${username}</code>
|
├ 👤 Username: @${username}
|
||||||
└ ⚫️ FullName: <code>${fullName}</code>
|
└ ⚫️ FullName: <code>${fullName}</code>
|
||||||
main:
|
main:
|
||||||
start: |
|
start: |
|
||||||
💰 <b>Donete me:</b>
|
🆘 Bot accepts requests to search for following formats:
|
||||||
├ https://t.me/ThisOpenSource
|
|
||||||
|
👁 <b>Telegram</b>
|
||||||
|
├ <code>596999557</code> - Search by ID
|
||||||
|
└ <code>@username</code> - Soon
|
||||||
|
|
||||||
|
🤖 <b>Bot command</b>
|
||||||
|
├ /joke - IT gifs Funny
|
||||||
|
└ /lang - Change language
|
||||||
|
|
||||||
|
🗂 <b>Database</b>
|
||||||
|
├ ✅ <code>EyeOfGod 2021</code>
|
||||||
|
├ ✅ <code>Parsing 2021</code>
|
||||||
|
├ ❌ <code>Leak base May</code>
|
||||||
|
└ ❌ <code>Parsing 2020</code>
|
||||||
|
|
||||||
|
❔ If you want more databases you need to help Donat
|
||||||
|
donate: |
|
||||||
|
💰 <b>Donate:</b>
|
||||||
├ BTC - <code>1Ebf7gBSSD5Y8y3zLHVy1SuJxAqAgJPjhW</code>
|
├ BTC - <code>1Ebf7gBSSD5Y8y3zLHVy1SuJxAqAgJPjhW</code>
|
||||||
└ XMR - <code>45UcKcUN8d6M5cccXZiqC1dtpMsqSazyKSLGP3utQh3MhBmeuCuHAbYBwngsa1eAFs4yza9HukiH4axjNg58YGBrJo2x2tS</code>
|
└ XMR - <code>45UcKcUN8d6M5cccXZiqC1dtpMsqSazyKSLGP3utQh3MhBmeuCuHAbYBwngsa1eAFs4yza9HukiH4axjNg58YGBrJo2x2tS</code>
|
||||||
|
|
||||||
🆘 <b>SOS:</b>
|
❤️ <b>Thanks you for support</b>
|
||||||
├ <b>Check Database EyeOfGod:</b>
|
|
||||||
├ Just send me ID: <code>596999557</code>
|
|
||||||
└ /eye 596999557
|
|
||||||
├ <b>Change language</b>:
|
|
||||||
└ /lang
|
|
||||||
stackError:
|
stackError:
|
||||||
report: |
|
report: |
|
||||||
<b>Handler Middleware:</b>
|
<b>Handler Middleware:</b>
|
||||||
|
@ -27,7 +39,6 @@ stackError:
|
||||||
Stack: <code>${stack}</code>
|
Stack: <code>${stack}</code>
|
||||||
|
|
||||||
🤖 BOTNAME: ${botName}
|
🤖 BOTNAME: ${botName}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
lang: |
|
lang: |
|
||||||
🤖 Language settings
|
🤖 Language settings
|
||||||
|
|
|
@ -1,22 +1,28 @@
|
||||||
eyeofgod: |
|
eyeofgod: |
|
||||||
👁 <b>EyeOfGod Leak:</b>
|
👁 <b>EyeOfGod Leak:</b>
|
||||||
├ 🆔 Айди: <code>${id}</code>
|
├ 🆔 Айди: <code>${id}</code>
|
||||||
├ 📱 Телефон: <code>${phone}</code>
|
├ 📱 Телефон: <code>+${nPhone}</code>
|
||||||
├ 👤 Имя пользователя: <code>${username}</code>
|
├ 👤 Имя пользователя: @${username}
|
||||||
└ ⚫️ Полное Имя: <code>${fullName}</code>
|
└ ⚫️ Полное Имя: <code>${fullName}</code>
|
||||||
main:
|
main:
|
||||||
start: |
|
start: |
|
||||||
💰 <b>Поддержать меня:</b>
|
🆘 Бот принимает запросы на поиск следующих форматов:
|
||||||
├ https://t.me/ThisOpenSource
|
|
||||||
├ BTC - <code>1Ebf7gBSSD5Y8y3zLHVy1SuJxAqAgJPjhW</code>
|
|
||||||
└ XMR - <code>45UcKcUN8d6M5cccXZiqC1dtpMsqSazyKSLGP3utQh3MhBmeuCuHAbYBwngsa1eAFs4yza9HukiH4axjNg58YGBrJo2x2tS</code>
|
|
||||||
|
|
||||||
🆘 <b>SOS:</b>
|
👁 <b>Telegram</b>
|
||||||
├ <b>Проверьте в базе EyeOfGod:</b>
|
├ <code>596999557</code> - Поиск по ID
|
||||||
├ Просто отправь мне ID: <code>596999557</code>
|
└ <code>@username</code> - Скоро
|
||||||
└ /eye 596999557
|
|
||||||
├ <b>Изменение языка</b>:
|
🤖 <b>Bot command</b>
|
||||||
└ /lang
|
├ /joke - IT gifs Funny
|
||||||
|
└ /lang - Изменение языка
|
||||||
|
|
||||||
|
🗂 <b>База данных</b>
|
||||||
|
├ ✅ <code>EyeOfGod 2021</code>
|
||||||
|
├ ✅ <code>Parsing 2021</code>
|
||||||
|
├ ❌ <code>Leak base May</code>
|
||||||
|
└ ❌ <code>Parsing 2020</code>
|
||||||
|
|
||||||
|
❔ Если вы хотите больше баз данных, вам нужно помочь Donat
|
||||||
stackError:
|
stackError:
|
||||||
report: |
|
report: |
|
||||||
<b>Обработчик Middleware:</b>
|
<b>Обработчик Middleware:</b>
|
||||||
|
|
|
@ -2,7 +2,7 @@ const { escapeHtml } = require('../util/escapeHTML')
|
||||||
|
|
||||||
module.exports = async ({ db, from, i18n, session }, next) => {
|
module.exports = async ({ db, from, i18n, session }, next) => {
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
const { id, first_name, username, language_code } = from
|
const { id, first_name, username } = from
|
||||||
if (!id) return await next()
|
if (!id) return await next()
|
||||||
await db.User.findOne({ user_id: id })
|
await db.User.findOne({ user_id: id })
|
||||||
.then(root => {
|
.then(root => {
|
||||||
|
|
|
@ -1,4 +1,16 @@
|
||||||
module.exports = bot => {
|
module.exports = bot => {
|
||||||
const { eyeofgodTask } = bot.handlers
|
const { eyeofgodTask } = bot.handlers
|
||||||
bot.hears(/^[0-9]{5,20}$/, eyeofgodTask.checkLeak)
|
|
||||||
|
const expect = bot.rateLimit({
|
||||||
|
window: 1000 * 20,
|
||||||
|
limit: 1,
|
||||||
|
onLimitExceeded: ({ replyWithHTML }) =>
|
||||||
|
replyWithHTML(
|
||||||
|
'<code>I can handle from you only one request in 15 seconds.</code>'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
bot.hears(/^[0-9]{5,20}$/g, expect, eyeofgodTask.checkLeak)
|
||||||
|
|
||||||
|
// TODO: Select menu add
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
module.exports = bot => {
|
module.exports = bot => {
|
||||||
const { jokeTask } = bot.handlers
|
const { jokeTask } = bot.handlers
|
||||||
|
|
||||||
bot.hears(['/joke', '!joke'], jokeTask.getRandomAnimation)
|
bot.hears(['/joke', '!joke', '!jo'], jokeTask.getRandomAnimation)
|
||||||
|
|
||||||
|
// TODO: add moar
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ module.exports = bot => {
|
||||||
answerCbQuery,
|
answerCbQuery,
|
||||||
editMessageText
|
editMessageText
|
||||||
}) => {
|
}) => {
|
||||||
if (String(state.value)) {
|
if (state.value) {
|
||||||
await answerCbQuery(state.value).then(() => {
|
await answerCbQuery(state.value).then(() => {
|
||||||
session.root.settings.lang = state.value
|
session.root.settings.lang = state.value
|
||||||
i18n.locale(state.value)
|
i18n.locale(state.value)
|
||||||
|
|
|
@ -5,8 +5,8 @@ module.exports = bot => {
|
||||||
|
|
||||||
const routeList = ctx => {
|
const routeList = ctx => {
|
||||||
switch (String(ctx.state.value)) {
|
switch (String(ctx.state.value)) {
|
||||||
case 'test':
|
case 'donate':
|
||||||
return startTask.subscribe(ctx)
|
return startTask.donateMe(ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
const fetch = require('node-fetch')
|
||||||
|
|
||||||
|
const getInfoOperator = async (num = '79521305638') => {
|
||||||
|
// eslint-disable-next-line no-async-promise-executor
|
||||||
|
return new Promise(async resolve => {
|
||||||
|
const url = 'https://cleaner.dadata.ru/api/v1/clean/phone'
|
||||||
|
await fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
mode: 'cors',
|
||||||
|
headers: {
|
||||||
|
Authorization: 'Token ' + process.env.DADATA_TOKEN,
|
||||||
|
'X-Secret': process.env.DADATA_SECRET,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
compress: true,
|
||||||
|
body: JSON.stringify([num])
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (res.statusCode === 401)
|
||||||
|
throw new Error('dadata.ru:: key or secret invalid')
|
||||||
|
|
||||||
|
if (res.statusCode === 403)
|
||||||
|
throw new Error('dadata.ru:: invalid secret key')
|
||||||
|
return res.json()
|
||||||
|
})
|
||||||
|
.then(data => resolve(...data))
|
||||||
|
.catch(err => console.error('end dadata.ru::', err.message))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const SERVICE = {
|
||||||
|
getInfoOperator: getInfoOperator
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { SERVICE }
|
Loading…
Reference in New Issue