mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-08-08 05:11:12 +00:00
stream info add
This commit is contained in:
@@ -2,6 +2,7 @@ package space.mori.chzzk_bot.services
|
||||
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
import org.jetbrains.exposed.sql.update
|
||||
import space.mori.chzzk_bot.models.User
|
||||
import space.mori.chzzk_bot.models.Users
|
||||
|
||||
@@ -43,4 +44,18 @@ object UserService {
|
||||
User.all().toList()
|
||||
}
|
||||
}
|
||||
|
||||
fun updateLiveAlert(id: Int, guildId: Long, channelId: Long, alertMessage: String?) {
|
||||
return transaction {
|
||||
val updated = Users.update({ Users.id eq id }) {
|
||||
it[Users.liveAlertGuild] = guildId
|
||||
it[Users.liveAlertChannel] = channelId
|
||||
it[Users.liveAlertMessage] = alertMessage ?: ""
|
||||
}
|
||||
|
||||
if(updated == 0) throw RuntimeException("User not found! $id")
|
||||
|
||||
User.find(Users.id eq id)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user