diff --git a/config/freenom.js b/config/freenom.js index 1c9fcf4..4599e6d 100644 --- a/config/freenom.js +++ b/config/freenom.js @@ -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) {