Skip to content

Commit

Permalink
fix a few bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
dkim19375 committed May 13, 2021
1 parent 6ec43a7 commit 15d9094
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/main/java/me/dkim19375/dkim19375jdautils/BotBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ import me.dkim19375.dkim19375jdautils.command.CommandType
import me.dkim19375.dkim19375jdautils.event.CustomListener
import me.dkim19375.dkim19375jdautils.event.EventListener
import net.dv8tion.jda.api.JDA
import net.dv8tion.jda.api.JDABuilder
import java.util.*
import kotlin.concurrent.thread
import kotlin.system.exitProcess

@API
abstract class BotBase(
@API val jda: JDA,
val name: String,
@API val token: String,
val customListener: CustomListener = object : CustomListener() {}
) {
@API
lateinit var jda: JDA
val commandTypes = setOf<CommandType>()

@API
Expand All @@ -34,6 +37,10 @@ abstract class BotBase(
return
}
started = true
println("Starting bot")
val builder = JDABuilder.createDefault(token)
val jda = builder.build()
this.jda = jda
jda.addEventListener(EventListener(this))
Runtime.getRuntime().addShutdownHook(thread(false) {
if (jda.status != JDA.Status.SHUTDOWN && jda.status != JDA.Status.SHUTTING_DOWN) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class HelpCommand(private val bot: BotBase) : Command(bot) {
sendHelpUsage(cmd, event, command)
return
}
val embedManager = EmbedManager("UniG0 $name: ${type.displayname}", Color.BLUE, cmd, event.author)
val embedManager = EmbedManager("${bot.name} $name: ${type.displayname}", Color.BLUE, cmd, event.author)
embedManager.embedBuilder.addField(
"TIP:", "Do ${bot.getPrefix(event.guild.id)}help <command> " +
"to view information about a specific command!", false
Expand Down

0 comments on commit 15d9094

Please sign in to comment.