mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 07:18:22 +00:00
commit
0d92027acc
@ -239,6 +239,8 @@ class UserHandler(
|
|||||||
CoroutineScope(Dispatchers.Default).launch {
|
CoroutineScope(Dispatchers.Default).launch {
|
||||||
logger.info("${user.username} is live.")
|
logger.info("${user.username} is live.")
|
||||||
|
|
||||||
|
reloadUser(UserService.getUser(user.id.value)!!)
|
||||||
|
|
||||||
logger.info("ChzzkChat connecting... ${channel.channelName} - ${channel.channelId}")
|
logger.info("ChzzkChat connecting... ${channel.channelName} - ${channel.channelId}")
|
||||||
listener.connectAsync().await()
|
listener.connectAsync().await()
|
||||||
|
|
||||||
|
@ -31,12 +31,15 @@ class Discord: ListenerAdapter() {
|
|||||||
companion object {
|
companion object {
|
||||||
lateinit var bot: JDA
|
lateinit var bot: JDA
|
||||||
|
|
||||||
internal fun getChannel(guildId: Long, channelId: Long): TextChannel? = bot.getGuildById(guildId)?.getTextChannelById(channelId)
|
internal fun getChannel(guildId: Number, channelId: Number): TextChannel? {
|
||||||
|
return bot.getGuildById(guildId.toLong())?.getTextChannelById(channelId.toLong())
|
||||||
|
}
|
||||||
|
|
||||||
fun sendDiscord(user: User, status: IData<IStreamInfo?>) {
|
fun sendDiscord(user: User, status: IData<IStreamInfo?>) {
|
||||||
if(status.content == null) return
|
if(status.content == null) return
|
||||||
if(user.liveAlertMessage != "" && user.liveAlertGuild != null && user.liveAlertChannel != null) {
|
if(user.liveAlertMessage != null && user.liveAlertGuild != null && user.liveAlertChannel != null) {
|
||||||
val channel = getChannel(user.liveAlertGuild!!, user.liveAlertChannel!!) ?: throw RuntimeException("${user.liveAlertChannel} is not valid.")
|
val channel = getChannel(user.liveAlertGuild ?: 0, user.liveAlertChannel ?: 0)
|
||||||
|
?: throw RuntimeException("${user.liveAlertChannel} is not valid.")
|
||||||
|
|
||||||
val embed = EmbedBuilder()
|
val embed = EmbedBuilder()
|
||||||
embed.setTitle(status.content!!.liveTitle, "https://chzzk.naver.com/live/${user.token}")
|
embed.setTitle(status.content!!.liveTitle, "https://chzzk.naver.com/live/${user.token}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user