This commit is contained in:
Asaki Yuki
2025-10-21 12:18:52 +07:00
parent d419ca91e6
commit 12214df1e9
6 changed files with 18 additions and 25 deletions

View File

@@ -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/)

View File

@@ -1,3 +1,3 @@
{
"startup_messages": ["I'm online!"]
"startup_messages": ["I'm online!", "Hello world!", "Hi there!"]
}

View File

@@ -1,3 +1,4 @@
import "./events/preload"
import dotenv from "dotenv"
dotenv.config({ quiet: true })

View File

@@ -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"))
}

View File

@@ -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",

12
src/events/preload.ts Normal file
View File

@@ -0,0 +1,12 @@
const time = Date.now()
const log = new Map<string, (...args: any[]) => 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)
}
})