Update Dockerfile, main.yml, and index.ts for bot configuration and activity status
This commit is contained in:
parent
e176b1c094
commit
4cb7666826
4 changed files with 35 additions and 6 deletions
19
src/index.ts
19
src/index.ts
|
|
@ -1,4 +1,4 @@
|
|||
import { Client, GatewayIntentBits, REST, Routes } from "discord.js";
|
||||
import { ActivityType, Client, GatewayIntentBits, REST, Routes } from "discord.js";
|
||||
import { token, INTERVAL_MS } from "./lib/config";
|
||||
import { commands, handleClearForum } from "./commands";
|
||||
import { checkRssFeeds } from "./lib/rss";
|
||||
|
|
@ -7,8 +7,25 @@ const client = new Client({
|
|||
intents: [GatewayIntentBits.Guilds],
|
||||
});
|
||||
|
||||
async function getGitCommitHash(): Promise<string> {
|
||||
try {
|
||||
const data = await Bun.file("./version").text();
|
||||
return data.trim();
|
||||
} catch {
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
client.once("clientReady", async () => {
|
||||
console.log(`Logged in as: ${client.user?.tag}`);
|
||||
|
||||
// Git commit hash로 상태 설정
|
||||
const commitHash = await getGitCommitHash();
|
||||
client.user?.setActivity({
|
||||
name: `${commitHash}`,
|
||||
type: ActivityType.Playing,
|
||||
});
|
||||
console.log(`Version: ${commitHash}`);
|
||||
|
||||
// Register slash commands
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue