mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 07:18:22 +00:00
Merge pull request #43 from dalbodeule/develop
add try-catch in stream on discords.
This commit is contained in:
commit
5d0fe98c66
@ -175,8 +175,12 @@ class UserHandler(
|
||||
}
|
||||
if(!_isActive) {
|
||||
delay(5000L)
|
||||
try {
|
||||
listener.sendChat("${user.username} 님! 오늘도 열심히 방송하세요!")
|
||||
Discord.sendDiscord(user, status)
|
||||
} catch(e: Exception) {
|
||||
logger.info("Stream on logic has some error: ${e.stackTraceToString()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -6,6 +6,7 @@ import net.dv8tion.jda.api.JDA
|
||||
import net.dv8tion.jda.api.JDABuilder
|
||||
import net.dv8tion.jda.api.entities.Activity
|
||||
import net.dv8tion.jda.api.entities.Guild
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel
|
||||
import net.dv8tion.jda.api.events.guild.GuildJoinEvent
|
||||
import net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent
|
||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
|
||||
@ -30,8 +31,7 @@ class Discord: ListenerAdapter() {
|
||||
companion object {
|
||||
lateinit var bot: JDA
|
||||
|
||||
internal fun getChannel(guildId: Long, channelId: Long) =
|
||||
bot.getGuildById(guildId)?.getTextChannelById(channelId)
|
||||
internal fun getChannel(guildId: Long, channelId: Long): TextChannel? = bot.getGuildById(guildId)?.getTextChannelById(channelId)
|
||||
|
||||
fun sendDiscord(user: User, status: IData<IStreamInfo?>) {
|
||||
if(status.content == null) return
|
||||
|
Loading…
x
Reference in New Issue
Block a user