mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-08-07 21:01:14 +00:00
fix User.kt
- set "discord", "token" row to nullable.
This commit is contained in:
@@ -29,7 +29,7 @@ object ChzzkHandler {
|
||||
private val logger = LoggerFactory.getLogger(this::class.java)
|
||||
lateinit var botUid: String
|
||||
@Volatile private var running: Boolean = false
|
||||
val dispatcher: CoroutinesEventBus by inject(CoroutinesEventBus::class.java)
|
||||
private val dispatcher: CoroutinesEventBus by inject(CoroutinesEventBus::class.java)
|
||||
|
||||
fun addUser(chzzkChannel: ChzzkChannel, user: User) {
|
||||
handlers.add(UserHandler(chzzkChannel, logger, user, streamStartTime = null))
|
||||
|
@@ -157,7 +157,7 @@ class MessageHandler(
|
||||
CoroutineScope(Dispatchers.Default).launch {
|
||||
dispatcher.post(
|
||||
TimerEvent(
|
||||
user.token,
|
||||
user.token!!,
|
||||
TimerType.UPTIME,
|
||||
getUptime(handler.streamStartTime!!)
|
||||
)
|
||||
@@ -167,7 +167,7 @@ class MessageHandler(
|
||||
"삭제" -> {
|
||||
logger.debug("${user.token} / 삭제")
|
||||
CoroutineScope(Dispatchers.Default).launch {
|
||||
dispatcher.post(TimerEvent(user.token, TimerType.REMOVE, ""))
|
||||
dispatcher.post(TimerEvent(user.token!!, TimerType.REMOVE, ""))
|
||||
}
|
||||
}
|
||||
"설정" -> {
|
||||
@@ -191,7 +191,7 @@ class MessageHandler(
|
||||
val timestamp = currentTime.plus(time.toLong(), ChronoUnit.MINUTES)
|
||||
|
||||
CoroutineScope(Dispatchers.Default).launch {
|
||||
dispatcher.post(TimerEvent(user.token, TimerType.TIMER, timestamp.toString()))
|
||||
dispatcher.post(TimerEvent(user.token!!, TimerType.TIMER, timestamp.toString()))
|
||||
}
|
||||
} catch (e: NumberFormatException) {
|
||||
listener.sendChat("!타이머/숫자 형식으로 적어주세요! 단위: 분")
|
||||
@@ -254,7 +254,7 @@ class MessageHandler(
|
||||
CoroutineScope(Dispatchers.Default).launch {
|
||||
dispatcher.post(
|
||||
SongEvent(
|
||||
user.token,
|
||||
user.token!!,
|
||||
SongType.ADD,
|
||||
msg.userId,
|
||||
msg.profile?.nickname ?: "",
|
||||
@@ -286,10 +286,12 @@ class MessageHandler(
|
||||
val session = "${UUID.randomUUID()}${UUID.randomUUID()}".replace("-", "")
|
||||
|
||||
|
||||
bot.retrieveUserById(user.discord).queue { discordUser ->
|
||||
discordUser?.openPrivateChannel()?.queue { channel ->
|
||||
channel.sendMessage("여기로 접속해주세요! ||https://nabot.mori.space/songlist||.")
|
||||
.queue()
|
||||
user.discord?.let {
|
||||
bot.retrieveUserById(it).queue { discordUser ->
|
||||
discordUser?.openPrivateChannel()?.queue { channel ->
|
||||
channel.sendMessage("여기로 접속해주세요! ||https://nabot.mori.space/songlist||.")
|
||||
.queue()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ object AddCommand : CommandInterface {
|
||||
return
|
||||
}
|
||||
|
||||
val chzzkChannel = Connector.getChannel(user!!.token)
|
||||
val chzzkChannel = user!!.token?.let { Connector.getChannel(it) }
|
||||
|
||||
try {
|
||||
CommandService.saveCommand(user!!, label, content, failContent ?: "")
|
||||
|
@@ -43,7 +43,7 @@ object AlertCommand : CommandInterface {
|
||||
return
|
||||
}
|
||||
|
||||
val chzzkChannel = Connector.getChannel(user!!.token)
|
||||
val chzzkChannel = user!!.token?.let { Connector.getChannel(it) }
|
||||
|
||||
try {
|
||||
val newUser = UserService.updateLiveAlert(user!!.id.value, channel?.guild?.idLong ?: 0L, channel?.idLong ?: 0L, content ?: "")
|
||||
|
@@ -47,7 +47,7 @@ object RemoveCommand : CommandInterface {
|
||||
return
|
||||
}
|
||||
|
||||
val chzzkChannel = Connector.getChannel(user!!.token)
|
||||
val chzzkChannel = user!!.token?.let { Connector.getChannel(it) }
|
||||
|
||||
try {
|
||||
CommandService.removeCommand(user!!, label)
|
||||
|
@@ -51,7 +51,7 @@ object UpdateCommand : CommandInterface {
|
||||
return
|
||||
}
|
||||
|
||||
val chzzkChannel = Connector.getChannel(user!!.token)
|
||||
val chzzkChannel = user!!.token?.let { Connector.getChannel(it) }
|
||||
|
||||
try {
|
||||
CommandService.updateCommand(user!!, label, content, failContent ?: "")
|
||||
|
Reference in New Issue
Block a user