mirror of
https://github.com/amalthea-mc/spigot-tg-bridge.git
synced 2024-11-23 19:02:21 +00:00
feature: release 0.0.14
Changelog: - fixed delayed plugin start (issue with long polling)
This commit is contained in:
parent
4a00808ab5
commit
b99748f96b
@ -8,6 +8,7 @@
|
|||||||
<option name="testRunner" value="GRADLE" />
|
<option name="testRunner" value="GRADLE" />
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="gradleHome" value="$PROJECT_DIR$/../../../../Program Files/Gradle/gradle-6.5.1" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
|
@ -32,6 +32,7 @@ class TgBot(private val plugin: Plugin, private val config: Configuration) {
|
|||||||
val slashRegex = "^/+".toRegex()
|
val slashRegex = "^/+".toRegex()
|
||||||
val commands = config.commands
|
val commands = config.commands
|
||||||
|
|
||||||
|
skipUpdates()
|
||||||
bot = bot {
|
bot = bot {
|
||||||
token = config.botToken
|
token = config.botToken
|
||||||
logLevel = HttpLoggingInterceptor.Level.NONE
|
logLevel = HttpLoggingInterceptor.Level.NONE
|
||||||
@ -45,14 +46,13 @@ class TgBot(private val plugin: Plugin, private val config: Configuration) {
|
|||||||
}.filterKeys { it != null }
|
}.filterKeys { it != null }
|
||||||
|
|
||||||
dispatch {
|
dispatch {
|
||||||
cmdBinding.forEach { text, handler ->
|
cmdBinding.forEach { (text, handler) ->
|
||||||
command(text!!, handler as HandleUpdate)
|
command(text!!.replace(slashRegex, ""), handler)
|
||||||
}
|
}
|
||||||
text(null, ::onText)
|
text(null, ::onText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bot.setMyCommands(getBotCommands())
|
bot.setMyCommands(getBotCommands())
|
||||||
bot.skipUpdates()
|
|
||||||
|
|
||||||
config.webhookConfig?.let { _ ->
|
config.webhookConfig?.let { _ ->
|
||||||
plugin.logger.info("Running in webhook mode.")
|
plugin.logger.info("Running in webhook mode.")
|
||||||
@ -173,10 +173,22 @@ class TgBot(private val plugin: Plugin, private val config: Configuration) {
|
|||||||
return cmdList.zip(descList).map { BotCommand(it.first, it.second) }
|
return cmdList.zip(descList).map { BotCommand(it.first, it.second) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun skipUpdates() {
|
||||||
|
bot {
|
||||||
|
token = config.botToken
|
||||||
|
timeout = 0
|
||||||
|
logLevel = HttpLoggingInterceptor.Level.NONE
|
||||||
|
}.skipUpdates()
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun escapeHTML(s: String) =
|
fun escapeHTML(s: String) = s
|
||||||
s.replace("&", "&").replace(">", ">").replace("<", "<")
|
.replace("&", "&")
|
||||||
|
.replace(">", ">")
|
||||||
|
.replace("<", "<")
|
||||||
|
|
||||||
fun escapeColorCodes(s: String) = s.replace("\u00A7.".toRegex(), "")
|
fun escapeColorCodes(s: String) = s.replace("\u00A7.".toRegex(), "")
|
||||||
|
|
||||||
fun fullEscape(s: String) = escapeColorCodes(escapeHTML(s))
|
fun fullEscape(s: String) = escapeColorCodes(escapeHTML(s))
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
name: SpigotTGBridge
|
name: SpigotTGBridge
|
||||||
version: 0.0.13
|
version: 0.0.14
|
||||||
api-version: '1.15'
|
api-version: '1.15'
|
||||||
main: org.kraftwerk28.spigot_tg_bridge.Plugin
|
main: org.kraftwerk28.spigot_tg_bridge.Plugin
|
||||||
description: Telegram <-> Minecraft communication plugin for Spigot.
|
description: Telegram <-> Minecraft communication plugin for Spigot.
|
||||||
|
Loading…
Reference in New Issue
Block a user