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
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
|
|
@ -40,8 +40,8 @@ jobs:
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/imnyang/yanmang/bot:latest
|
ghcr.io/imnyang/memos-rss/bot:latest
|
||||||
ghcr.io/imnyang/yanmang/bot:${{ env.RELEASE_VERSION }}
|
ghcr.io/imnyang/memos-rss/bot:${{ env.RELEASE_VERSION }}
|
||||||
|
|
||||||
- name: Create GitHub Release
|
- name: Create GitHub Release
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
FROM oven/bun:alpine as build
|
FROM oven/bun:alpine as build
|
||||||
|
|
||||||
# Set timezone to KST
|
RUN apk add --no-cache tzdata git
|
||||||
ENV TZ=Asia/Seoul
|
|
||||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
@ -20,6 +18,8 @@ RUN bun run build
|
||||||
|
|
||||||
FROM alpine:latest as runtime
|
FROM alpine:latest as runtime
|
||||||
|
|
||||||
|
RUN apk add --no-cache tzdata
|
||||||
|
|
||||||
ENV TZ=Asia/Seoul
|
ENV TZ=Asia/Seoul
|
||||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
|
|
||||||
|
|
|
||||||
12
compose.yml
Normal file
12
compose.yml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
services:
|
||||||
|
# Main Discord bot application
|
||||||
|
bot:
|
||||||
|
image: ghcr.io/imnyang/memos-rss/bot:latest
|
||||||
|
container_name: bot
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
volumes:
|
||||||
|
# Mount any persistent data directories if needed
|
||||||
|
- ./rss.toml:/app/rss.toml
|
||||||
|
- ./processed.json:/app/processed.json
|
||||||
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 { token, INTERVAL_MS } from "./lib/config";
|
||||||
import { commands, handleClearForum } from "./commands";
|
import { commands, handleClearForum } from "./commands";
|
||||||
import { checkRssFeeds } from "./lib/rss";
|
import { checkRssFeeds } from "./lib/rss";
|
||||||
|
|
@ -7,8 +7,25 @@ const client = new Client({
|
||||||
intents: [GatewayIntentBits.Guilds],
|
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 () => {
|
client.once("clientReady", async () => {
|
||||||
console.log(`Logged in as: ${client.user?.tag}`);
|
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
|
// Register slash commands
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue