mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2024-11-25 19:48:49 +00:00
commit
bcf4ae5888
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -11,9 +11,9 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt install -y libcurl4-openssl-dev
|
||||
- name: Set up JDK 11
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
java-version: 17
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
|
@ -16,15 +16,9 @@ apply plugin: 'application'
|
||||
|
||||
mainClassName="InlineQueriesBotKt"
|
||||
|
||||
apply from: "$nativePartTemplate"
|
||||
|
||||
kotlin {
|
||||
def hostOs = System.getProperty("os.name")
|
||||
def isMingwX64 = hostOs.startsWith("Windows")
|
||||
def nativeTarget
|
||||
if (hostOs == "Linux") nativeTarget = linuxX64("native") { binaries { executable() } }
|
||||
else if (isMingwX64) nativeTarget = mingwX64("native") { binaries { executable() } }
|
||||
else throw new GradleException("Host OS is not supported in Kotlin/Native.")
|
||||
|
||||
jvm()
|
||||
|
||||
sourceSets {
|
||||
@ -35,18 +29,6 @@ kotlin {
|
||||
api "dev.inmo:tgbotapi:$telegram_bot_api_version"
|
||||
}
|
||||
}
|
||||
|
||||
nativeMain {
|
||||
dependencies {
|
||||
def engine
|
||||
|
||||
if (hostOs == "Linux") engine = "curl"
|
||||
else if (isMingwX64) engine = "winhttp"
|
||||
else throw new GradleException("Host OS is not supported in Kotlin/Native.")
|
||||
|
||||
api "io.ktor:ktor-client-$engine:$ktor_version"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions
|
||||
import dev.inmo.tgbotapi.extensions.api.EditLiveLocationInfo
|
||||
import dev.inmo.tgbotapi.extensions.api.chat.get.getChat
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.edit
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
|
||||
import dev.inmo.tgbotapi.extensions.api.handleLiveLocation
|
||||
import dev.inmo.tgbotapi.extensions.api.send.*
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitMessageDataCallbackQuery
|
||||
@ -75,7 +76,7 @@ suspend fun main(vararg args: String) {
|
||||
|
||||
sendingJob.cancel() // ends live location
|
||||
currentMessageState.value ?.let {
|
||||
edit(it, replyMarkup = null) // removing reply keyboard
|
||||
stopLiveLocation(it, replyMarkup = null)
|
||||
}
|
||||
}
|
||||
allUpdatesFlow.subscribeSafelyWithoutExceptions(this) { println(it) }
|
||||
|
@ -16,15 +16,7 @@ apply plugin: 'application'
|
||||
|
||||
mainClassName="RandomFileSenderBotKt"
|
||||
|
||||
|
||||
kotlin {
|
||||
def hostOs = System.getProperty("os.name")
|
||||
def isMingwX64 = hostOs.startsWith("Windows")
|
||||
def nativeTarget
|
||||
if (hostOs == "Linux") nativeTarget = linuxX64("native") { binaries { executable() } }
|
||||
else if (isMingwX64) nativeTarget = mingwX64("native") { binaries { executable() } }
|
||||
else throw new GradleException("Host OS is not supported in Kotlin/Native.")
|
||||
|
||||
jvm()
|
||||
|
||||
sourceSets {
|
||||
@ -35,18 +27,8 @@ kotlin {
|
||||
api "dev.inmo:tgbotapi:$telegram_bot_api_version"
|
||||
}
|
||||
}
|
||||
|
||||
nativeMain {
|
||||
dependencies {
|
||||
def engine
|
||||
|
||||
if (hostOs == "Linux") engine = "curl"
|
||||
else if (isMingwX64) engine = "winhttp"
|
||||
else throw new GradleException("Host OS is not supported in Kotlin/Native.")
|
||||
|
||||
api "io.ktor:ktor-client-$engine:$ktor_version"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "$nativePartTemplate"
|
||||
|
||||
|
@ -22,6 +22,7 @@ kotlin {
|
||||
}
|
||||
linuxX64()
|
||||
mingwX64()
|
||||
linuxArm64()
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
|
@ -12,15 +12,9 @@ plugins {
|
||||
id "org.jetbrains.kotlin.multiplatform"
|
||||
}
|
||||
|
||||
apply from: "$nativePartTemplate"
|
||||
|
||||
kotlin {
|
||||
def hostOs = System.getProperty("os.name")
|
||||
def isMingwX64 = hostOs.startsWith("Windows")
|
||||
def nativeTarget
|
||||
if (hostOs == "Linux") nativeTarget = linuxX64("native") { binaries { executable() } }
|
||||
else if (isMingwX64) nativeTarget = mingwX64("native") { binaries { executable() } }
|
||||
else throw new GradleException("Host OS is not supported in Kotlin/Native.")
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
@ -29,18 +23,6 @@ kotlin {
|
||||
api project(":ResenderBot:ResenderBotLib")
|
||||
}
|
||||
}
|
||||
|
||||
nativeMain {
|
||||
dependencies {
|
||||
def engine
|
||||
|
||||
if (hostOs == "Linux") engine = "curl"
|
||||
else if (isMingwX64) engine = "winhttp"
|
||||
else throw new GradleException("Host OS is not supported in Kotlin/Native.")
|
||||
|
||||
api "io.ktor:ktor-client-$engine:$ktor_version"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ fun main() {
|
||||
}
|
||||
}
|
||||
})
|
||||
appendText("Exit button")
|
||||
appendText("Answer in chat button")
|
||||
} ?: window.alert("Unable to load body")
|
||||
|
||||
document.body ?.appendElement("p", {})
|
||||
|
@ -52,8 +52,13 @@ suspend fun main(vararg args: String) {
|
||||
}
|
||||
) {
|
||||
routing {
|
||||
staticFiles("", File("WebApp/build/distributions")) {
|
||||
default("WebApp/build/distributions/index.html")
|
||||
val baseJsFolder = File("WebApp/build/dist/js/")
|
||||
baseJsFolder.list() ?.forEach {
|
||||
if (it == "productionExecutable" || it == "developmentExecutable") {
|
||||
staticFiles("", File(baseJsFolder, it)) {
|
||||
default("WebApp/build/dist/js/$it/index.html")
|
||||
}
|
||||
}
|
||||
}
|
||||
post("inline") {
|
||||
val requestBody = call.receiveText()
|
||||
|
@ -10,6 +10,9 @@ buildscript {
|
||||
}
|
||||
|
||||
allprojects {
|
||||
ext {
|
||||
nativePartTemplate = "${rootProject.projectDir.absolutePath}/native_template.gradle"
|
||||
}
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
@ -23,6 +26,6 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
// maven { url "https://git.inmo.dev/api/packages/InsanusMokrassar/maven" }
|
||||
maven { url "https://git.inmo.dev/api/packages/InsanusMokrassar/maven" }
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ org.gradle.parallel=true
|
||||
org.gradle.jvmargs=-Xmx2g
|
||||
|
||||
|
||||
kotlin_version=1.8.22
|
||||
telegram_bot_api_version=9.2.2
|
||||
micro_utils_version=0.19.9
|
||||
serialization_version=1.5.1
|
||||
ktor_version=2.3.4
|
||||
kotlin_version=1.9.20
|
||||
telegram_bot_api_version=9.3.0
|
||||
micro_utils_version=0.20.12
|
||||
serialization_version=1.6.0
|
||||
ktor_version=2.3.5
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
|
20
native_template.gradle
Normal file
20
native_template.gradle
Normal file
@ -0,0 +1,20 @@
|
||||
kotlin {
|
||||
def hostOs = System.getProperty("os.name")
|
||||
def isMingwX64 = hostOs.startsWith("Windows")
|
||||
def isArch64 = System.getProperty("os.arch") == "aarch64"
|
||||
|
||||
def nativeTarget
|
||||
if (hostOs == "Linux") {
|
||||
if (isArch64) {
|
||||
nativeTarget = linuxArm64("native") { binaries { executable() } }
|
||||
} else {
|
||||
nativeTarget = linuxX64("native") { binaries { executable() } }
|
||||
}
|
||||
} else {
|
||||
if (isMingwX64) {
|
||||
nativeTarget = mingwX64("native") { binaries { executable() } }
|
||||
} else {
|
||||
throw new GradleException("Host OS is not supported in Kotlin/Native.")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user