Skip to content

Commit

Permalink
build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
InsanusMokrassar committed Jan 29, 2025
1 parent ffdcc4c commit a571cbc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
34 changes: 17 additions & 17 deletions bans/src/main/kotlin/BanPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScope
import dev.inmo.tgbotapi.types.message.abstracts.*
import dev.inmo.tgbotapi.types.message.content.TextContent
import dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource
import dev.inmo.tgbotapi.types.message.textsources.bold
import dev.inmo.tgbotapi.types.message.textsources.code
import dev.inmo.tgbotapi.types.message.textsources.mention
import dev.inmo.tgbotapi.types.message.textsources.boldTextSource
import dev.inmo.tgbotapi.types.message.textsources.codeTextSource
import dev.inmo.tgbotapi.types.message.textsources.mentionTextSource
import dev.inmo.tgbotapi.types.message.textsources.plus
import dev.inmo.tgbotapi.types.message.textsources.regular
import dev.inmo.tgbotapi.types.message.textsources.regularTextSource
import dev.inmo.tgbotapi.utils.bold
import dev.inmo.tgbotapi.utils.mention
import dev.inmo.tgbotapi.utils.regular
Expand Down Expand Up @@ -193,7 +193,7 @@ class BanPlugin : Plugin {

if (sentByAdmin) {
if (!chatSettings.allowWarnAdmins && userInReply != null && userInReplyIsAnAdmin) {
reply(commandMessage, regular("User ") + mention(userInReply) + " can't be warned - he is an admin")
reply(commandMessage, regularTextSource("User ") + mentionTextSource(userInReply) + " can't be warned - he is an admin")
return@onCommand
}
val key = commandMessage.chat.id to chatId
Expand Down Expand Up @@ -272,13 +272,13 @@ class BanPlugin : Plugin {
} else {
reply(
commandMessage,
listOf(regular("User or channel have no warns"))
listOf(regularTextSource("User or channel have no warns"))
)
}
} else {
reply(
commandMessage,
listOf(regular("Sorry, you are not allowed for this action"))
listOf(regularTextSource("Sorry, you are not allowed for this action"))
)
}
}
Expand Down Expand Up @@ -306,9 +306,9 @@ class BanPlugin : Plugin {
reply(
commandMessage,
listOf(
regular("Usage: "),
code("/setChatWarningsCountCommand 3"),
regular(" (or any other number more than 0)")
regularTextSource("Usage: "),
codeTextSource("/setChatWarningsCountCommand 3"),
regularTextSource(" (or any other number more than 0)")
)
)
return@onCommand
Expand All @@ -320,12 +320,12 @@ class BanPlugin : Plugin {
)
reply(
commandMessage,
listOf(regular("Now warnings count is $newCount"))
listOf(regularTextSource("Now warnings count is $newCount"))
)
} else {
reply(
commandMessage,
listOf(regular("Sorry, you are not allowed for this action"))
listOf(regularTextSource("Sorry, you are not allowed for this action"))
)
}
}
Expand All @@ -352,11 +352,11 @@ class BanPlugin : Plugin {
val count = warningsRepository.count(messageToSearch.chat.id to user.id)
val maxCount = (chatsSettings.get(messageToSearch.chat.id) ?: ChatSettings()).warningsUntilBan
val mention = (user.userOrNull()) ?.let {
it.mention("${it.firstName} ${it.lastName}")
} ?: (user as? ChannelChat) ?.title ?.let(::regular) ?: return@onCommand
it.mentionTextSource("${it.firstName} ${it.lastName}")
} ?: (user as? ChannelChat) ?.title ?.let(::regularTextSource) ?: return@onCommand
reply(
commandMessage,
regular("User ") + mention + " have " + bold("$count/$maxCount") + " (" + bold("${maxCount - count}") + " left until ban)"
regularTextSource("User ") + mention + " have " + boldTextSource("$count/$maxCount") + " (" + boldTextSource("${maxCount - count}") + " left until ban)"
)
}
}
Expand Down Expand Up @@ -388,9 +388,9 @@ class BanPlugin : Plugin {

if (banned) {
val mention = userInReply.mapOnFirst {
mention(it)
mentionTextSource(it)
} ?: userInReply.mapOnSecond {
regular(it.title)
regularTextSource(it.title)
} ?: return@doAfterVerification
reply(commandMessage) {
+"User " + mention + " has been banned"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit a571cbc

Please sign in to comment.