ASYNC
This commit is contained in:
parent
9a37a2a2a9
commit
a9fe3c32d0
40
index.js
40
index.js
|
@ -225,7 +225,7 @@ const generateExtensionListEmbed = async () => {
|
||||||
extensions.forEach((extension) => {
|
extensions.forEach((extension) => {
|
||||||
extensionList[extension.user.extension] = extension.user.name;
|
extensionList[extension.user.extension] = extension.user.name;
|
||||||
});
|
});
|
||||||
|
|
||||||
// fullList will contain embeds, each embed will contain one field with as many extensions as it can fit (up to 1024 characters). Once the feild is full, make a new embed in the array without a title, just a description. The firrst embed will have a title
|
// fullList will contain embeds, each embed will contain one field with as many extensions as it can fit (up to 1024 characters). Once the feild is full, make a new embed in the array without a title, just a description. The firrst embed will have a title
|
||||||
let field = "";
|
let field = "";
|
||||||
let embeds = [];
|
let embeds = [];
|
||||||
|
@ -234,25 +234,29 @@ const generateExtensionListEmbed = async () => {
|
||||||
"title": "Extension List",
|
"title": "Extension List",
|
||||||
"color": 0x00ff00,
|
"color": 0x00ff00,
|
||||||
"description": `${extensions.length} extensions\n\`* = inactive for 30 days\`\n\`** = inactive for 90 days\`\n\`- = never used\``,
|
"description": `${extensions.length} extensions\n\`* = inactive for 30 days\`\n\`** = inactive for 90 days\`\n\`- = never used\``,
|
||||||
|
|
||||||
})
|
})
|
||||||
for (let key in extensionList) {
|
// put for loop in function and await it
|
||||||
field += `\`${key}${inactiveFlag[key]}\`: ${extensionList[key]}\n`;
|
|
||||||
count++;
|
await (async () => {
|
||||||
if (field.length >= 1024) {
|
for (let key in extensionList) {
|
||||||
embeds.push({
|
field += `\`${key}${inactiveFlag[key]}\`: ${extensionList[key]}\n`;
|
||||||
"color": 0x00ff00,
|
count++;
|
||||||
"description": `${extensions.length} extensions\n\`* = inactive for 30 days\`\n\`** = inactive for 90 days\`\n\`- = never used\``,
|
if (field.length >= 1024) {
|
||||||
"feilds": [
|
embeds.push({
|
||||||
{
|
"color": 0x00ff00,
|
||||||
"name": "Extensions",
|
"description": `${extensions.length} extensions\n\`* = inactive for 30 days\`\n\`** = inactive for 90 days\`\n\`- = never used\``,
|
||||||
"value": field
|
"feilds": [
|
||||||
}
|
{
|
||||||
]
|
"name": "Extensions",
|
||||||
});
|
"value": field
|
||||||
field = "";
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
field = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})();
|
||||||
|
|
||||||
|
|
||||||
// for (let key in extensionList) {
|
// for (let key in extensionList) {
|
||||||
|
|
Loading…
Reference in a new issue