Skip to content

Commit

Permalink
Merge pull request #5 from Sorok-Dva/fix/webhookContentSize
Browse files Browse the repository at this point in the history
Fix/webhook content size
  • Loading branch information
Sorok-Dva authored Feb 22, 2022
2 parents 24d337d + 9be3adf commit 7af621b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion config/freenom.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,24 @@ const freenom = {
})
message += `**[${domain.name}]** Auto renewal complete !`
}
if (i === domains.length) await discord(message)
messages.push(message)
message = ''

if (i === domains.length) {
const message = messages.join().replace(/,-/g, '-')
console.log('message: ', message)
if (message.length <= 2000 && i < 8) await discord(message)
else {
let timer = 0
await Promise.all(messages.map(async msg => {
timer += 500
setTimeout(async () => {
console.log('message length > 2000', msg)
await discord(msg)
}, timer) // to avoid discord rate limited
}))
}
}
i += 1
}))
} catch (e) {
Expand Down

0 comments on commit 7af621b

Please sign in to comment.