Changed order of checks for karma processing
This commit is contained in:
parent
5d6ec31186
commit
ddc1a587a0
12
index.js
12
index.js
|
@ -449,6 +449,12 @@ async function processKarma(msg, match, settings={}) {
|
|||
bot.sendMessage(chat_id, message, {reply_to_message_id: msg.message_id})
|
||||
return
|
||||
}
|
||||
if (timeDiff < chat.options.karmaCooldown){
|
||||
const messages = await Trigger.find({trigger:'tooFast', show: true})
|
||||
const message = messages[getRandomInt(0, messages.length)].text
|
||||
bot.sendMessage(chat_id, message, {reply_to_message_id: msg.message_id})
|
||||
return
|
||||
}
|
||||
if(to.id === me.id) {
|
||||
let messages
|
||||
let change = true
|
||||
|
@ -464,12 +470,6 @@ async function processKarma(msg, match, settings={}) {
|
|||
return
|
||||
}
|
||||
}
|
||||
if (timeDiff < chat.options.karmaCooldown){
|
||||
const messages = await Trigger.find({trigger:'tooFast', show: true})
|
||||
const message = messages[getRandomInt(0, messages.length)].text
|
||||
bot.sendMessage(chat_id, message, {reply_to_message_id: msg.message_id})
|
||||
return
|
||||
}
|
||||
if (to.is_bot && to.id != me.id) {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue