make it better
This commit is contained in:
parent
a455a968c3
commit
c04074d435
|
@ -1,10 +1,10 @@
|
|||
# Logs
|
||||
logs
|
||||
.idea
|
||||
tests
|
||||
.DS_Store
|
||||
.tmp
|
||||
*.log
|
||||
.env.example
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
|
|
@ -26,7 +26,7 @@ config.limitSecurity = {
|
|||
config.i18nOpts = {
|
||||
directory: path.resolve(__dirname, '../locales'),
|
||||
defaultLanguage: 'en',
|
||||
defaultLanguageOnMissing: true
|
||||
defaultLanguageOnMissing: false
|
||||
}
|
||||
|
||||
config.settings = {
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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'
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
module.exports = bot => {
|
||||
const { eyeofgodTask } = bot.handlers
|
||||
|
||||
bot.hears(/^[0-9]{5,}$/, eyeofgodTask.checkLeak)
|
||||
bot.command('eye', eyeofgodTask.checkLeak)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = bot => {
|
||||
const { jokeTask } = bot.handlers
|
||||
|
||||
bot.command('joke', jokeTask.getRandomAnimation)
|
||||
bot.hears(['/joke', '!joke'], jokeTask.getRandomAnimation)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue