mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-08-07 12:51:13 +00:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
34ec0f29ff | ||
|
2b999c5acb | ||
|
c669943f87 | ||
|
efaaf5ae9f | ||
|
c8fca6995c | ||
|
903f1f7f38 | ||
|
e4b6f819ca | ||
|
2c1f42e4af | ||
|
ff90e5fe7f | ||
|
a227dda930 | ||
|
3e09989202 | ||
|
eddca6dbab | ||
|
9c48dd676e | ||
|
779604d21e | ||
|
83791fe59b |
53
.github/workflows/build.yml
vendored
53
.github/workflows/build.yml
vendored
@@ -1,53 +0,0 @@
|
|||||||
name: build
|
|
||||||
|
|
||||||
# event trigger: main 브랜치에 push 이벤트 발생 시 jobs가 실행된다.
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "main" ]
|
|
||||||
|
|
||||||
# 권한 설정
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
# jobs 정의
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Set up JDK 21
|
|
||||||
uses: graalvm/setup-graalvm@v1
|
|
||||||
with:
|
|
||||||
java-version: '21'
|
|
||||||
distribution: 'graalvm'
|
|
||||||
|
|
||||||
- name: Build with Gradle
|
|
||||||
run: ./gradlew build
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Set datetime variable
|
|
||||||
id: vars
|
|
||||||
run: echo "DATETIME=$(date +'%Y%m%d%H%M')" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
${{ secrets.DOCKER_USERNAME }}/chzzkbot:${{ env.DATETIME }}
|
|
||||||
${{ secrets.DOCKER_USERNAME }}/chzzkbot:latest
|
|
21
.idea/dataSources.xml
generated
21
.idea/dataSources.xml
generated
@@ -1,24 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
<data-source source="LOCAL" name="@localhost" uuid="90f8ee11-600e-4155-a316-e8062c7c828b">
|
<data-source source="LOCAL" name="@prod" uuid="90f8ee11-600e-4155-a316-e8062c7c828b">
|
||||||
<driver-ref>mysql.8</driver-ref>
|
<driver-ref>mariadb</driver-ref>
|
||||||
<synchronize>true</synchronize>
|
<synchronize>true</synchronize>
|
||||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
|
<jdbc-url>jdbc:mariadb://localhost:3306</jdbc-url>
|
||||||
<jdbc-additional-properties>
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.resource.type" value="Deployment" />
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
|
||||||
</jdbc-additional-properties>
|
|
||||||
<working-dir>$ProjectFileDir$</working-dir>
|
|
||||||
</data-source>
|
|
||||||
<data-source source="LOCAL" name="@prod" uuid="ea495604-156c-4d96-9100-9074495ce007">
|
|
||||||
<driver-ref>mysql.8</driver-ref>
|
|
||||||
<synchronize>true</synchronize>
|
|
||||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
|
||||||
<jdbc-url>jdbc:mysql://localhost:3306/chzzk</jdbc-url>
|
|
||||||
<jdbc-additional-properties>
|
<jdbc-additional-properties>
|
||||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||||
|
19
Dockerfile
19
Dockerfile
@@ -1,23 +1,10 @@
|
|||||||
# Stage 1: Build the JAR file
|
# Use a base image with JDK 21 for the final image
|
||||||
FROM gradle:jdk21 as build
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy the Gradle files and source code
|
|
||||||
COPY build.gradle.kts settings.gradle.kts gradlew gradle.properties ./
|
|
||||||
COPY gradle gradle
|
|
||||||
COPY src src
|
|
||||||
|
|
||||||
# Build the project using Gradle
|
|
||||||
RUN ./gradlew build
|
|
||||||
|
|
||||||
# Stage 2: Run the JAR file using JDK 21
|
|
||||||
FROM openjdk:21-jdk
|
FROM openjdk:21-jdk
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy the JAR file from the build stage
|
# Copy the JAR file from the TeamCity build artifacts
|
||||||
COPY --from=build /app/build/libs/*.jar app.jar
|
COPY build/libs/chzzk_bot-*.jar app.jar
|
||||||
|
|
||||||
# Set the entry point
|
# Set the entry point
|
||||||
ENTRYPOINT ["java", "-jar", "app.jar"]
|
ENTRYPOINT ["java", "-jar", "app.jar"]
|
59
README.md
59
README.md
@@ -1,3 +1,58 @@
|
|||||||
# maybe_chzzk_bot_kotlin
|
# nabot_chzzk_bot
|
||||||
|
|
||||||
[discord](https://discord.gg/up8ANZegmy)
|
[](https://discord.gg/up8ANZegmy) [](https://teamcity.mori.space/project/NabotChzzkBot) [](https://hub.docker.com/repository/docker/dalbodeule/chzzkbot/general)
|
||||||
|
|
||||||
|
## Chzzk Chatbot with [JDA5](https://github.com/discord-jda/JDA), [chzzk4j](https://github.com/R2turnTrue/chzzk4j)
|
||||||
|
|
||||||
|
네이버 게임스트리밍 플랫폼 치지직의 챗봇입니다.
|
||||||
|
|
||||||
|
## 지원 기능
|
||||||
|
|
||||||
|
### Placeholders
|
||||||
|
|
||||||
|
- [x] \<name>
|
||||||
|
- [x] \<following>
|
||||||
|
- [x] \<counter:counter_name>
|
||||||
|
- [x] \<personal_counter:counter_name>
|
||||||
|
- [x] \<daily_counter:counter_name>
|
||||||
|
- [x] \<days:yyyy-mm-dd>
|
||||||
|
|
||||||
|
### 관리 명령어 (on Discord)
|
||||||
|
- [x] /register chzzk_id: \[치지직 고유ID]
|
||||||
|
- [x] /alert channel: \[디스코드 Channel ID] content: \[알림 내용]
|
||||||
|
- [x] /add label: \[명령어] content: \[내용]
|
||||||
|
- [x] /update label: \[명령어] content: \[내용]
|
||||||
|
- [x] /delete label: \[명령어]
|
||||||
|
### 관리 명령어 (on Chzzk chat)
|
||||||
|
- [x] !명령어추가 \[명령어] \[내용]
|
||||||
|
- [x] !명령어수정 \[명령어] \[내용]
|
||||||
|
- [x] !명령어삭제 \[명령어]
|
||||||
|
|
||||||
|
### 사용 예시
|
||||||
|
- 팔로우
|
||||||
|
- `/add label: !팔로우 content: <name>님은 오늘로 <following>일째 팔로우네요!`
|
||||||
|
- 출첵
|
||||||
|
- `/add label: !출첵 content: <name>님의 <daily_counter:attendance>번째 출석! fail_content: <name>님은 오늘 이미 출석했어요! <daily_counter:attendance>번 했네요?`
|
||||||
|
- `/add label: ? content: <name>님이 <counter:hook>개째 갈고리 수집`
|
||||||
|
- ㄱㅇㅇ
|
||||||
|
- `/add label: ㄱㅇㅇ content: <counter:cute>번째 ㄱㅇㅇ`
|
||||||
|
- `/add label: ㄱㅇㅇ content: 나누 귀여움 +<counter:cute>`
|
||||||
|
- 풉
|
||||||
|
- `/add label: 풉 content: <counter:poop>번째 비웃음?`
|
||||||
|
- `/add label: 풉키풉키 content: <counter:poop>번째 비웃음?`
|
||||||
|
- 바보
|
||||||
|
- `/add label: 바보 content: 나 바보 아니다?`
|
||||||
|
- `/add label: 바보 content: <counter:fool> 번째 바보? 나 바보 아니다?`
|
||||||
|
- 첫방송
|
||||||
|
- `/add label: 첫방송 content: 24년 7월 23일부터 <days:2024-07-23>일 째 방송중!`
|
||||||
|
|
||||||
|
## 사용 기술스택
|
||||||
|
- [Exposed](https://github.com/JetBrains/Exposed)
|
||||||
|
- [Kotlin](https://github.com/JetBrains/kotlin)
|
||||||
|
- [JDA5](https://github.com/discord-jda/JDA)
|
||||||
|
- [chzzk4j](https://github.com/R2turnTrue/chzzk4j)
|
||||||
|
- [HikariCP](https://github.com/brettwooldridge/HikariCP)
|
||||||
|
- [gson](https://github.com/google/gson)
|
||||||
|
- [mariadb](https://mariadb.org/)
|
||||||
|
- [docker](https://www.docker.com/)
|
||||||
|
- [Teamcity](https://www.jetbrains.com/teamcity/)
|
||||||
|
@@ -29,22 +29,23 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// https://mvnrepository.com/artifact/net.dv8tion/JDA
|
// https://mvnrepository.com/artifact/net.dv8tion/JDA
|
||||||
implementation("net.dv8tion:JDA:5.0.0-beta.24") {
|
implementation("net.dv8tion:JDA:5.0.1") {
|
||||||
exclude(module = "opus-java")
|
exclude(module = "opus-java")
|
||||||
}
|
}
|
||||||
// https://mvnrepository.com/artifact/io.github.R2turnTrue/chzzk4j
|
// https://mvnrepository.com/artifact/io.github.R2turnTrue/chzzk4j
|
||||||
implementation("io.github.R2turnTrue:chzzk4j:0.0.8")
|
implementation("io.github.R2turnTrue:chzzk4j:0.0.9")
|
||||||
|
|
||||||
implementation("ch.qos.logback:logback-classic:1.4.14")
|
// https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
|
||||||
|
implementation("ch.qos.logback:logback-classic:1.5.6")
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/org.jetbrains.exposed/exposed-core
|
// https://mvnrepository.com/artifact/org.jetbrains.exposed/exposed-core
|
||||||
implementation("org.jetbrains.exposed:exposed-core:0.51.1")
|
implementation("org.jetbrains.exposed:exposed-core:0.52.0")
|
||||||
// https://mvnrepository.com/artifact/org.jetbrains.exposed/exposed-dao
|
// https://mvnrepository.com/artifact/org.jetbrains.exposed/exposed-dao
|
||||||
implementation("org.jetbrains.exposed:exposed-dao:0.51.1")
|
implementation("org.jetbrains.exposed:exposed-dao:0.52.0")
|
||||||
// https://mvnrepository.com/artifact/org.jetbrains.exposed/exposed-jdbc
|
// https://mvnrepository.com/artifact/org.jetbrains.exposed/exposed-jdbc
|
||||||
implementation("org.jetbrains.exposed:exposed-jdbc:0.51.1")
|
implementation("org.jetbrains.exposed:exposed-jdbc:0.52.0")
|
||||||
// https://mvnrepository.com/artifact/org.jetbrains.exposed/exposed-kotlin-datetime
|
// https://mvnrepository.com/artifact/org.jetbrains.exposed/exposed-kotlin-datetime
|
||||||
implementation("org.jetbrains.exposed:exposed-java-time:0.51.1")
|
implementation("org.jetbrains.exposed:exposed-java-time:0.52.0")
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/com.zaxxer/HikariCP
|
// https://mvnrepository.com/artifact/com.zaxxer/HikariCP
|
||||||
implementation("com.zaxxer:HikariCP:5.1.0")
|
implementation("com.zaxxer:HikariCP:5.1.0")
|
||||||
@@ -54,11 +55,13 @@ dependencies {
|
|||||||
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-reflect
|
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-reflect
|
||||||
implementation("org.jetbrains.kotlin:kotlin-reflect:2.0.0")
|
implementation("org.jetbrains.kotlin:kotlin-reflect:2.0.0")
|
||||||
|
|
||||||
|
// https://mvnrepository.com/artifact/com.google.code.gson/gson
|
||||||
implementation("com.google.code.gson:gson:2.11.0")
|
implementation("com.google.code.gson:gson:2.11.0")
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client
|
// https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client
|
||||||
implementation("org.mariadb.jdbc:mariadb-java-client:3.4.0")
|
implementation("org.mariadb.jdbc:mariadb-java-client:3.4.1")
|
||||||
|
|
||||||
|
// https://mvnrepository.com/artifact/io.github.cdimascio/dotenv-kotlin
|
||||||
implementation("io.github.cdimascio:dotenv-kotlin:6.4.1")
|
implementation("io.github.cdimascio:dotenv-kotlin:6.4.1")
|
||||||
|
|
||||||
kotlin("stdlib")
|
kotlin("stdlib")
|
||||||
@@ -77,4 +80,8 @@ tasks.withType<Jar> {
|
|||||||
})
|
})
|
||||||
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named<JavaExec>("run") {
|
||||||
|
systemProperty("logback.configurationFile", "logback-debug.xml")
|
||||||
}
|
}
|
@@ -19,7 +19,7 @@ object Connector {
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
Database.connect(dataSource)
|
Database.connect(dataSource)
|
||||||
val tables = listOf(Users, Commands, Counters, DailyCounters, PersonalCounters)
|
val tables = listOf(Users, Commands, Counters, DailyCounters, PersonalCounters, Managers)
|
||||||
|
|
||||||
transaction {
|
transaction {
|
||||||
SchemaUtils.createMissingTablesAndColumns(* tables.toTypedArray())
|
SchemaUtils.createMissingTablesAndColumns(* tables.toTypedArray())
|
||||||
|
@@ -118,7 +118,6 @@ fun getFollowDate(chatID: String, userId: String) : IData<IFollowContent> {
|
|||||||
try {
|
try {
|
||||||
if(!response.isSuccessful) throw IOException("Unexpected code ${response.code}")
|
if(!response.isSuccessful) throw IOException("Unexpected code ${response.code}")
|
||||||
val body = response.body?.string()
|
val body = response.body?.string()
|
||||||
println(body)
|
|
||||||
val follow = gson.fromJson(body, object: TypeToken<IData<IFollowContent>>() {})
|
val follow = gson.fromJson(body, object: TypeToken<IData<IFollowContent>>() {})
|
||||||
|
|
||||||
return follow
|
return follow
|
||||||
|
@@ -25,6 +25,7 @@ class MessageHandler(
|
|||||||
private val dailyCounterPattern = Regex("<daily_counter:([^>]+)>")
|
private val dailyCounterPattern = Regex("<daily_counter:([^>]+)>")
|
||||||
private val namePattern = Regex("<name>")
|
private val namePattern = Regex("<name>")
|
||||||
private val followPattern = Regex("<following>")
|
private val followPattern = Regex("<following>")
|
||||||
|
private val daysPattern = """<days:(\d{4})-(\d{2})-(\d{2})>""".toRegex()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
reloadCommand()
|
reloadCommand()
|
||||||
@@ -118,62 +119,75 @@ class MessageHandler(
|
|||||||
var result = chat.first
|
var result = chat.first
|
||||||
var isFail = false
|
var isFail = false
|
||||||
|
|
||||||
result = dailyCounterPattern.replace(result) {
|
// Replace dailyCounterPattern
|
||||||
val name = it.groupValues[1]
|
result = dailyCounterPattern.replace(result) { matchResult ->
|
||||||
|
val name = matchResult.groupValues[1]
|
||||||
val dailyCounter = CounterService.getDailyCounterValue(name, msg.userId, user)
|
val dailyCounter = CounterService.getDailyCounterValue(name, msg.userId, user)
|
||||||
|
|
||||||
return@replace if(dailyCounter.second)
|
if (dailyCounter.second) {
|
||||||
CounterService.updateDailyCounterValue(name, msg.userId, 1, user).first.toString()
|
CounterService.updateDailyCounterValue(name, msg.userId, 1, user).first.toString()
|
||||||
else {
|
} else {
|
||||||
isFail = true
|
isFail = true
|
||||||
dailyCounter.first.toString()
|
dailyCounter.first.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isFail && chat.second != "") {
|
// Handle fail case
|
||||||
|
if (isFail && chat.second.isNotEmpty()) {
|
||||||
result = chat.second
|
result = chat.second
|
||||||
result = dailyCounterPattern.replace(result) {
|
result = dailyCounterPattern.replace(result) { matchResult ->
|
||||||
val name = it.groupValues[1]
|
val name = matchResult.groupValues[1]
|
||||||
val dailyCounter = CounterService.getDailyCounterValue(name, msg.userId, user)
|
val dailyCounter = CounterService.getDailyCounterValue(name, msg.userId, user)
|
||||||
|
|
||||||
dailyCounter.first.toString()
|
dailyCounter.first.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = followPattern.replace(result) {
|
// Replace followPattern
|
||||||
|
result = followPattern.replace(result) { matchResult ->
|
||||||
try {
|
try {
|
||||||
val followingDate = getFollowDate(listener.chatId, msg.userId)
|
val followingDate = getFollowDate(listener.chatId, msg.userId)
|
||||||
.content.streamingProperty.following?.followDate
|
.content.streamingProperty.following?.followDate
|
||||||
|
|
||||||
return@replace when (followingDate) {
|
val period = followingDate?.let {
|
||||||
null -> "0"
|
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
|
||||||
else -> {
|
val pastDate = LocalDateTime.parse(it, formatter)
|
||||||
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
|
val today = LocalDateTime.now()
|
||||||
val pastDate = LocalDateTime.parse(followingDate, formatter)
|
ChronoUnit.DAYS.between(pastDate, today)
|
||||||
val today = LocalDateTime.now()
|
} ?: 0
|
||||||
val period = ChronoUnit.DAYS.between(pastDate, today)
|
|
||||||
|
|
||||||
"$period"
|
period.toString()
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logger.error(e.message)
|
logger.error(e.message)
|
||||||
"0"
|
"0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = counterPattern.replace(result) {
|
// Replace daysPattern
|
||||||
val name = it.groupValues[1]
|
result = daysPattern.replace(result) { matchResult ->
|
||||||
|
val (year, month, day) = matchResult.destructured
|
||||||
|
val pastDate = LocalDateTime.of(year.toInt(), month.toInt(), day.toInt(), 0, 0, 0)
|
||||||
|
val today = LocalDateTime.now()
|
||||||
|
|
||||||
|
val daysBetween = ChronoUnit.DAYS.between(pastDate, today)
|
||||||
|
daysBetween.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace counterPattern
|
||||||
|
result = counterPattern.replace(result) { matchResult ->
|
||||||
|
val name = matchResult.groupValues[1]
|
||||||
CounterService.updateCounterValue(name, 1, user).toString()
|
CounterService.updateCounterValue(name, 1, user).toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
result = personalCounterPattern.replace(result) {
|
// Replace personalCounterPattern
|
||||||
val name = it.groupValues[1]
|
result = personalCounterPattern.replace(result) { matchResult ->
|
||||||
|
val name = matchResult.groupValues[1]
|
||||||
CounterService.updatePersonalCounterValue(name, msg.userId, 1, user).toString()
|
CounterService.updatePersonalCounterValue(name, msg.userId, 1, user).toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replace namePattern
|
||||||
result = namePattern.replace(result, userName)
|
result = namePattern.replace(result, userName)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -4,11 +4,13 @@ import net.dv8tion.jda.api.JDA
|
|||||||
import net.dv8tion.jda.api.JDABuilder
|
import net.dv8tion.jda.api.JDABuilder
|
||||||
import net.dv8tion.jda.api.entities.Activity
|
import net.dv8tion.jda.api.entities.Activity
|
||||||
import net.dv8tion.jda.api.entities.Guild
|
import net.dv8tion.jda.api.entities.Guild
|
||||||
|
import net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent
|
||||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
|
||||||
import net.dv8tion.jda.api.hooks.ListenerAdapter
|
import net.dv8tion.jda.api.hooks.ListenerAdapter
|
||||||
import space.mori.chzzk_bot.dotenv
|
import space.mori.chzzk_bot.dotenv
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import space.mori.chzzk_bot.discord.commands.*
|
import space.mori.chzzk_bot.discord.commands.*
|
||||||
|
import space.mori.chzzk_bot.services.ManagerService
|
||||||
|
|
||||||
class Discord: ListenerAdapter() {
|
class Discord: ListenerAdapter() {
|
||||||
private lateinit var bot: JDA
|
private lateinit var bot: JDA
|
||||||
@@ -22,6 +24,9 @@ class Discord: ListenerAdapter() {
|
|||||||
RegisterCommand,
|
RegisterCommand,
|
||||||
RemoveCommand,
|
RemoveCommand,
|
||||||
UpdateCommand,
|
UpdateCommand,
|
||||||
|
AddManagerCommand,
|
||||||
|
ListManagerCommand,
|
||||||
|
RemoveManagerCommand,
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun onSlashCommandInteraction(event: SlashCommandInteractionEvent) {
|
override fun onSlashCommandInteraction(event: SlashCommandInteractionEvent) {
|
||||||
@@ -31,6 +36,10 @@ class Discord: ListenerAdapter() {
|
|||||||
handler?.run(event, bot)
|
handler?.run(event, bot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onGuildMemberRemove(event: GuildMemberRemoveEvent) {
|
||||||
|
event.member?.let { ManagerService.deleteManager(event.guild.idLong, it.idLong) }
|
||||||
|
}
|
||||||
|
|
||||||
internal fun enable() {
|
internal fun enable() {
|
||||||
val thread = Thread {
|
val thread = Thread {
|
||||||
try {
|
try {
|
||||||
|
@@ -10,6 +10,7 @@ import space.mori.chzzk_bot.chzzk.ChzzkHandler
|
|||||||
import space.mori.chzzk_bot.chzzk.Connector
|
import space.mori.chzzk_bot.chzzk.Connector
|
||||||
import space.mori.chzzk_bot.discord.CommandInterface
|
import space.mori.chzzk_bot.discord.CommandInterface
|
||||||
import space.mori.chzzk_bot.services.CommandService
|
import space.mori.chzzk_bot.services.CommandService
|
||||||
|
import space.mori.chzzk_bot.services.ManagerService
|
||||||
import space.mori.chzzk_bot.services.UserService
|
import space.mori.chzzk_bot.services.UserService
|
||||||
|
|
||||||
object AddCommand : CommandInterface {
|
object AddCommand : CommandInterface {
|
||||||
@@ -30,12 +31,18 @@ object AddCommand : CommandInterface {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val user = UserService.getUser(event.user.idLong)
|
var user = UserService.getUser(event.user.idLong)
|
||||||
if(user == null) {
|
val manager = event.guild?.idLong?.let { ManagerService.getUser(it, event.user.idLong) }
|
||||||
event.hook.sendMessage("치지직 계정을 찾을 수 없습니다.").queue()
|
if(user == null && manager == null) {
|
||||||
|
event.hook.sendMessage("당신은 이 명령어를 사용할 수 없습니다.").queue()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user == null) {
|
||||||
|
user = manager!!.user
|
||||||
|
ManagerService.updateManager(user, event.user.idLong, event.user.effectiveName)
|
||||||
|
}
|
||||||
|
|
||||||
val commands = CommandService.getCommands(user)
|
val commands = CommandService.getCommands(user)
|
||||||
if (commands.any { it.command == label }) {
|
if (commands.any { it.command == label }) {
|
||||||
event.hook.sendMessage("$label 명령어는 이미 있습니다! 업데이트 명령어를 써주세요.").queue()
|
event.hook.sendMessage("$label 명령어는 이미 있습니다! 업데이트 명령어를 써주세요.").queue()
|
||||||
|
@@ -0,0 +1,47 @@
|
|||||||
|
package space.mori.chzzk_bot.discord.commands
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.JDA
|
||||||
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.OptionType
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.build.Commands
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.build.OptionData
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
import space.mori.chzzk_bot.discord.CommandInterface
|
||||||
|
import space.mori.chzzk_bot.services.ManagerService
|
||||||
|
import space.mori.chzzk_bot.services.UserService
|
||||||
|
|
||||||
|
object AddManagerCommand : CommandInterface {
|
||||||
|
private val logger = LoggerFactory.getLogger(this::class.java)
|
||||||
|
override val name: String = "addmanager"
|
||||||
|
override val command = Commands.slash(name, "매니저를 추가합니다.")
|
||||||
|
.addOptions(OptionData(OptionType.USER, "user", "추가할 유저를 선택하세요.", true))
|
||||||
|
|
||||||
|
override fun run(event: SlashCommandInteractionEvent, bot: JDA) {
|
||||||
|
val manager = event.getOption("user")?.asUser
|
||||||
|
|
||||||
|
if(manager == null) {
|
||||||
|
event.hook.sendMessage("유저는 필수사항입니다.").queue()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(manager.idLong == event.user.idLong) {
|
||||||
|
event.hook.sendMessage("자신은 매니저로 설정할 수 없습니다.").queue()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val user = UserService.getUser(event.user.idLong)
|
||||||
|
if(user == null) {
|
||||||
|
event.hook.sendMessage("치지직 계정을 찾을 수 없습니다.").queue()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
ManagerService.saveManager(user, manager.idLong, manager.effectiveName)
|
||||||
|
if(user.liveAlertGuild == null)
|
||||||
|
UserService.updateLiveAlert(user.id.value, event.guild!!.idLong, event.channelIdLong, "")
|
||||||
|
event.hook.sendMessage("등록이 완료되었습니다. ${manager.effectiveName}").queue()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
event.hook.sendMessage("에러가 발생했습니다.").queue()
|
||||||
|
logger.debug(e.stackTraceToString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory
|
|||||||
import space.mori.chzzk_bot.chzzk.ChzzkHandler
|
import space.mori.chzzk_bot.chzzk.ChzzkHandler
|
||||||
import space.mori.chzzk_bot.chzzk.Connector
|
import space.mori.chzzk_bot.chzzk.Connector
|
||||||
import space.mori.chzzk_bot.discord.CommandInterface
|
import space.mori.chzzk_bot.discord.CommandInterface
|
||||||
|
import space.mori.chzzk_bot.services.ManagerService
|
||||||
import space.mori.chzzk_bot.services.UserService
|
import space.mori.chzzk_bot.services.UserService
|
||||||
|
|
||||||
object AlertCommand : CommandInterface {
|
object AlertCommand : CommandInterface {
|
||||||
@@ -22,12 +23,18 @@ object AlertCommand : CommandInterface {
|
|||||||
val channel = event.getOption("channel")?.asChannel
|
val channel = event.getOption("channel")?.asChannel
|
||||||
val content = event.getOption("content")?.asString
|
val content = event.getOption("content")?.asString
|
||||||
|
|
||||||
val user = UserService.getUser(event.user.idLong)
|
var user = UserService.getUser(event.user.idLong)
|
||||||
if(user == null) {
|
val manager = event.guild?.idLong?.let { ManagerService.getUser(it, event.user.idLong) }
|
||||||
event.hook.sendMessage("치지직 계정을 찾을 수 없습니다.").queue()
|
if(user == null && manager == null) {
|
||||||
|
event.hook.sendMessage("당신은 이 명령어를 사용할 수 없습니다.").queue()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user == null) {
|
||||||
|
user = manager!!.user
|
||||||
|
ManagerService.updateManager(user, event.user.idLong, event.user.effectiveName)
|
||||||
|
}
|
||||||
|
|
||||||
val chzzkChannel = Connector.getChannel(user.token)
|
val chzzkChannel = Connector.getChannel(user.token)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@@ -0,0 +1,44 @@
|
|||||||
|
package space.mori.chzzk_bot.discord.commands
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.EmbedBuilder
|
||||||
|
import net.dv8tion.jda.api.JDA
|
||||||
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.build.Commands
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
import space.mori.chzzk_bot.discord.CommandInterface
|
||||||
|
import space.mori.chzzk_bot.services.ManagerService
|
||||||
|
import space.mori.chzzk_bot.services.UserService
|
||||||
|
|
||||||
|
object ListManagerCommand : CommandInterface {
|
||||||
|
private val logger = LoggerFactory.getLogger(this::class.java)
|
||||||
|
override val name: String = "listmanager"
|
||||||
|
override val command = Commands.slash(name, "매니저 목록을 확인합니다.")
|
||||||
|
|
||||||
|
override fun run(event: SlashCommandInteractionEvent, bot: JDA) {
|
||||||
|
try {
|
||||||
|
val managers = event.guild?.idLong?.let { ManagerService.getAllUsers(it) }
|
||||||
|
|
||||||
|
if(managers == null) {
|
||||||
|
event.channel.sendMessage("여기에서는 사용할 수 없습니다.")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val user = UserService.getUserWithGuildId(event.guild!!.idLong)
|
||||||
|
|
||||||
|
val embed = EmbedBuilder()
|
||||||
|
embed.setTitle("${user!!.username} 매니저 목록")
|
||||||
|
embed.setDescription("매니저 목록입니다.")
|
||||||
|
|
||||||
|
var idx = 1
|
||||||
|
|
||||||
|
managers.forEach {
|
||||||
|
embed.addField("${idx++}", it.lastUserName ?: it.managerId.toString(), true)
|
||||||
|
}
|
||||||
|
|
||||||
|
event.channel.sendMessageEmbeds(embed.build()).queue()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
event.hook.sendMessage("에러가 발생했습니다.").queue()
|
||||||
|
logger.debug(e.stackTraceToString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -10,6 +10,7 @@ import space.mori.chzzk_bot.chzzk.ChzzkHandler
|
|||||||
import space.mori.chzzk_bot.chzzk.Connector
|
import space.mori.chzzk_bot.chzzk.Connector
|
||||||
import space.mori.chzzk_bot.discord.CommandInterface
|
import space.mori.chzzk_bot.discord.CommandInterface
|
||||||
import space.mori.chzzk_bot.services.CommandService
|
import space.mori.chzzk_bot.services.CommandService
|
||||||
|
import space.mori.chzzk_bot.services.ManagerService
|
||||||
import space.mori.chzzk_bot.services.UserService
|
import space.mori.chzzk_bot.services.UserService
|
||||||
|
|
||||||
object RemoveCommand : CommandInterface {
|
object RemoveCommand : CommandInterface {
|
||||||
@@ -26,11 +27,18 @@ object RemoveCommand : CommandInterface {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val user = UserService.getUser(event.user.idLong)
|
var user = UserService.getUser(event.user.idLong)
|
||||||
if(user == null) {
|
val manager = event.guild?.idLong?.let { ManagerService.getUser(it, event.user.idLong) }
|
||||||
event.hook.sendMessage("치지직 계정을 찾을 수 없습니다.").queue()
|
if(user == null && manager == null) {
|
||||||
|
event.hook.sendMessage("당신은 이 명령어를 사용할 수 없습니다.").queue()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user == null) {
|
||||||
|
user = manager!!.user
|
||||||
|
ManagerService.updateManager(user, event.user.idLong, event.user.effectiveName)
|
||||||
|
}
|
||||||
|
|
||||||
val chzzkChannel = Connector.getChannel(user.token)
|
val chzzkChannel = Connector.getChannel(user.token)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@@ -0,0 +1,49 @@
|
|||||||
|
package space.mori.chzzk_bot.discord.commands
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.JDA
|
||||||
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.OptionType
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.build.Commands
|
||||||
|
import net.dv8tion.jda.api.interactions.commands.build.OptionData
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
import space.mori.chzzk_bot.discord.CommandInterface
|
||||||
|
import space.mori.chzzk_bot.services.ManagerService
|
||||||
|
import space.mori.chzzk_bot.services.UserService
|
||||||
|
|
||||||
|
object RemoveManagerCommand : CommandInterface {
|
||||||
|
private val logger = LoggerFactory.getLogger(this::class.java)
|
||||||
|
override val name: String = "removemanager"
|
||||||
|
override val command = Commands.slash(name, "매니저를 삭제합니다.")
|
||||||
|
.addOptions(OptionData(OptionType.USER, "user", "삭제할 유저를 선택하세요.", true))
|
||||||
|
|
||||||
|
override fun run(event: SlashCommandInteractionEvent, bot: JDA) {
|
||||||
|
val manager = event.getOption("user")?.asUser
|
||||||
|
|
||||||
|
if(manager == null) {
|
||||||
|
event.hook.sendMessage("유저는 필수사항입니다.").queue()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(manager.idLong == event.user.idLong) {
|
||||||
|
event.hook.sendMessage("자신은 매니저로 설정할 수 없습니다.").queue()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val user = UserService.getUser(event.user.idLong)
|
||||||
|
if(user == null) {
|
||||||
|
event.hook.sendMessage("치지직 계정을 찾을 수 없습니다.").queue()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ManagerService.getUser(user.liveAlertGuild ?: 0L, manager.idLong) == null) {
|
||||||
|
event.hook.sendMessage("${manager.name}은 매니저가 아닙니다.")
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
ManagerService.deleteManager(user, manager.idLong)
|
||||||
|
event.hook.sendMessage("삭제가 완료되었습니다. ${manager.effectiveName}").queue()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
event.hook.sendMessage("에러가 발생했습니다.").queue()
|
||||||
|
logger.debug(e.stackTraceToString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -10,6 +10,7 @@ import space.mori.chzzk_bot.chzzk.ChzzkHandler
|
|||||||
import space.mori.chzzk_bot.chzzk.Connector
|
import space.mori.chzzk_bot.chzzk.Connector
|
||||||
import space.mori.chzzk_bot.discord.CommandInterface
|
import space.mori.chzzk_bot.discord.CommandInterface
|
||||||
import space.mori.chzzk_bot.services.CommandService
|
import space.mori.chzzk_bot.services.CommandService
|
||||||
|
import space.mori.chzzk_bot.services.ManagerService
|
||||||
import space.mori.chzzk_bot.services.UserService
|
import space.mori.chzzk_bot.services.UserService
|
||||||
|
|
||||||
object UpdateCommand : CommandInterface {
|
object UpdateCommand : CommandInterface {
|
||||||
@@ -30,11 +31,18 @@ object UpdateCommand : CommandInterface {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val user = UserService.getUser(event.user.idLong)
|
var user = UserService.getUser(event.user.idLong)
|
||||||
if(user == null) {
|
val manager = event.guild?.idLong?.let { ManagerService.getUser(it, event.user.idLong) }
|
||||||
event.hook.sendMessage("치지직 계정을 찾을 수 없습니다.").queue()
|
if(user == null && manager == null) {
|
||||||
|
event.hook.sendMessage("당신은 이 명령어를 사용할 수 없습니다.").queue()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user == null) {
|
||||||
|
user = manager!!.user
|
||||||
|
ManagerService.updateManager(user, event.user.idLong, event.user.effectiveName)
|
||||||
|
}
|
||||||
|
|
||||||
val chzzkChannel = Connector.getChannel(user.token)
|
val chzzkChannel = Connector.getChannel(user.token)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
22
src/main/kotlin/space/mori/chzzk_bot/models/Manager.kt
Normal file
22
src/main/kotlin/space/mori/chzzk_bot/models/Manager.kt
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package space.mori.chzzk_bot.models
|
||||||
|
|
||||||
|
import org.jetbrains.exposed.dao.IntEntity
|
||||||
|
import org.jetbrains.exposed.dao.IntEntityClass
|
||||||
|
import org.jetbrains.exposed.dao.id.EntityID
|
||||||
|
import org.jetbrains.exposed.dao.id.IntIdTable
|
||||||
|
|
||||||
|
object Managers: IntIdTable("manager") {
|
||||||
|
val user = reference("user", Users)
|
||||||
|
val managerId = long("manager_id")
|
||||||
|
val discordGuildId = long("discord_guild_id")
|
||||||
|
var lastUserName = varchar("last_user_name", 255).nullable()
|
||||||
|
}
|
||||||
|
|
||||||
|
class Manager(id: EntityID<Int>) : IntEntity(id) {
|
||||||
|
companion object : IntEntityClass<Manager>(Managers)
|
||||||
|
|
||||||
|
var user by User referencedOn Managers.user
|
||||||
|
var managerId by Managers.managerId
|
||||||
|
var discordGuildId by Managers.discordGuildId
|
||||||
|
var lastUserName by Managers.lastUserName
|
||||||
|
}
|
@@ -81,8 +81,6 @@ object CounterService {
|
|||||||
(DailyCounters.name eq name) and (DailyCounters.userId eq userId) and (DailyCounters.user eq user.id)
|
(DailyCounters.name eq name) and (DailyCounters.userId eq userId) and (DailyCounters.user eq user.id)
|
||||||
}.singleOrNull()
|
}.singleOrNull()
|
||||||
|
|
||||||
println("$counter")
|
|
||||||
|
|
||||||
if(counter == null) {
|
if(counter == null) {
|
||||||
val newCounter = DailyCounter.new {
|
val newCounter = DailyCounter.new {
|
||||||
this.name = name
|
this.name = name
|
||||||
|
@@ -0,0 +1,70 @@
|
|||||||
|
package space.mori.chzzk_bot.services
|
||||||
|
|
||||||
|
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||||
|
import org.jetbrains.exposed.sql.and
|
||||||
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
import space.mori.chzzk_bot.models.Manager
|
||||||
|
import space.mori.chzzk_bot.models.Managers
|
||||||
|
import space.mori.chzzk_bot.models.User
|
||||||
|
|
||||||
|
object ManagerService {
|
||||||
|
fun saveManager(user: User, discordId: Long, name: String): Manager {
|
||||||
|
if (user.liveAlertGuild == null)
|
||||||
|
throw RuntimeException("${user.username} has no liveAlertGuild")
|
||||||
|
|
||||||
|
return transaction {
|
||||||
|
Manager.new {
|
||||||
|
this.user = user
|
||||||
|
this.discordGuildId = user.liveAlertGuild!!
|
||||||
|
this.managerId = discordId
|
||||||
|
this.lastUserName = name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateManager(user: User, discordId: Long, name: String): Manager {
|
||||||
|
if (user.liveAlertGuild == null)
|
||||||
|
throw RuntimeException("${user.username} has no liveAlertGuild")
|
||||||
|
|
||||||
|
val manager = getUser(user.liveAlertGuild!!, discordId)
|
||||||
|
|
||||||
|
if (manager == null)
|
||||||
|
throw RuntimeException("$name isn't manager.")
|
||||||
|
manager.lastUserName = name
|
||||||
|
|
||||||
|
return manager
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getUser(guildId: Long, discordId: Long): Manager? {
|
||||||
|
return transaction {
|
||||||
|
val manager = Manager.find(
|
||||||
|
(Managers.discordGuildId eq guildId) and (Managers.managerId eq discordId)
|
||||||
|
)
|
||||||
|
|
||||||
|
manager.firstOrNull()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getAllUsers(guildId: Long): List<Manager> {
|
||||||
|
return transaction {
|
||||||
|
Manager.find(Managers.discordGuildId eq guildId).toList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteManager(user: User, discordId: Long): Manager {
|
||||||
|
if (user.liveAlertGuild == null)
|
||||||
|
throw RuntimeException("${user.username} has no liveAlertGuild")
|
||||||
|
return deleteManager(user.liveAlertGuild!!, discordId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteManager(guildId: Long, discordId: Long): Manager {
|
||||||
|
return transaction {
|
||||||
|
val managerRow = Manager.find((Managers.discordGuildId eq guildId) and (Managers.managerId eq discordId)).firstOrNull()
|
||||||
|
|
||||||
|
managerRow ?: throw RuntimeException("Manager not found! $discordId")
|
||||||
|
managerRow.delete()
|
||||||
|
|
||||||
|
managerRow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -39,6 +39,14 @@ object UserService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getUserWithGuildId(discordGuildId: Long): User? {
|
||||||
|
return transaction {
|
||||||
|
val users = User.find(Users.liveAlertGuild eq discordGuildId)
|
||||||
|
|
||||||
|
users.firstOrNull()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun getAllUsers(): List<User> {
|
fun getAllUsers(): List<User> {
|
||||||
return transaction {
|
return transaction {
|
||||||
User.all().toList()
|
User.all().toList()
|
||||||
|
35
src/main/resources/logback-debug.xml
Normal file
35
src/main/resources/logback-debug.xml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<configuration>
|
||||||
|
|
||||||
|
<!-- 콘솔에 출력하는 기본 로그 설정 -->
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
|
<level>DEBUG</level>
|
||||||
|
</filter>
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- HikariCP 로그 레벨 설정 -->
|
||||||
|
<logger name="com.zaxxer.hikari" level="INFO" />
|
||||||
|
<logger name="o.m.jdbc.client.impl.StandardClient" level="INFO" />
|
||||||
|
<logger name="o.m.jdbc.message.server.OkPacket" level="INFO" />
|
||||||
|
<logger name="o.m.jdbc.client.impl.StandardClient" level="INFO" />
|
||||||
|
|
||||||
|
<logger name="com.zaxxer.hikari.HikariConfig" level="WARN" />
|
||||||
|
<logger name="com.zaxxer.hikari.pool.PoolBase" level="WARN" />
|
||||||
|
<logger name="com.zaxxer.hikari.pool.HikariPool" level="WARN" />
|
||||||
|
<logger name="com.zaxxer.hikari.util.DriverDataSource" level="WARN" />
|
||||||
|
|
||||||
|
<!-- Exposed 로그 레벨 설정 -->
|
||||||
|
<logger name="org.jetbrains.exposed" level="INFO" />
|
||||||
|
<logger name="Exposed" level="INFO" />
|
||||||
|
<logger name="org.jetbrains.exposed.sql" level="WARN" />
|
||||||
|
<logger name="org.jetbrains.exposed.sql.transactions" level="WARN" />
|
||||||
|
|
||||||
|
<!-- 루트 로거 설정 -->
|
||||||
|
<root level="DEBUG">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</configuration>
|
Reference in New Issue
Block a user