From 12214df1e98143a15d59f070d74aab44fb3f4762 Mon Sep 17 00:00:00 2001 From: Asaki Yuki <108646953+AsakiYuki@users.noreply.github.com> Date: Tue, 21 Oct 2025 12:18:52 +0700 Subject: [PATCH] idk --- README.Docker.md | 22 ---------------------- config.json | 2 +- src/app.ts | 1 + src/cmd/ping.ts | 2 +- src/events/clientReady.ts | 4 +++- src/events/preload.ts | 12 ++++++++++++ 6 files changed, 18 insertions(+), 25 deletions(-) delete mode 100644 README.Docker.md create mode 100644 src/events/preload.ts diff --git a/README.Docker.md b/README.Docker.md deleted file mode 100644 index 5a7ae36..0000000 --- a/README.Docker.md +++ /dev/null @@ -1,22 +0,0 @@ -### Building and running your application - -When you're ready, start your application by running: -`docker compose up --build`. - -Your application will be available at http://localhost:8080. - -### Deploying your application to the cloud - -First, build your image, e.g.: `docker build -t myapp .`. -If your cloud uses a different CPU architecture than your development -machine (e.g., you are on a Mac M1 and your cloud provider is amd64), -you'll want to build the image for that platform, e.g.: -`docker build --platform=linux/amd64 -t myapp .`. - -Then, push it to your registry, e.g. `docker push myregistry.com/myapp`. - -Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/) -docs for more detail on building and pushing. - -### References -* [Docker's Node.js guide](https://docs.docker.com/language/nodejs/) \ No newline at end of file diff --git a/config.json b/config.json index c37abed..c0b2c11 100644 --- a/config.json +++ b/config.json @@ -1,3 +1,3 @@ { - "startup_messages": ["I'm online!"] + "startup_messages": ["I'm online!", "Hello world!", "Hi there!"] } diff --git a/src/app.ts b/src/app.ts index 838ab8e..04f6cba 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,3 +1,4 @@ +import "./events/preload" import dotenv from "dotenv" dotenv.config({ quiet: true }) diff --git a/src/cmd/ping.ts b/src/cmd/ping.ts index 442d6fe..254e148 100644 --- a/src/cmd/ping.ts +++ b/src/cmd/ping.ts @@ -3,5 +3,5 @@ import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js" export const data = new SlashCommandBuilder().setName("ping").setDescription("Replies with Pong!") export const exec = async (interaction: ChatInputCommandInteraction) => { - await interaction.reply("Pong!") + await interaction.reply(["Pong!", "# Client "].join("\n")) } diff --git a/src/events/clientReady.ts b/src/events/clientReady.ts index 86a08c1..87b490b 100644 --- a/src/events/clientReady.ts +++ b/src/events/clientReady.ts @@ -1,10 +1,12 @@ import { ActivityType } from "discord.js" import { client } from "../components/client" import config from "../components/config" +import { execCmds } from "../cmd" client.on("clientReady", async client => { try { - console.log(`Logged in as ${client.user?.tag}`) + console.info(`Logged in as ${client.user?.tag}`) + console.info(`${execCmds.size} commands loaded.`) client.user.setActivity({ name: "Docker", diff --git a/src/events/preload.ts b/src/events/preload.ts new file mode 100644 index 0000000..aa0b181 --- /dev/null +++ b/src/events/preload.ts @@ -0,0 +1,12 @@ +const time = Date.now() + +const log = new Map void>() +const keys = Object.keys(console).filter(key => !key.includes("time")) + +keys.forEach(key => { + const func: (...args: any[]) => void = (console as any)[key] + log.set(key, func) + ;(console as any)[key] = (...args: any[]) => { + log.get(key)?.(`[${Date.now() - time}ms] [${key.toUpperCase()}]`, ...args) + } +})