From 65a182cb50d281716db4cb66e988557d3d362080 Mon Sep 17 00:00:00 2001 From: Ean Milligan Date: Sat, 3 May 2025 21:03:30 -0400 Subject: [PATCH] deno fmt --- mod.ts | 23 ++++---------- .../managers/handler/workerComplete.ts | 16 +++++----- .../managers/handler/workerTerminate.ts | 4 +-- src/artigen/managers/queueManager.ts | 4 +-- src/commands/apiCmd/apiHelp.ts | 3 +- src/commands/auditCmd/auditGuilds.ts | 28 ++++++++--------- src/commands/help.ts | 3 +- src/commands/privacy.ts | 3 +- src/commands/roll.ts | 4 +-- src/commands/rollDecorators.ts | 3 +- src/commands/rollHelp.ts | 30 +++++++------------ src/endpoints/gets/apiRoll.ts | 2 +- src/utils/intervals.ts | 2 +- 13 files changed, 48 insertions(+), 77 deletions(-) diff --git a/mod.ts b/mod.ts index 2a7bd0d..1808a4f 100644 --- a/mod.ts +++ b/mod.ts @@ -3,18 +3,7 @@ * * December 21, 2020 */ -import { - botId, - cache, - DiscordActivityTypes, - DiscordenoGuild, - DiscordenoMessage, - editBotNickname, - editBotStatus, - Intents, - sendMessage, - startBot, -} from '@discordeno'; +import { botId, cache, DiscordActivityTypes, DiscordenoGuild, DiscordenoMessage, editBotNickname, editBotStatus, Intents, sendMessage, startBot } from '@discordeno'; import { initLog, log, LogTypes as LT } from '@Log4Deno'; import config from '~config'; @@ -83,12 +72,10 @@ startBot({ }, 30000); // Interval to update bot list stats every 24 hours - LOCALMODE - ? log(LT.INFO, 'updateListStatistics not running') - : setInterval(() => { - log(LT.LOG, 'Updating all bot lists statistics'); - intervals.updateListStatistics(botId, cache.guilds.size + cache.dispatchedGuildIds.size); - }, 86400000); + LOCALMODE ? log(LT.INFO, 'updateListStatistics not running') : setInterval(() => { + log(LT.LOG, 'Updating all bot lists statistics'); + intervals.updateListStatistics(botId, cache.guilds.size + cache.dispatchedGuildIds.size); + }, 86400000); // Interval to update hourlyRates every hour setInterval(() => { diff --git a/src/artigen/managers/handler/workerComplete.ts b/src/artigen/managers/handler/workerComplete.ts index f6b9bc5..b59a098 100644 --- a/src/artigen/managers/handler/workerComplete.ts +++ b/src/artigen/managers/handler/workerComplete.ts @@ -32,7 +32,7 @@ export const onWorkerComplete = async (workerMessage: MessageEvent, const pubEmbedDetails = await generateRollEmbed( rollRequest.apiRoll ? rollRequest.api.userId : rollRequest.dd.originalMessage.authorId, returnMsg, - rollRequest.modifiers + rollRequest.modifiers, ); const gmEmbedDetails = await generateRollEmbed(rollRequest.apiRoll ? rollRequest.api.userId : rollRequest.dd.originalMessage.authorId, returnMsg, { ...rollRequest.modifiers, @@ -143,14 +143,14 @@ export const onWorkerComplete = async (workerMessage: MessageEvent, JSON.stringify( rollRequest.modifiers.count ? { - counts: countEmbed, - details: pubEmbedDetails, - } + counts: countEmbed, + details: pubEmbedDetails, + } : { - details: pubEmbedDetails, - } - ) - ) + details: pubEmbedDetails, + }, + ), + ), ); } } diff --git a/src/artigen/managers/handler/workerTerminate.ts b/src/artigen/managers/handler/workerTerminate.ts index bf2fe4e..8b13b9a 100644 --- a/src/artigen/managers/handler/workerTerminate.ts +++ b/src/artigen/managers/handler/workerTerminate.ts @@ -24,12 +24,12 @@ export const terminateWorker = async (rollWorker: Worker, rollRequest: QueuedRol ( await generateRollEmbed( rollRequest.dd.originalMessage.authorId, - { + { error: true, errorCode: 'TooComplex', errorMsg: 'Error: Roll took too long to process, try breaking roll down into simpler parts', }, - {} + {}, ) ).embed, ], diff --git a/src/artigen/managers/queueManager.ts b/src/artigen/managers/queueManager.ts index 23c1640..a47fbfa 100644 --- a/src/artigen/managers/queueManager.ts +++ b/src/artigen/managers/queueManager.ts @@ -41,9 +41,7 @@ The results for this roll will replace this message when it is done.`, setInterval(() => { log( LT.LOG, - `Checking rollQueue for items, rollQueue length: ${rollQueue.length}, currentWorkers: ${getWorkerCnt()}, config.limits.maxWorkers: ${ - config.limits.maxWorkers - }` + `Checking rollQueue for items, rollQueue length: ${rollQueue.length}, currentWorkers: ${getWorkerCnt()}, config.limits.maxWorkers: ${config.limits.maxWorkers}`, ); if (rollQueue.length && getWorkerCnt() < config.limits.maxWorkers) { const rollRequest = rollQueue.shift(); diff --git a/src/commands/apiCmd/apiHelp.ts b/src/commands/apiCmd/apiHelp.ts index 205e55a..addd8bb 100644 --- a/src/commands/apiCmd/apiHelp.ts +++ b/src/commands/apiCmd/apiHelp.ts @@ -13,7 +13,8 @@ export const help = (message: DiscordenoMessage) => { { color: infoColor2, title: `${config.name}'s API Details:`, - description: `${config.name} has a built in API that allows user to roll dice into Discord using third party programs. By default, API rolls are blocked from being sent in your guild. The API warning is also enabled by default. These commands may only be used by the Owner or Admins of your guild. + description: + `${config.name} has a built in API that allows user to roll dice into Discord using third party programs. By default, API rolls are blocked from being sent in your guild. The API warning is also enabled by default. These commands may only be used by the Owner or Admins of your guild. For information on how to use the API, please check the GitHub README for more information [here](${config.links.sourceCode}). diff --git a/src/commands/auditCmd/auditGuilds.ts b/src/commands/auditCmd/auditGuilds.ts index a543da9..bbb3a6f 100644 --- a/src/commands/auditCmd/auditGuilds.ts +++ b/src/commands/auditCmd/auditGuilds.ts @@ -120,25 +120,21 @@ Please see attached file for audit details on cached guilds and members.`, }, { name: 'Repeat Guild Owners:', - value: - repeatCounts - .map((ownerCnt, serverIdx) => `${ownerCnt} ${ownerCnt === 1 ? 'person has' : 'people have'} me in ${serverIdx + 1} of their guilds`) - .filter((str) => str) - .join('\n') || 'No Repeat Guild Owners', + value: repeatCounts + .map((ownerCnt, serverIdx) => `${ownerCnt} ${ownerCnt === 1 ? 'person has' : 'people have'} me in ${serverIdx + 1} of their guilds`) + .filter((str) => str) + .join('\n') || 'No Repeat Guild Owners', }, { name: 'Guild Size Dist:', - value: - Array.from(guildSizeDist) - .map( - ([size, count], idx) => - `${count} Guild${count === 1 ? ' has' : 's have'} ${ - guildSizeDist.has(sizeCats[idx - 1]) - ? `${size.toLocaleString()} - ${(sizeCats[idx - 1] - 1).toLocaleString()}` - : `at least ${size.toLocaleString()}` - } Member${size === 1 ? '' : 's'}` - ) - .join('\n') || 'Not available', + value: Array.from(guildSizeDist) + .map( + ([size, count], idx) => + `${count} Guild${count === 1 ? ' has' : 's have'} ${ + guildSizeDist.has(sizeCats[idx - 1]) ? `${size.toLocaleString()} - ${(sizeCats[idx - 1] - 1).toLocaleString()}` : `at least ${size.toLocaleString()}` + } Member${size === 1 ? '' : 's'}`, + ) + .join('\n') || 'Not available', }, ], }, diff --git a/src/commands/help.ts b/src/commands/help.ts index 758909f..8012ec7 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -92,7 +92,8 @@ export const help = (message: DiscordenoMessage) => { }, { name: `\`${config.prefix}xdydzracsq!${config.postfix}\` ...`, - value: `Rolls all configs requested, you may repeat the command multiple times in the same message (just ensure you close each roll with \`${config.postfix}\`), run \`${config.prefix}??\` for more details`, + value: + `Rolls all configs requested, you may repeat the command multiple times in the same message (just ensure you close each roll with \`${config.postfix}\`), run \`${config.prefix}??\` for more details`, inline: true, }, ], diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts index c4140d4..4bba656 100644 --- a/src/commands/privacy.ts +++ b/src/commands/privacy.ts @@ -22,7 +22,8 @@ export const privacy = (message: DiscordenoMessage) => { fields: [ { name: `${config.name} does not track or collect user information via Discord.`, - value: `The only user submitted information that is stored is submitted via the \`${config.prefix}report\` command. This information is only stored for a short period of time in a location that only the Developer of ${config.name} can see. + value: + `The only user submitted information that is stored is submitted via the \`${config.prefix}report\` command. This information is only stored for a short period of time in a location that only the Developer of ${config.name} can see. For more details, please check out the Privacy Policy on the GitHub [here](${config.links.privacyPolicy}). diff --git a/src/commands/roll.ts b/src/commands/roll.ts index 1d9aca2..1c3f009 100644 --- a/src/commands/roll.ts +++ b/src/commands/roll.ts @@ -48,9 +48,7 @@ export const roll = async (message: DiscordenoMessage, args: string[], command: // Return early if the modifiers were invalid if (!modifiers.valid) { - m.edit(generateRollError('Modifiers invalid:', modifiers.error.name, modifiers.error.message)).catch((e) => - utils.commonLoggers.messageEditError('roll.ts:50', m, e) - ); + m.edit(generateRollError('Modifiers invalid:', modifiers.error.name, modifiers.error.message)).catch((e) => utils.commonLoggers.messageEditError('roll.ts:50', m, e)); if (DEVMODE && config.logRolls) { // If enabled, log rolls so we can verify the bots math diff --git a/src/commands/rollDecorators.ts b/src/commands/rollDecorators.ts index 60e2d16..302fd25 100644 --- a/src/commands/rollDecorators.ts +++ b/src/commands/rollDecorators.ts @@ -55,8 +55,7 @@ Examples: \`${config.prefix}d20${config.postfix} -nd\`, \`${config.prefix}d20${c }, { name: '`-gm @user1 @user2 @userN` - GM Roll', - value: - 'Rolls the requested roll in GM mode, suppressing all publicly shown results and details and sending the results directly to the specified GMs', + value: 'Rolls the requested roll in GM mode, suppressing all publicly shown results and details and sending the results directly to the specified GMs', inline: true, }, { diff --git a/src/commands/rollHelp.ts b/src/commands/rollHelp.ts index 0f0e2df..120a043 100644 --- a/src/commands/rollHelp.ts +++ b/src/commands/rollHelp.ts @@ -73,32 +73,27 @@ Additionally, replace \`x\` with \`F\` to roll Fate dice`, }, { name: '`rq` [Optional]', - value: - 'Rerolls any rolls that are greater than or equal to `a`, `r3` will reroll every die that land on 3 or greater, throwing out old rolls, cannot be used with `ro`', + value: 'Rerolls any rolls that are greater than or equal to `a`, `r3` will reroll every die that land on 3 or greater, throwing out old rolls, cannot be used with `ro`', inline: true, }, { name: '`roa` or `ro=q` [Optional]', - value: - 'Rerolls any rolls that match `a`, `ro3` will reroll each die that lands on 3 ONLY ONE TIME, throwing out old rolls, cannot be used with `r`', + value: 'Rerolls any rolls that match `a`, `ro3` will reroll each die that lands on 3 ONLY ONE TIME, throwing out old rolls, cannot be used with `r`', inline: true, }, { name: '`roq` [Optional]', - value: - 'Rerolls any rolls that are greater than or equal to `a`, `ro3` will reroll each die that lands on 3 or greater ONLY ONE TIME, throwing out old rolls, cannot be used with `r`', + value: 'Rerolls any rolls that are greater than or equal to `a`, `ro3` will reroll each die that lands on 3 or greater ONLY ONE TIME, throwing out old rolls, cannot be used with `r`', inline: true, }, { @@ -193,32 +188,27 @@ Additionally, replace \`x\` with \`F\` to roll Fate dice`, }, { name: '`!p>u` [Optional]', - value: - 'Penetrating Explosion on `u` and greater, rolls one `dy` for each die that lands on `u` or greater, but subtracts one from each resulting explosion', + value: 'Penetrating Explosion on `u` and greater, rolls one `dy` for each die that lands on `u` or greater, but subtracts one from each resulting explosion', inline: true, }, { name: '`!pu` [Optional]', - value: - 'Compounding Explosion on `u` and greater, rolls one `dy` for each die that lands on `u` or greater, but adds the resulting explosion to the die that caused this explosion', + value: 'Compounding Explosion on `u` and greater, rolls one `dy` for each die that lands on `u` or greater, but adds the resulting explosion to the die that caused this explosion', inline: true, }, { name: '`!!, apiUserid: bigint): Pr } else { // Alert API user that they messed up return stdResp.Forbidden( - `Verify you are a member of the guild you are sending this roll to. If you are, the ${config.name} may not have that registered, please send a message in the guild so ${config.name} can register this. This registration is temporary, so if you see this error again, just poke your server again.` + `Verify you are a member of the guild you are sending this roll to. If you are, the ${config.name} may not have that registered, please send a message in the guild so ${config.name} can register this. This registration is temporary, so if you see this error again, just poke your server again.`, ); } } else { diff --git a/src/utils/intervals.ts b/src/utils/intervals.ts index 1032910..97a120c 100644 --- a/src/utils/intervals.ts +++ b/src/utils/intervals.ts @@ -197,7 +197,7 @@ const updateHeatmapPng = async () => { hourPixels[hour][0] + 1, dayPixels[day][1] - dayPixels[day][0] + 1, hourPixels[hour][1] - hourPixels[hour][0] + 1, - Image.rgbToColor(255 * (1 - percent), 255 * percent, 0) + Image.rgbToColor(255 * (1 - percent), 255 * percent, 0), ); } }