NPE bug fix

This commit is contained in:
kraftwerk28 2021-07-02 12:22:27 +03:00
parent a8bf75a977
commit d819420811
2 changed files with 6 additions and 5 deletions

View File

@ -103,11 +103,11 @@ class TgBot(
update.message?.text?.let {
commandRegex.matchEntire(it)?.groupValues?.let {
commandMap[it[1]]?.let { it(update) }
}
} ?: run {
onTextHandler(update)
}
}
}
fun stop() {
client.run {
@ -185,9 +185,10 @@ class TgBot(
}
private suspend fun onTextHandler(update: TgApiService.Update) {
if (!config.logFromTGtoMC) return
val msg = update.message!!
plugin.sendMessageToMinecraft(msg.text!!, msg.from!!.rawUserMention())
if (!config.logFromTGtoMC || msg.from == null)
return
plugin.sendMessageToMinecraft(msg.text!!, msg.from.rawUserMention())
}
private fun formatMsgFromMinecraft(

View File

@ -1,5 +1,5 @@
name: SpigotTGBridge
version: "0.16"
version: "0.17"
api-version: "1.15"
main: org.kraftwerk28.spigot_tg_bridge.Plugin
description: Telegram <-> Minecraft communication plugin for Spigot.