mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 15:28:21 +00:00
Merge pull request #6 from dalbodeule/develop
v1.0.0 - add managers (in discord) - manager can add/remove/modify commands - update some packages.
This commit is contained in:
commit
eda1591ca6
19
Dockerfile
19
Dockerfile
@ -1,23 +1,10 @@
|
||||
# Stage 1: Build the JAR file
|
||||
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
|
||||
# Use a base image with JDK 21 for the final image
|
||||
FROM openjdk:21-jdk
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the JAR file from the build stage
|
||||
COPY --from=build /app/build/libs/*.jar app.jar
|
||||
# Copy the JAR file from the TeamCity build artifacts
|
||||
COPY build/libs/chzzk_bot-*.jar app.jar
|
||||
|
||||
# Set the entry point
|
||||
ENTRYPOINT ["java", "-jar", "app.jar"]
|
@ -29,22 +29,23 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
// 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")
|
||||
}
|
||||
// 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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
implementation("com.zaxxer:HikariCP:5.1.0")
|
||||
@ -54,11 +55,13 @@ dependencies {
|
||||
// https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-reflect
|
||||
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")
|
||||
|
||||
// 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")
|
||||
|
||||
kotlin("stdlib")
|
||||
|
@ -10,6 +10,7 @@ import space.mori.chzzk_bot.chzzk.ChzzkHandler
|
||||
import space.mori.chzzk_bot.chzzk.Connector
|
||||
import space.mori.chzzk_bot.discord.CommandInterface
|
||||
import space.mori.chzzk_bot.services.CommandService
|
||||
import space.mori.chzzk_bot.services.ManagerService
|
||||
import space.mori.chzzk_bot.services.UserService
|
||||
|
||||
object AddCommand : CommandInterface {
|
||||
@ -30,12 +31,18 @@ object AddCommand : CommandInterface {
|
||||
return
|
||||
}
|
||||
|
||||
val user = UserService.getUser(event.user.idLong)
|
||||
if(user == null) {
|
||||
event.hook.sendMessage("치지직 계정을 찾을 수 없습니다.").queue()
|
||||
var user = UserService.getUser(event.user.idLong)
|
||||
val manager = event.guild?.idLong?.let { ManagerService.getUser(it, event.user.idLong) }
|
||||
if(user == null && manager == null) {
|
||||
event.hook.sendMessage("당신은 이 명령어를 사용할 수 없습니다.").queue()
|
||||
return
|
||||
}
|
||||
|
||||
if (user == null) {
|
||||
user = manager!!.user
|
||||
ManagerService.updateManager(user, event.user.idLong, event.user.effectiveName)
|
||||
}
|
||||
|
||||
val commands = CommandService.getCommands(user)
|
||||
if (commands.any { it.command == label }) {
|
||||
event.hook.sendMessage("$label 명령어는 이미 있습니다! 업데이트 명령어를 써주세요.").queue()
|
||||
|
@ -36,6 +36,8 @@ object AddManagerCommand : CommandInterface {
|
||||
|
||||
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()
|
||||
|
@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory
|
||||
import space.mori.chzzk_bot.chzzk.ChzzkHandler
|
||||
import space.mori.chzzk_bot.chzzk.Connector
|
||||
import space.mori.chzzk_bot.discord.CommandInterface
|
||||
import space.mori.chzzk_bot.services.ManagerService
|
||||
import space.mori.chzzk_bot.services.UserService
|
||||
|
||||
object AlertCommand : CommandInterface {
|
||||
@ -22,12 +23,18 @@ object AlertCommand : CommandInterface {
|
||||
val channel = event.getOption("channel")?.asChannel
|
||||
val content = event.getOption("content")?.asString
|
||||
|
||||
val user = UserService.getUser(event.user.idLong)
|
||||
if(user == null) {
|
||||
event.hook.sendMessage("치지직 계정을 찾을 수 없습니다.").queue()
|
||||
var user = UserService.getUser(event.user.idLong)
|
||||
val manager = event.guild?.idLong?.let { ManagerService.getUser(it, event.user.idLong) }
|
||||
if(user == null && manager == null) {
|
||||
event.hook.sendMessage("당신은 이 명령어를 사용할 수 없습니다.").queue()
|
||||
return
|
||||
}
|
||||
|
||||
if (user == null) {
|
||||
user = manager!!.user
|
||||
ManagerService.updateManager(user, event.user.idLong, event.user.effectiveName)
|
||||
}
|
||||
|
||||
val chzzkChannel = Connector.getChannel(user.token)
|
||||
|
||||
try {
|
||||
|
@ -10,6 +10,7 @@ import space.mori.chzzk_bot.chzzk.ChzzkHandler
|
||||
import space.mori.chzzk_bot.chzzk.Connector
|
||||
import space.mori.chzzk_bot.discord.CommandInterface
|
||||
import space.mori.chzzk_bot.services.CommandService
|
||||
import space.mori.chzzk_bot.services.ManagerService
|
||||
import space.mori.chzzk_bot.services.UserService
|
||||
|
||||
object RemoveCommand : CommandInterface {
|
||||
@ -26,11 +27,18 @@ object RemoveCommand : CommandInterface {
|
||||
return
|
||||
}
|
||||
|
||||
val user = UserService.getUser(event.user.idLong)
|
||||
if(user == null) {
|
||||
event.hook.sendMessage("치지직 계정을 찾을 수 없습니다.").queue()
|
||||
var user = UserService.getUser(event.user.idLong)
|
||||
val manager = event.guild?.idLong?.let { ManagerService.getUser(it, event.user.idLong) }
|
||||
if(user == null && manager == null) {
|
||||
event.hook.sendMessage("당신은 이 명령어를 사용할 수 없습니다.").queue()
|
||||
return
|
||||
}
|
||||
|
||||
if (user == null) {
|
||||
user = manager!!.user
|
||||
ManagerService.updateManager(user, event.user.idLong, event.user.effectiveName)
|
||||
}
|
||||
|
||||
val chzzkChannel = Connector.getChannel(user.token)
|
||||
|
||||
try {
|
||||
|
@ -10,6 +10,7 @@ import space.mori.chzzk_bot.chzzk.ChzzkHandler
|
||||
import space.mori.chzzk_bot.chzzk.Connector
|
||||
import space.mori.chzzk_bot.discord.CommandInterface
|
||||
import space.mori.chzzk_bot.services.CommandService
|
||||
import space.mori.chzzk_bot.services.ManagerService
|
||||
import space.mori.chzzk_bot.services.UserService
|
||||
|
||||
object UpdateCommand : CommandInterface {
|
||||
@ -30,11 +31,18 @@ object UpdateCommand : CommandInterface {
|
||||
return
|
||||
}
|
||||
|
||||
val user = UserService.getUser(event.user.idLong)
|
||||
if(user == null) {
|
||||
event.hook.sendMessage("치지직 계정을 찾을 수 없습니다.").queue()
|
||||
var user = UserService.getUser(event.user.idLong)
|
||||
val manager = event.guild?.idLong?.let { ManagerService.getUser(it, event.user.idLong) }
|
||||
if(user == null && manager == null) {
|
||||
event.hook.sendMessage("당신은 이 명령어를 사용할 수 없습니다.").queue()
|
||||
return
|
||||
}
|
||||
|
||||
if (user == null) {
|
||||
user = manager!!.user
|
||||
ManagerService.updateManager(user, event.user.idLong, event.user.effectiveName)
|
||||
}
|
||||
|
||||
val chzzkChannel = Connector.getChannel(user.token)
|
||||
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user