Package-level declarations

Types

Link copied to clipboard
data class BotBuilder
Link copied to clipboard
@Serializable
data class EditLiveLocationInfo(val latitude: Double, val longitude: Double, val horizontalAccuracy: Meters? = null, val heading: Degrees? = null, val proximityAlertRadius: Meters? = null, val replyMarkup: InlineKeyboardMarkup? = null) : Locationed, HorizontallyAccured, ProximityAlertable, Headed, WithReplyMarkup
Link copied to clipboard
class LiveLocationProvider : Closeable

Properties

Functions

Link copied to clipboard
fun buildBot(token: String, apiUrl: String = telegramBotAPIDefaultUrl, testServer: Boolean = false, fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" }, block: BotBuilder.() -> Unit): TelegramBot
Link copied to clipboard
suspend fun TelegramBot.delete(message: AccessibleMessage)
@JvmName(name = "deleteWithMessages")
suspend fun TelegramBot.delete(messages: List<AccessibleMessage>)
suspend fun TelegramBot.delete(messagesMetas: List<Message.MetaInfo>)
suspend fun AccessibleMessage.delete(requestsExecutor: TelegramBot)
suspend fun TelegramBot.delete(chatId: ChatIdentifier, messageId: MessageId)
suspend fun TelegramBot.delete(chatId: ChatIdentifier, messageIds: Array<MessageId>)
suspend fun TelegramBot.delete(chatId: ChatIdentifier, messageIds: List<MessageId>)
suspend fun TelegramBot.delete(chat: Chat, messageId: MessageId)
Link copied to clipboard
suspend fun TelegramBot.deleteMessage(chatId: ChatIdentifier, messageId: MessageId)
suspend fun TelegramBot.deleteMessage(chat: Chat, messageId: MessageId)
Link copied to clipboard
@JvmName(name = "deleteMessagesWithMessages")
suspend fun TelegramBot.deleteMessages(messages: List<AccessibleMessage>)
suspend fun TelegramBot.deleteMessages(messagesMetas: List<Message.MetaInfo>)
suspend fun TelegramBot.deleteMessages(chatId: ChatIdentifier, messageIds: Array<MessageId>)
suspend fun TelegramBot.deleteMessages(chatId: ChatIdentifier, messageIds: List<MessageId>)
Link copied to clipboard
inline suspend fun TelegramBot.executeClose()
Link copied to clipboard
@JvmName(name = "forwardWithMessages")
suspend fun TelegramBot.forward(toChatId: ChatIdentifier, messages: List<AccessibleMessage>, threadId: MessageThreadId? = toChatId.threadId, directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId, disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false): List<MessageId>
suspend fun TelegramBot.forward(toChatId: ChatIdentifier, messagesMetas: List<Message.MetaInfo>, threadId: MessageThreadId? = toChatId.threadId, directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId, disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false): List<MessageId>
suspend fun TelegramBot.forward(toChatId: ChatIdentifier, fromChatId: ChatIdentifier, messageIds: Array<MessageId>, threadId: MessageThreadId? = toChatId.threadId, directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId, disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false): List<MessageId>
suspend fun TelegramBot.forward(toChatId: ChatIdentifier, fromChatId: ChatIdentifier, messageIds: List<MessageId>, threadId: MessageThreadId? = toChatId.threadId, directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId, disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false): List<MessageId>
Link copied to clipboard
suspend fun TelegramBot.forwardMessage(toChatId: ChatIdentifier, message: AccessibleMessage, threadId: MessageThreadId? = toChatId.threadId, directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId, startTimestamp: Seconds? = null, disableNotification: Boolean = false, protectContent: Boolean = false, effectId: EffectId? = null): PossiblyForwardedMessage
suspend fun TelegramBot.forwardMessage(toChat: Chat, message: AccessibleMessage, threadId: MessageThreadId? = toChat.id.threadId, directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId, startTimestamp: Seconds? = null, disableNotification: Boolean = false, protectContent: Boolean = false, effectId: EffectId? = null): PossiblyForwardedMessage
suspend fun TelegramBot.forwardMessage(fromChatId: ChatIdentifier, toChatId: ChatIdentifier, messageId: MessageId, threadId: MessageThreadId? = toChatId.threadId, directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId, startTimestamp: Seconds? = null, disableNotification: Boolean = false, protectContent: Boolean = false, effectId: EffectId? = null): PossiblyForwardedMessage
suspend fun TelegramBot.forwardMessage(fromChatId: ChatIdentifier, toChat: Chat, messageId: MessageId, threadId: MessageThreadId? = toChat.id.threadId, directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId, startTimestamp: Seconds? = null, disableNotification: Boolean = false, protectContent: Boolean = false, effectId: EffectId? = null): PossiblyForwardedMessage
suspend fun TelegramBot.forwardMessage(fromChat: Chat, toChatId: ChatIdentifier, messageId: MessageId, threadId: MessageThreadId? = toChatId.threadId, directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId, startTimestamp: Seconds? = null, disableNotification: Boolean = false, protectContent: Boolean = false, effectId: EffectId? = null): PossiblyForwardedMessage
suspend fun TelegramBot.forwardMessage(fromChat: Chat, toChat: Chat, messageId: MessageId, threadId: MessageThreadId? = toChat.id.threadId, directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId, startTimestamp: Seconds? = null, disableNotification: Boolean = false, protectContent: Boolean = false, effectId: EffectId? = null): PossiblyForwardedMessage
Link copied to clipboard
@JvmName(name = "forwardMessagesWithMessages")
suspend fun TelegramBot.forwardMessages(toChatId: ChatIdentifier, messages: List<AccessibleMessage>, threadId: MessageThreadId? = toChatId.threadId, directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId, disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false): List<MessageId>
suspend fun TelegramBot.forwardMessages(toChatId: ChatIdentifier, messagesMetas: List<Message.MetaInfo>, threadId: MessageThreadId? = toChatId.threadId, directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId, disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false): List<MessageId>
suspend fun TelegramBot.forwardMessages(toChatId: ChatIdentifier, fromChatId: ChatIdentifier, messageIds: Array<MessageId>, threadId: MessageThreadId? = toChatId.threadId, directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId, disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false): List<MessageId>
suspend fun TelegramBot.forwardMessages(toChatId: ChatIdentifier, fromChatId: ChatIdentifier, messageIds: List<MessageId>, threadId: MessageThreadId? = toChatId.threadId, directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId, disableNotification: Boolean = false, protectContent: Boolean = false, removeCaption: Boolean = false): List<MessageId>
Link copied to clipboard
suspend fun TelegramBot.getRawUpdates(offset: UpdateId? = null, limit: Int = getUpdatesLimit.last, timeout: Seconds? = null, allowed_updates: List<String>? = ALL_UPDATES_LIST): JsonArray
suspend fun TelegramBot.getRawUpdates(lastUpdate: Update, limit: Int = getUpdatesLimit.last, timeout: Seconds? = null, allowed_updates: List<String>? = ALL_UPDATES_LIST): JsonArray
Link copied to clipboard
suspend fun TelegramBot.getUpdates(offset: UpdateId? = null, limit: Int = getUpdatesLimit.last, timeout: Seconds? = null, allowed_updates: List<String>? = ALL_UPDATES_LIST): List<Update>
suspend fun TelegramBot.getUpdates(lastUpdate: Update, limit: Int = getUpdatesLimit.last, timeout: Seconds? = null, allowed_updates: List<String>? = ALL_UPDATES_LIST): List<Update>
Link copied to clipboard
Link copied to clipboard
suspend fun TelegramBot.handleLiveLocation(chatId: ChatIdentifier, locationsFlow: Flow<EditLiveLocationInfo>, liveTimeMillis: Long = defaultLivePeriodDelayMillis, threadId: MessageThreadId? = chatId.threadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, allowPaidBroadcast: Boolean = false, effectId: EffectId? = null, suggestedPostParameters: SuggestedPostParameters? = null, replyParameters: ReplyParameters? = null, sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null)

Will sendLiveLocation with the first EditLiveLocationInfo data and update than. Each liveTimeMillis passing, the message will be sent again and new edits will be applied to the new message

@JvmName(name = "handleLiveLocationWithLocation")
suspend fun TelegramBot.handleLiveLocation(chatId: ChatIdentifier, locationsFlow: Flow<Location>, liveTimeMillis: Long = defaultLivePeriodDelayMillis, threadId: MessageThreadId? = chatId.threadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, allowPaidBroadcast: Boolean = false, effectId: EffectId? = null, suggestedPostParameters: SuggestedPostParameters? = null, replyParameters: ReplyParameters? = null, sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null)
@JvmName(name = "handleLiveLocationWithLatLong")
suspend fun TelegramBot.handleLiveLocation(chatId: ChatIdentifier, locationsFlow: Flow<Pair<Double, Double>>, liveTimeMillis: Long = defaultLivePeriodDelayMillis, threadId: MessageThreadId? = chatId.threadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, allowPaidBroadcast: Boolean = false, effectId: EffectId? = null, suggestedPostParameters: SuggestedPostParameters? = null, replyParameters: ReplyParameters? = null, sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null)

Will apply Flow.map to the locationsFlow to create EditLiveLocationInfo and pass the result flow to the handleLiveLocation with Flow typed by EditLiveLocationInfo

Link copied to clipboard
inline suspend fun TelegramBot.logOut()
Link copied to clipboard
inline suspend fun TelegramBot.replyWithLiveLocation(to: AccessibleMessage, scope: CoroutineScope, location: StaticLocation, liveTimeMillis: Long = defaultLivePeriodDelayMillis, initHorizontalAccuracy: Meters? = null, initHeading: Degrees? = null, initProximityAlertRadius: Meters? = null, threadId: MessageThreadId? = to.threadIdOrNull, directMessageThreadId: DirectMessageThreadId? = to.directMessageThreadIdOrNull, businessConnectionId: BusinessConnectionId? = to.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, allowPaidBroadcast: Boolean = false, effectId: EffectId? = null, suggestedPostParameters: SuggestedPostParameters? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null): LiveLocationProvider
inline suspend fun TelegramBot.replyWithLiveLocation(to: AccessibleMessage, scope: CoroutineScope, latitude: Double, longitude: Double, liveTimeMillis: Long = defaultLivePeriodDelayMillis, initHorizontalAccuracy: Meters? = null, initHeading: Degrees? = null, initProximityAlertRadius: Meters? = null, threadId: MessageThreadId? = to.threadIdOrNull, directMessageThreadId: DirectMessageThreadId? = to.directMessageThreadIdOrNull, businessConnectionId: BusinessConnectionId? = to.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, allowPaidBroadcast: Boolean = false, effectId: EffectId? = null, suggestedPostParameters: SuggestedPostParameters? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null): LiveLocationProvider
Link copied to clipboard
suspend fun TelegramBot.startLiveLocation(scope: CoroutineScope, chatId: IdChatIdentifier, location: StaticLocation, liveTimeMillis: Long = defaultLivePeriodDelayMillis, initHorizontalAccuracy: Meters? = null, initHeading: Degrees? = null, initProximityAlertRadius: Meters? = null, threadId: MessageThreadId? = chatId.threadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, allowPaidBroadcast: Boolean = false, effectId: EffectId? = null, suggestedPostParameters: SuggestedPostParameters? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null): LiveLocationProvider
suspend fun TelegramBot.startLiveLocation(scope: CoroutineScope, chat: Chat, location: StaticLocation, liveTimeMillis: Long = defaultLivePeriodDelayMillis, initHorizontalAccuracy: Meters? = null, initHeading: Degrees? = null, initProximityAlertRadius: Meters? = null, threadId: MessageThreadId? = chat.id.threadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, allowPaidBroadcast: Boolean = false, effectId: EffectId? = null, suggestedPostParameters: SuggestedPostParameters? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null): LiveLocationProvider
suspend fun TelegramBot.startLiveLocation(scope: CoroutineScope, chatId: ChatIdentifier, latitude: Double, longitude: Double, liveTimeMillis: Long = defaultLivePeriodDelayMillis, initHorizontalAccuracy: Meters? = null, initHeading: Degrees? = null, initProximityAlertRadius: Meters? = null, threadId: MessageThreadId? = chatId.threadId, directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, allowPaidBroadcast: Boolean = false, effectId: EffectId? = null, suggestedPostParameters: SuggestedPostParameters? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null): LiveLocationProvider
suspend fun TelegramBot.startLiveLocation(scope: CoroutineScope, chat: Chat, latitude: Double, longitude: Double, liveTimeMillis: Long = defaultLivePeriodDelayMillis, initHorizontalAccuracy: Meters? = null, initHeading: Degrees? = null, initProximityAlertRadius: Meters? = null, threadId: MessageThreadId? = chat.id.threadId, directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, allowPaidBroadcast: Boolean = false, effectId: EffectId? = null, suggestedPostParameters: SuggestedPostParameters? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null): LiveLocationProvider
Link copied to clipboard
suspend fun TelegramBot.stopPoll(chatId: ChatIdentifier, messageId: MessageId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null): Poll
suspend fun TelegramBot.stopPoll(chatId: IdChatIdentifier, message: AccessibleMessage, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null): Poll
suspend fun TelegramBot.stopPoll(chat: Chat, messageId: MessageId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null): Poll
suspend fun TelegramBot.stopPoll(chat: Chat, message: AccessibleMessage, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null): Poll
Link copied to clipboard
fun telegramBot(urlsKeeper: TelegramAPIUrlsKeeper, client: HttpClient = HttpClient(defaultKtorEngine)): TelegramBot

Allows to create bot using bot urlsKeeper and already prepared client

inline fun telegramBot(urlsKeeper: TelegramAPIUrlsKeeper, noinline clientConfig: HttpClientConfig<*>.() -> Unit): TelegramBot

Allows to create bot using bot urlsKeeper and specify HttpClientEngine by configuring HttpClient using clientConfig

inline fun telegramBot(urlsKeeper: TelegramAPIUrlsKeeper, clientEngine: HttpClientEngine, noinline clientConfig: HttpClientConfig<*>.() -> Unit = {}): TelegramBot

Allows to create bot using bot urlsKeeper and specify HttpClientEngine by passing clientEngine param and optionally configure HttpClient using clientConfig

inline fun <T : HttpClientEngineConfig> telegramBot(urlsKeeper: TelegramAPIUrlsKeeper, clientFactory: HttpClientEngineFactory<T>, noinline clientConfig: HttpClientConfig<T>.() -> Unit = {}): TelegramBot

Allows to create bot using bot urlsKeeper and specify HttpClientEngineFactory by passing clientFactory param and optionally configure it with clientConfig

fun telegramBot(token: String, apiUrl: String = telegramBotAPIDefaultUrl, testServer: Boolean = false, fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" }, client: HttpClient = HttpClient(defaultKtorEngine)): TelegramBot

Allows to create bot using bot token, apiUrl (for custom api servers) and already prepared client

fun telegramBot(token: String, apiUrl: String = telegramBotAPIDefaultUrl, testServer: Boolean = false, fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" }, clientConfig: HttpClientConfig<*>.() -> Unit): TelegramBot

Allows to create bot using bot token and apiUrl and specify HttpClientEngine by configuring HttpClient using clientConfig

fun telegramBot(token: String, clientEngine: HttpClientEngine, apiUrl: String = telegramBotAPIDefaultUrl, testServer: Boolean = false, fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" }, clientConfig: HttpClientConfig<*>.() -> Unit = {}): TelegramBot

Allows to create bot using bot token and specify HttpClientEngine by passing clientEngine param and optionally configure HttpClient using clientConfig

fun <T : HttpClientEngineConfig> telegramBot(token: String, clientFactory: HttpClientEngineFactory<T>, apiUrl: String = telegramBotAPIDefaultUrl, testServer: Boolean = false, fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" }, clientConfig: HttpClientConfig<T>.() -> Unit = {}): TelegramBot