mirror of
https://github.com/InsanusMokrassar/TelegramBotTutorial.git
synced 2024-12-22 06:07:11 +00:00
updates
This commit is contained in:
parent
226ef5df24
commit
c951f074ae
@ -1,9 +1,9 @@
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
kotlin = "1.7.10"
|
kotlin = "1.7.10"
|
||||||
plagubot = "2.2.0"
|
plagubot = "2.3.3"
|
||||||
kslog = "0.5.1"
|
kslog = "0.5.2"
|
||||||
plagubot-commands = "0.3.2"
|
plagubot-commands = "0.3.4"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
@ -26,6 +26,8 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
|||||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonGroupContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.CommonGroupContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||||
|
import dev.inmo.tgbotapi.utils.regular
|
||||||
|
import dev.inmo.tgbotapi.utils.underline
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.coroutines.flow.filter
|
import kotlinx.coroutines.flow.filter
|
||||||
import kotlinx.coroutines.flow.first
|
import kotlinx.coroutines.flow.first
|
||||||
@ -79,17 +81,16 @@ class WelcomePlugin : Plugin {
|
|||||||
val user = groupMessage.user
|
val user = groupMessage.user
|
||||||
|
|
||||||
if (userIsAdmin(user, groupMessage.chat)) {
|
if (userIsAdmin(user, groupMessage.chat)) {
|
||||||
val sentMessage = sendMessage(
|
val sentMessage = send(
|
||||||
user,
|
user,
|
||||||
buildEntities {
|
|
||||||
regular("Ok, send me the message which should be used as welcome message for chat ")
|
|
||||||
underline(groupMessage.chat.title)
|
|
||||||
},
|
|
||||||
replyMarkup = flatInlineKeyboard {
|
replyMarkup = flatInlineKeyboard {
|
||||||
dataButton("Unset", unsetData)
|
dataButton("Unset", unsetData)
|
||||||
dataButton("Cancel", cancelData)
|
dataButton("Cancel", cancelData)
|
||||||
}
|
}
|
||||||
)
|
) {
|
||||||
|
regular("Ok, send me the message which should be used as welcome message for chat ")
|
||||||
|
underline(groupMessage.chat.title)
|
||||||
|
}
|
||||||
|
|
||||||
oneOf(
|
oneOf(
|
||||||
parallel {
|
parallel {
|
||||||
@ -97,7 +98,7 @@ class WelcomePlugin : Plugin {
|
|||||||
it.data == unsetData && it.message.sameMessage(sentMessage)
|
it.data == unsetData && it.message.sameMessage(sentMessage)
|
||||||
}.first()
|
}.first()
|
||||||
|
|
||||||
val answerEntities = buildEntities {
|
edit(sentMessage) {
|
||||||
if (welcomeTable.unset(groupMessage.chat.id)) {
|
if (welcomeTable.unset(groupMessage.chat.id)) {
|
||||||
regular("Welcome message has been removed for chat ")
|
regular("Welcome message has been removed for chat ")
|
||||||
underline(groupMessage.chat.title)
|
underline(groupMessage.chat.title)
|
||||||
@ -107,11 +108,6 @@ class WelcomePlugin : Plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
edit(
|
|
||||||
sentMessage,
|
|
||||||
answerEntities
|
|
||||||
)
|
|
||||||
|
|
||||||
answer(query)
|
answer(query)
|
||||||
},
|
},
|
||||||
parallel {
|
parallel {
|
||||||
@ -120,12 +116,11 @@ class WelcomePlugin : Plugin {
|
|||||||
}.first()
|
}.first()
|
||||||
|
|
||||||
edit(
|
edit(
|
||||||
sentMessage,
|
sentMessage
|
||||||
buildEntities {
|
) {
|
||||||
regular("You have cancelled change of welcome message for chat ")
|
regular("You have cancelled change of welcome message for chat ")
|
||||||
underline(groupMessage.chat.title)
|
underline(groupMessage.chat.title)
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
||||||
answer(query)
|
answer(query)
|
||||||
},
|
},
|
||||||
@ -142,7 +137,7 @@ class WelcomePlugin : Plugin {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
val entities = buildEntities {
|
reply(message) {
|
||||||
if (success) {
|
if (success) {
|
||||||
regular("Welcome message has been changed for chat ")
|
regular("Welcome message has been changed for chat ")
|
||||||
underline(groupMessage.chat.title)
|
underline(groupMessage.chat.title)
|
||||||
@ -153,10 +148,6 @@ class WelcomePlugin : Plugin {
|
|||||||
underline(groupMessage.chat.title)
|
underline(groupMessage.chat.title)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reply(
|
|
||||||
message,
|
|
||||||
entities
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
parallel {
|
parallel {
|
||||||
while (isActive) {
|
while (isActive) {
|
||||||
|
Loading…
Reference in New Issue
Block a user