make it better

This commit is contained in:
Secven 2021-07-14 15:59:24 +00:00
parent a455a968c3
commit c04074d435
6 changed files with 10 additions and 10 deletions

2
.gitignore vendored
View File

@ -1,10 +1,10 @@
# Logs
logs
.idea
tests
.DS_Store
.tmp
*.log
.env.example
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@ -26,7 +26,7 @@ config.limitSecurity = {
config.i18nOpts = {
directory: path.resolve(__dirname, '../locales'),
defaultLanguage: 'en',
defaultLanguageOnMissing: true
defaultLanguageOnMissing: false
}
config.settings = {

View File

@ -2,10 +2,9 @@ class EyeofgodTask {
checkLeak = async ({ db, i18n, extra, message, session, replyWithHTML }) => {
let id = (session.eyeof = message.text.trim())
try {
if (id.includes('/eye')) {
if (/^[0-9]{5,}$/.test(id.split(' ')[1])) {
id = id.split(' ')[1]
}
id = id.split(' ')[1]
if (id.includes('/eye') && /^[0-9]{5,}$/.test(id)) {
id = id.split(' ')[1]
}
const base = await db.Eye.findOne({ id }).sort({ id: 1 }).lean()

View File

@ -10,9 +10,9 @@ class JokeTask {
.then(data => {
const index = Number(Math.floor(Math.random() * data.result.length))
// eslint-disable-next-line security/detect-object-injection
const send = data.result[index]
return ctx.replyWithAnimation(send.videoURL, {
caption: `${send.description}`,
const { videoURL: sendGif, description: caption } = data.result[index]
return ctx.replyWithAnimation(sendGif, {
caption,
parse_mode: 'HTML'
})
})

View File

@ -1,5 +1,6 @@
module.exports = bot => {
const { eyeofgodTask } = bot.handlers
bot.hears(/^[0-9]{5,}$/, eyeofgodTask.checkLeak)
bot.command('eye', eyeofgodTask.checkLeak)
}

View File

@ -1,5 +1,5 @@
module.exports = bot => {
const { jokeTask } = bot.handlers
bot.command('joke', jokeTask.getRandomAnimation)
bot.hears(['/joke', '!joke'], jokeTask.getRandomAnimation)
}