mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 07:18:22 +00:00
asdf4
This commit is contained in:
parent
8a3c64ab46
commit
35d8759ee3
@ -239,6 +239,8 @@ class UserHandler(
|
||||
CoroutineScope(Dispatchers.Default).launch {
|
||||
logger.info("${user.username} is live.")
|
||||
|
||||
reloadUser(UserService.getUser(user.id.value)!!)
|
||||
|
||||
logger.info("ChzzkChat connecting... ${channel.channelName} - ${channel.channelId}")
|
||||
listener.connectAsync().await()
|
||||
|
||||
|
@ -31,12 +31,15 @@ class Discord: ListenerAdapter() {
|
||||
companion object {
|
||||
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?>) {
|
||||
if(status.content == null) return
|
||||
if(user.liveAlertMessage != "" && user.liveAlertGuild != null && user.liveAlertChannel != null) {
|
||||
val channel = getChannel(user.liveAlertGuild!!, user.liveAlertChannel!!) ?: throw RuntimeException("${user.liveAlertChannel} is not valid.")
|
||||
if(user.liveAlertMessage != null && user.liveAlertGuild != null && user.liveAlertChannel != null) {
|
||||
val channel = getChannel(user.liveAlertGuild ?: 0, user.liveAlertChannel ?: 0)
|
||||
?: throw RuntimeException("${user.liveAlertChannel} is not valid.")
|
||||
|
||||
val embed = EmbedBuilder()
|
||||
embed.setTitle(status.content!!.liveTitle, "https://chzzk.naver.com/live/${user.token}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user