make it better
This commit is contained in:
parent
a0e3bec882
commit
6b0b4f912c
|
@ -16,10 +16,9 @@ config.consignOpts = {
|
|||
|
||||
config.limitSecurity = {
|
||||
window: ms('15s'),
|
||||
limit: 6,
|
||||
onLimitExceeded: ({ message, i18n, replyWithHTML }) =>
|
||||
limit: 5,
|
||||
onLimitExceeded: ({ message, replyWithHTML }) =>
|
||||
replyWithHTML('❗️Please wait a second (5s)', {
|
||||
reply_to_message_id: message.message_id,
|
||||
disable_notification: true
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
class EyeofgodTask {
|
||||
checkLeak = async ({ db, i18n, extra, message, session, replyWithHTML }) => {
|
||||
try {
|
||||
let id = (session.eyeof = message.text)
|
||||
let id = (session.eyeof = Number(message.text))
|
||||
|
||||
if (id.includes('eye')) {
|
||||
if (id.includes('/eye')) {
|
||||
id = id.split(' ')[1]
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class EyeofgodTask {
|
|||
} catch (e) {
|
||||
console.log(e.message)
|
||||
return await replyWithHTML(
|
||||
`🙅♂️ No in Database 🆔 <code>${Number(session.eyeof)}</code>`
|
||||
`🙅♂️ No in Database 🆔 <code>${Number(session?.eyeof)}</code>`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ const limit = options => {
|
|||
|
||||
return (ctx, next) => {
|
||||
const key = config.keyGenerator(ctx)
|
||||
if (!key) return next()
|
||||
if (!key) return next().catch(() => {})
|
||||
const hit = store.incr(key)
|
||||
return hit <= config.limit ? next() : config.onLimitExceeded(ctx, next)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue