From c2baa42af178b93454f0c954e702cc1fef67efae Mon Sep 17 00:00:00 2001 From: Aman Sachan Date: Thu, 7 May 2026 01:11:25 +0000 Subject: [PATCH 1/3] fix: replace silent catch with error logging - Changed .catch(() => {}) to .catch(err => console.error(...)) - Now logs the error message instead of silently swallowing it --- bot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.js b/bot.js index 43f7805..c9bb7e6 100644 --- a/bot.js +++ b/bot.js @@ -72,7 +72,7 @@ client.on("guildCreate", guild => { console.info(`Added to ${guild.name} (${guild.id})`); guild?.systemChannel ?.send("**Glad to be a part of your server** :heart:\nYou're probably looking for `/help`") - .catch(() => {}); + .catch(err => console.error('Failed to send guild welcome message:', err.message)); }); client.on("guildDelete", guild => { From bb1552992ef31760fb739d3393df68e426783f48 Mon Sep 17 00:00:00 2001 From: Aman Sachan Date: Thu, 7 May 2026 01:32:36 +0000 Subject: [PATCH 2/3] fix: apply prettier formatting to bot.js Signed-off-by: Aman Sachan --- bot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.js b/bot.js index c9bb7e6..2613c34 100644 --- a/bot.js +++ b/bot.js @@ -72,7 +72,7 @@ client.on("guildCreate", guild => { console.info(`Added to ${guild.name} (${guild.id})`); guild?.systemChannel ?.send("**Glad to be a part of your server** :heart:\nYou're probably looking for `/help`") - .catch(err => console.error('Failed to send guild welcome message:', err.message)); + .catch(err => console.error("Failed to send guild welcome message:", err.message)); }); client.on("guildDelete", guild => { From 187079053894a3a59169e5dcab38a88bf43af5a5 Mon Sep 17 00:00:00 2001 From: Aman Sachan Date: Thu, 7 May 2026 01:56:08 +0000 Subject: [PATCH 3/3] fix: apply prettier formatting to all JS files Signed-off-by: Aman Sachan --- bot.js | 2 +- modules/reloadable/command_handler.js | 2 +- modules/reloadable/commands/botstats.js | 10 +++++----- modules/reloadable/commands/countdown.js | 8 ++++---- modules/reloadable/commands/delete.js | 4 ++-- modules/reloadable/commands/help.js | 2 +- modules/reloadable/commands/list.js | 2 +- modules/reloadable/commands/newsitem.js | 4 ++-- modules/reloadable/commands/please.js | 10 +++++----- modules/reloadable/commands/timer.js | 10 +++++----- modules/reloadable/commands/timestamp.js | 8 ++++---- modules/reloadable/sqlite3.js | 22 +++++++++++----------- 12 files changed, 42 insertions(+), 42 deletions(-) diff --git a/bot.js b/bot.js index 2613c34..4063190 100644 --- a/bot.js +++ b/bot.js @@ -62,7 +62,7 @@ client.once("ready", () => { console.info(`${client.user.tag} (${client.shard.ids}) ready for business!`); setInterval( () => patchClusterData(client.shard.ids[0], client.shard.ids[0], clusterStats()), - 5 * MINUTES + 5 * MINUTES, ); setInterval(() => reloadables.performUpdates(client), 100 * MILLISECONDS); }); diff --git a/modules/reloadable/command_handler.js b/modules/reloadable/command_handler.js index 6b49a80..514b524 100644 --- a/modules/reloadable/command_handler.js +++ b/modules/reloadable/command_handler.js @@ -12,7 +12,7 @@ const allHandlers = ( fs .readdirSync(commandsPath) .filter(file => file.endsWith(".js")) - .map(filePath => import(path.resolve(commandsPath, filePath))) + .map(filePath => import(path.resolve(commandsPath, filePath))), ) ).map(commandFileModule => commandFileModule.handlers); diff --git a/modules/reloadable/commands/botstats.js b/modules/reloadable/commands/botstats.js index 03d600f..d20a03a 100644 --- a/modules/reloadable/commands/botstats.js +++ b/modules/reloadable/commands/botstats.js @@ -91,7 +91,7 @@ const chatInputHandler = async interaction => { name: ":red_envelope: SQLite3", value: `**v${sqliteVersion}**`, inline: true, - } + }, ) .setTimestamp(); @@ -117,11 +117,11 @@ const chatInputHandler = async interaction => { const { readyAt, guildCount } = JSON.parse(data); return bold( ` / ${guildCount} / ${id} / ` + lastInteraction[id], + )}:R>`, ); }) - .join("\n") + .join("\n"), ) .addFields( { @@ -138,7 +138,7 @@ const chatInputHandler = async interaction => { name: ":open_file_folder: SQLite Connections", value: bold(openConnections.toString()), inline: true, - } + }, ); embeds.push(additionalEmbed); interaction.editReply({ embeds, ephemeral: true }); diff --git a/modules/reloadable/commands/countdown.js b/modules/reloadable/commands/countdown.js index 4f3b73a..df43ddf 100644 --- a/modules/reloadable/commands/countdown.js +++ b/modules/reloadable/commands/countdown.js @@ -39,14 +39,14 @@ export const countdownCommand = new SlashCommandBuilder() .setDescription("The date/time you want to countdown to") .setRequired(true) .setAutocomplete(true) - .setMaxLength(MAX_LENGTH_STRING_CHOICE) + .setMaxLength(MAX_LENGTH_STRING_CHOICE), ) .addStringOption(option => - option.setName(OptionName.timezone).setDescription("Current timezone").setAutocomplete(true) + option.setName(OptionName.timezone).setDescription("Current timezone").setAutocomplete(true), ) .addStringOption(option => option.setName(OptionName.reason).setDescription("Description")) .addMentionableOption(option => - option.setName(OptionName.mention).setDescription("Mention someone once the timer is done") + option.setName(OptionName.mention).setDescription("Mention someone once the timer is done"), ) .setDMPermission(false); @@ -165,7 +165,7 @@ autocompleteOptionHandlers[OptionName.datetime] = async (interaction, value) => }); const suggestion = `${value.substring(0, 50)} (${dt.toLocaleString( - DateTime.DATETIME_MED + DateTime.DATETIME_MED, )} ${timezone})`; return [{ name: suggestion, value }]; }; diff --git a/modules/reloadable/commands/delete.js b/modules/reloadable/commands/delete.js index a6efebd..5412596 100644 --- a/modules/reloadable/commands/delete.js +++ b/modules/reloadable/commands/delete.js @@ -47,9 +47,9 @@ const generateMessage = ({ guildId, locale }) => { .setEmoji({ name: type === "timer" ? "⏲️" : "🕑", }); - }) + }), ) - .setMaxValues(all.length) + .setMaxValues(all.length), ); return { diff --git a/modules/reloadable/commands/help.js b/modules/reloadable/commands/help.js index d7f85c9..9872ca1 100644 --- a/modules/reloadable/commands/help.js +++ b/modules/reloadable/commands/help.js @@ -47,7 +47,7 @@ const chatInputHandler = async interaction => { name: "All is good though!", value: "Not to worry - The bot should be functional in around a week once the team has completed migration and deployed the new version of the bot.", - } + }, ); embeds.push(helpEmbed); diff --git a/modules/reloadable/commands/list.js b/modules/reloadable/commands/list.js index dd845e2..ad72206 100644 --- a/modules/reloadable/commands/list.js +++ b/modules/reloadable/commands/list.js @@ -21,7 +21,7 @@ export const listCommand = new SlashCommandBuilder() const nothingFoundEmbed = new EmbedBuilder() .setTitle("No countdowns or timers found!") .setDescription( - "For timers or countdowns to show up in this list, a `reason` must be provided when creating a timer or countdown." + "For timers or countdowns to show up in this list, a `reason` must be provided when creating a timer or countdown.", ); /** diff --git a/modules/reloadable/commands/newsitem.js b/modules/reloadable/commands/newsitem.js index cb561a7..08c3ac9 100644 --- a/modules/reloadable/commands/newsitem.js +++ b/modules/reloadable/commands/newsitem.js @@ -13,8 +13,8 @@ export const newsitemCommand = new SlashCommandBuilder() option .setName("text") .setDescription("What would you like to tell the users of the bot?") - .setRequired(true) - ) + .setRequired(true), + ), ) .setDefaultMemberPermissions(0) .setDMPermission(false); diff --git a/modules/reloadable/commands/please.js b/modules/reloadable/commands/please.js index 7f4ccf8..55fd3e2 100644 --- a/modules/reloadable/commands/please.js +++ b/modules/reloadable/commands/please.js @@ -19,22 +19,22 @@ export const pleaseCommand = new SlashCommandBuilder() .addSubcommand(subcommand => subcommand .setName("postservercount") - .setDescription("Post server counts to top.gg and discord.bots.gg") + .setDescription("Post server counts to top.gg and discord.bots.gg"), ) .addSubcommand(subcommand => subcommand.setName("register").setDescription("Register commands")) .addSubcommand(subcommand => - subcommand.setName("reload").setDescription("Reload code without a restart (Zero downtime)") + subcommand.setName("reload").setDescription("Reload code without a restart (Zero downtime)"), ) .addSubcommand(subcommand => - subcommand.setName("respawn").setDescription("Respawn all shards one by one") + subcommand.setName("respawn").setDescription("Respawn all shards one by one"), ) .addSubcommand(subcommand => subcommand .setName("run") .setDescription("Evaluate code on the bot") .addStringOption(option => - option.setName("code").setDescription("Code to be evaluated").setRequired(true) - ) + option.setName("code").setDescription("Code to be evaluated").setRequired(true), + ), ); /** diff --git a/modules/reloadable/commands/timer.js b/modules/reloadable/commands/timer.js index b621bef..6cfbdea 100644 --- a/modules/reloadable/commands/timer.js +++ b/modules/reloadable/commands/timer.js @@ -17,20 +17,20 @@ export const timerCommand = new SlashCommandBuilder() .setName("timer") .setDescription("Set a timer") .addIntegerOption(option => - option.setName(options.seconds).setDescription("Number of seconds to set the timer for") + option.setName(options.seconds).setDescription("Number of seconds to set the timer for"), ) .addIntegerOption(option => - option.setName(options.minutes).setDescription("Number of minutes to set the timer for") + option.setName(options.minutes).setDescription("Number of minutes to set the timer for"), ) .addIntegerOption(option => - option.setName(options.hours).setDescription("Number of hours to set the timer for") + option.setName(options.hours).setDescription("Number of hours to set the timer for"), ) .addIntegerOption(option => - option.setName(options.days).setDescription("Number of days to set the timer for") + option.setName(options.days).setDescription("Number of days to set the timer for"), ) .addStringOption(option => option.setName(options.reason).setDescription("Description")) .addMentionableOption(option => - option.setName(options.mention).setDescription("Mention someone once the timer is done") + option.setName(options.mention).setDescription("Mention someone once the timer is done"), ) .setDMPermission(false); diff --git a/modules/reloadable/commands/timestamp.js b/modules/reloadable/commands/timestamp.js index 8686e92..177acf0 100644 --- a/modules/reloadable/commands/timestamp.js +++ b/modules/reloadable/commands/timestamp.js @@ -34,10 +34,10 @@ export const timestampCommand = new SlashCommandBuilder() .setName(OptionName.datetime) .setDescription("The date/time for the timestamp") .setRequired(true) - .setAutocomplete(true) + .setAutocomplete(true), ) .addStringOption(option => - option.setName(OptionName.timezone).setDescription("Current timezone").setAutocomplete(true) + option.setName(OptionName.timezone).setDescription("Current timezone").setAutocomplete(true), ) .addStringOption(option => option @@ -45,8 +45,8 @@ export const timestampCommand = new SlashCommandBuilder() .setDescription("Formatting of the generated time tag") .addChoices( { name: "Show all", value: "all" }, - ...Object.entries(formats).map(([name, value]) => ({ name, value })) - ) + ...Object.entries(formats).map(([name, value]) => ({ name, value })), + ), ); /** diff --git a/modules/reloadable/sqlite3.js b/modules/reloadable/sqlite3.js index b286b60..d4f96a4 100644 --- a/modules/reloadable/sqlite3.js +++ b/modules/reloadable/sqlite3.js @@ -8,7 +8,7 @@ db.prepare( key TEXT PRIMARY KEY NOT NULL, value JSON ) - ` + `, ).run(); /* @@ -23,7 +23,7 @@ db.prepare( runId INTEGER UNIQUE NOT NULL, data TEXT NOT NULL ) STRICT - ` + `, ).run(); db.prepare( @@ -33,7 +33,7 @@ db.prepare( runId INTEGER NOT NULL, data TEXT ) STRICT - ` + `, ).run(); // covering index @@ -42,7 +42,7 @@ db.prepare( CREATE INDEX IF NOT EXISTS guildRunIdIndex ON guilds ( id, runId ) -` +`, ).run(); db.prepare( @@ -51,7 +51,7 @@ db.prepare( id TEXT PRIMARY KEY NOT NULL, data TEXT ) STRICT - ` + `, ).run(); db.prepare( @@ -67,7 +67,7 @@ db.prepare( REFERENCES guilds (id) ON DELETE CASCADE ) STRICT - ` + `, ).run(); db.prepare( @@ -75,7 +75,7 @@ db.prepare( CREATE INDEX IF NOT EXISTS nextCountdownIndex ON countdowns ( updateTime, priority ) -` +`, ).run(); /// Key-Value Load & Store @@ -84,7 +84,7 @@ const setValueStmt = db.prepare( ` INSERT INTO kv (key, value) VALUES (@key, @value) ON CONFLICT(key) DO UPDATE SET value = excluded.value - ` + `, ); export const kv = new Proxy( {}, @@ -95,7 +95,7 @@ export const kv = new Proxy( set(_, key, value) { return setValueStmt.run({ key, value }).changes === 1; }, - } + }, ); /// Cluster Table @@ -108,7 +108,7 @@ const patchClusterDataStmt = db.prepare( ON CONFLICT(id) DO UPDATE SET runId = excluded.runId, data = json_patch(clusters.data, excluded.data); - ` + `, ); export const patchClusterData = (clusterId, runId, dataObj) => patchClusterDataStmt.run({ clusterId, runId, data: JSON.stringify(dataObj) }); @@ -154,7 +154,7 @@ const insertCountdownStmt = db.prepare( INSERT INTO countdowns (guild, channel, author, updateTime, priority, data) VALUES (@guildId, @channelId, @authorId, @updateTime, @priority, json(@data)) RETURNING rowid, * - ` + `, ); export const insertCountdown = (guildId, channelId, authorId, updateTime, data, priority = 42) =>