diff --git a/src/main/kotlin/org/kraftwerk28/spigot_tg_bridge/TgBot.kt b/src/main/kotlin/org/kraftwerk28/spigot_tg_bridge/TgBot.kt index 397254a..ea74914 100644 --- a/src/main/kotlin/org/kraftwerk28/spigot_tg_bridge/TgBot.kt +++ b/src/main/kotlin/org/kraftwerk28/spigot_tg_bridge/TgBot.kt @@ -103,9 +103,9 @@ class TgBot( update.message?.text?.let { commandRegex.matchEntire(it)?.groupValues?.let { commandMap[it[1]]?.let { it(update) } + } ?: run { + onTextHandler(update) } - } ?: run { - onTextHandler(update) } } @@ -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( diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 787fd14..cb3e5d9 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -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.