WIP: Format code with Google Typescript formatting guidelines

This commit is contained in:
2025-07-04 10:39:32 -04:00
parent e53d38e0ad
commit c834acdfec
12 changed files with 596 additions and 235 deletions

View File

@@ -1,11 +1,11 @@
import type { Interaction } from "discord.js";
import { Client, Events, GatewayIntentBits, MessageFlags } from "discord.js";
import type {Interaction} from 'discord.js';
import {Client, Events, GatewayIntentBits, MessageFlags} from 'discord.js';
import type {
SlashCommandBuilder,
SlashCommandOptionsOnlyBuilder,
} from "discord.js";
} from 'discord.js';
import { sql, GuildSetting, initDb } from "./database";
import {sql, GuildSetting, initDb} from './database';
const BLITZCRANK_BANNER = `
****++++++++++*+++
@@ -71,9 +71,9 @@ const client = new Client({
],
});
import { Routes } from "discord.js";
import { guildId, appId, token, remindersChannelId } from "./config.json";
import { REST } from "discord.js";
import {Routes} from 'discord.js';
import {guildId, appId, token, remindersChannelId} from './config.json';
import {REST} from 'discord.js';
const rest = new REST();
rest.setToken(token);
@@ -84,26 +84,26 @@ interface Command {
initialize: (any) => Promise<void>;
}
import { Collection } from "discord.js";
import {Collection} from 'discord.js';
const commands = new Collection<string, Command>();
import PingCommand from "./commands/calendar/ping";
import RemindCommand from "./commands/calendar/remind";
import QuoteCommand from "./commands/quotes/quote";
import PingCommand from './commands/calendar/ping';
import RemindCommand from './commands/calendar/remind';
import QuoteCommand from './commands/quotes/quote';
console.debug(`${remindersChannelId}`);
commands.set("ping", PingCommand({ client: client, db: sql }));
commands.set('ping', PingCommand({client: client, db: sql}));
commands.set(
"remind",
'remind',
RemindCommand({
client: client,
db: sql,
publicChannel: remindersChannelId,
responseMode: "public",
responseMode: 'public',
}),
);
commands.set("quote", QuoteCommand({}));
commands.set('quote', QuoteCommand({}));
async function syncCommands() {
try {
@@ -111,7 +111,7 @@ async function syncCommands() {
const _data = await rest.put(
Routes.applicationGuildCommands(appId, guildId),
{
body: commands.mapValues((cmd) => cmd.data.toJSON()),
body: commands.mapValues(cmd => cmd.data.toJSON()),
},
);
console.log(`Successfully reloaded slash commands`);
@@ -135,7 +135,7 @@ client.on(Events.InteractionCreate, async (interaction: Interaction) => {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({
content: "There was an error while executing this command",
content: 'There was an error while executing this command',
flags: MessageFlags.Ephemeral,
});
}
@@ -143,7 +143,7 @@ client.on(Events.InteractionCreate, async (interaction: Interaction) => {
// TODO
});
client.once(Events.ClientReady, async (readyClient) => {
client.once(Events.ClientReady, async readyClient => {
await syncCommands();
initDb(); // TODO
GuildSetting.sync(); // TODO
@@ -155,7 +155,7 @@ client.once(Events.ClientReady, async (readyClient) => {
});
}
// Print banner
for (const ln of BLITZCRANK_BANNER.split("\n")) {
for (const ln of BLITZCRANK_BANNER.split('\n')) {
console.log(ln);
}
console.log(`Logged in as ${readyClient.user.tag}`);