DiscordBotが起動しないバグ修正

This commit is contained in:
M-E-C
2020-06-21 17:23:32 +09:00
parent e5246ae108
commit eca258d4cb
2 changed files with 6 additions and 15 deletions

View File

@ -26,19 +26,8 @@ class BungeeDiscordChat : Plugin(), Listener{
var discord = DiscordBot()
override fun onEnable() {
/**
for (command in arrayOf(
"tell", "msg", "message", "m", "w", "t")) {
proxy.pluginManager.registerCommand(
this, TellCommand(this, command))
}
for (command in arrayOf("reply", "r")) {
proxy.pluginManager.registerCommand(
this, ReplyCommand(this, command))
}
**/
loadConfig()
logger.info("Config Loaded")
proxy.pluginManager.registerListener(this, this)
}
@ -53,9 +42,11 @@ class BungeeDiscordChat : Plugin(), Listener{
discord.commandlogChannelID = config.getLong("Discord.CommandlogChannel")
discord.systemChannelID = config.getLong("Discord.SystemChannel")
discord.plugin = this
discord.setup()
} catch (e: NullPointerException) {
e.printStackTrace()
discord.system("[Error]${e.localizedMessage}")
logger.info("[Error]${e.localizedMessage}")
}
}

View File

@ -16,7 +16,7 @@ class DiscordBot : ListenerAdapter() {
lateinit var jda: JDA
var token:String? = null
var guild: Guild? = null;
var guild: Guild? = null
var guildID:Long = 0
var chatChannelID:Long = 0
@ -61,7 +61,7 @@ class DiscordBot : ListenerAdapter() {
jda = JDABuilder(AccountType.BOT).setToken(token).addEventListeners(this).build()
jda.awaitReady()
guild = jda.getGuildById(this.guildID);
guild = jda.getGuildById(this.guildID)
chatChannel = guild?.getTextChannelById(this.chatChannelID)
systemChannel = guild?.getTextChannelById(this.systemChannelID)
commandlogChannel = guild?.getTextChannelById(this.commandlogChannelID)