Merge pull request #105 from dalbodeule/develop

chisu playlist fix
This commit is contained in:
JinU Choi 2024-08-16 08:46:26 +09:00 committed by GitHub
commit 4a754569cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -16,7 +16,6 @@ import xyz.r2turntrue.chzzk4j.chat.ChzzkChat
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoUnit
import java.util.UUID
class MessageHandler(
@ -246,6 +245,11 @@ class MessageHandler(
return
}
if (video.length > 600) {
listener.sendChat("10분이 넘는 노래는 신청할 수 없습니다.")
return
}
SongListService.saveSong(
user,
msg.userId,
@ -270,7 +274,7 @@ class MessageHandler(
)
}
listener.sendChat("노래가 추가되었습니다.")
listener.sendChat("노래가 추가되었습니다. ${video.name} - ${video.author}")
} catch(e: Exception) {
listener.sendChat("유튜브 영상 주소로 다시 신청해주세요!")
logger.info(e.stackTraceToString())

View File

@ -15,7 +15,7 @@ data class YoutubeVideo(
val length: Int
)
val regex = ".*(?:youtu.be/|v/|u/\\w/|embed/|watch\\?v=|&v=)([^#&?]*).*".toRegex()
val regex = ".*(?:youtu.be/|v/|u/\\w/|embed/|watch\\?v=|&v=|music\\.youtube\\.com/.*?\\?v=)([^#&?]*).*".toRegex()
val durationRegex = """PT(\d+H)?(\d+M)?(\d+S)?""".toRegex()
val dotenv = dotenv {