1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-28 11:37:13 +00:00

add notice about privacy handling

This commit is contained in:
InsanusMokrassar 2024-07-09 17:35:10 +06:00
parent 236f484e10
commit 610ada505f
2 changed files with 15 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder
import dev.inmo.kslog.common.e
import dev.inmo.micro_utils.coroutines.ContextSafelyExceptionHandler
import dev.inmo.micro_utils.coroutines.ExceptionHandler
import dev.inmo.tgbotapi.bot.TelegramBot
@ -8,6 +9,7 @@ import dev.inmo.tgbotapi.extensions.utils.updates.retrieving.startGettingOfUpdat
import dev.inmo.tgbotapi.extensions.utils.updates.retrieving.updateHandlerWithMediaGroupsAdaptation
import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.updateshandlers.FlowsUpdatesFilter
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
import kotlinx.coroutines.*
/**
@ -70,6 +72,9 @@ suspend fun TelegramBot.buildBehaviourWithLongPolling(
defaultExceptionsHandler = defaultExceptionsHandler,
block = block
)
if (!behaviourContext.triggersHolder.handleableCommandsHolder.isHandled("privacy")) {
DefaultKTgBotAPIKSLog.e { "For some or bots there is no handling \"privacy\" command. According to https://telegram.org/tos/bot-developers#4-privacy it may lead to bot deactivation or removing" }
}
return longPolling(
behaviourContext,
scope = behaviourContext,

View File

@ -1,11 +1,19 @@
package dev.inmo.tgbotapi.utils
import dev.inmo.kslog.common.KSLog
import dev.inmo.kslog.common.LogLevel
import dev.inmo.kslog.common.TagLogger
/**
* Default tag for [DefaultKTgBotAPIKSLog]. You may change it and tag will be changed since the near logging
*/
var DefaultKTgBotAPIKSLogSystemTag: String = "KTgBot"
/**
* Default realization of [KSLog] which will be used everywhere where there is no some custom variant of [KSLog]
*
* By default, uses [TagLogger] with tag `KTgBot` (which in fact falling back to [KSLog.default] with `KTgBot` default tag)
* By default, uses [KSLog] factory with lambda and tag [DefaultKTgBotAPIKSLogSystemTag] (which in fact falling back to
* [KSLog.default] with `KTgBot` default tag)
*/
var DefaultKTgBotAPIKSLog: KSLog = TagLogger("KTgBot")
var DefaultKTgBotAPIKSLog: KSLog = KSLog { level: LogLevel, tag: String?, message: Any, throwable: Throwable? ->
TagLogger(DefaultKTgBotAPIKSLogSystemTag).performLog(level, tag, message, throwable)
}