mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 07:18:22 +00:00
asdf3
This commit is contained in:
parent
1bea333d9d
commit
8a3c64ab46
@ -72,12 +72,21 @@ fun Routing.wsSongListRoutes() {
|
|||||||
is Frame.Text -> {
|
is Frame.Text -> {
|
||||||
if (frame.readText() == "ping") {
|
if (frame.readText() == "ping") {
|
||||||
send("pong")
|
send("pong")
|
||||||
}
|
} else {
|
||||||
val data = frame.readText().let { Json.decodeFromString<SongRequest>(it) }
|
val data = frame.readText().let { Json.decodeFromString<SongRequest>(it) }
|
||||||
|
|
||||||
if(data.maxQueue != null && data.maxQueue > 0) SongConfigService.updateQueueLimit(user, data.maxQueue)
|
if (data.maxQueue != null && data.maxQueue > 0) SongConfigService.updateQueueLimit(
|
||||||
if(data.maxUserLimit != null && data.maxUserLimit > 0) SongConfigService.updatePersonalLimit(user, data.maxUserLimit)
|
user,
|
||||||
if(data.isStreamerOnly != null) SongConfigService.updateStreamerOnly(user, data.isStreamerOnly)
|
data.maxQueue
|
||||||
|
)
|
||||||
|
if (data.maxUserLimit != null && data.maxUserLimit > 0) SongConfigService.updatePersonalLimit(
|
||||||
|
user,
|
||||||
|
data.maxUserLimit
|
||||||
|
)
|
||||||
|
if (data.isStreamerOnly != null) SongConfigService.updateStreamerOnly(
|
||||||
|
user,
|
||||||
|
data.isStreamerOnly
|
||||||
|
)
|
||||||
if (data.isDisabled != null) SongConfigService.updateDisabled(user, data.isDisabled)
|
if (data.isDisabled != null) SongConfigService.updateDisabled(user, data.isDisabled)
|
||||||
|
|
||||||
if (data.type == SongType.ADD.value && data.url != null) {
|
if (data.type == SongType.ADD.value && data.url != null) {
|
||||||
@ -111,9 +120,9 @@ fun Routing.wsSongListRoutes() {
|
|||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logger.debug("SongType.ADD Error: $uid $e")
|
logger.debug("SongType.ADD Error: $uid $e")
|
||||||
}
|
}
|
||||||
}
|
} else if (data.type == SongType.REMOVE.value && data.url != null) {
|
||||||
else if(data.type == SongType.REMOVE.value && data.url != null) {
|
dispatcher.post(
|
||||||
dispatcher.post(SongEvent(
|
SongEvent(
|
||||||
user.token!!,
|
user.token!!,
|
||||||
SongType.REMOVE,
|
SongType.REMOVE,
|
||||||
null,
|
null,
|
||||||
@ -122,7 +131,8 @@ fun Routing.wsSongListRoutes() {
|
|||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
data.url
|
data.url
|
||||||
))
|
)
|
||||||
|
)
|
||||||
} else if (data.type == SongType.NEXT.value) {
|
} else if (data.type == SongType.NEXT.value) {
|
||||||
val songList = SongListService.getSong(user)
|
val songList = SongListService.getSong(user)
|
||||||
if (songList.isNotEmpty()) {
|
if (songList.isNotEmpty()) {
|
||||||
@ -130,7 +140,8 @@ fun Routing.wsSongListRoutes() {
|
|||||||
SongListService.deleteSong(user, song.uid, song.name)
|
SongListService.deleteSong(user, song.uid, song.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatcher.post(SongEvent(
|
dispatcher.post(
|
||||||
|
SongEvent(
|
||||||
user.token!!,
|
user.token!!,
|
||||||
SongType.NEXT,
|
SongType.NEXT,
|
||||||
null,
|
null,
|
||||||
@ -139,7 +150,9 @@ fun Routing.wsSongListRoutes() {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
))
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Frame.Ping -> send(Frame.Pong(frame.data))
|
is Frame.Ping -> send(Frame.Pong(frame.data))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user