mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 07:18:22 +00:00
Merge pull request #24 from dalbodeule/develop
some changes on Connector, RegisterCommand
This commit is contained in:
commit
5b19331890
@ -1,5 +1,8 @@
|
||||
package space.mori.chzzk_bot.chatbot.discord.commands
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import net.dv8tion.jda.api.JDA
|
||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
|
||||
import net.dv8tion.jda.api.interactions.commands.OptionType
|
||||
@ -38,9 +41,12 @@ object RegisterCommand: CommandInterface {
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
val user = UserService.saveUser(chzzkChannel.channelName, chzzkChannel.channelId, event.user.idLong)
|
||||
CoroutineScope(Dispatchers.Main).launch {
|
||||
ChzzkHandler.addUser(chzzkChannel, user)
|
||||
}
|
||||
event.hook.sendMessage("등록이 완료되었습니다. `${chzzkChannel.channelId}` - `${chzzkChannel.channelName}`")
|
||||
ChzzkHandler.addUser(chzzkChannel, user)
|
||||
} catch(e: Exception) {
|
||||
event.hook.sendMessage("에러가 발생했습니다.").queue()
|
||||
logger.debug(e.stackTraceToString())
|
||||
|
@ -24,7 +24,15 @@ object Connector {
|
||||
|
||||
init {
|
||||
Database.connect(dataSource)
|
||||
val tables = listOf(Users, Commands, Counters, DailyCounters, PersonalCounters, Managers)
|
||||
val tables = listOf(
|
||||
Users,
|
||||
Commands,
|
||||
Counters,
|
||||
DailyCounters,
|
||||
PersonalCounters,
|
||||
Managers,
|
||||
TimerConfigs
|
||||
)
|
||||
|
||||
transaction {
|
||||
SchemaUtils.createMissingTablesAndColumns(* tables.toTypedArray())
|
||||
|
Loading…
x
Reference in New Issue
Block a user