mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-22 16:47:13 +00:00
extend getChat extensions
This commit is contained in:
parent
8ae2f57d55
commit
b477e8d585
@ -63,6 +63,8 @@
|
||||
* All extensions like `CaptionedInput#toHtmlCaptions`
|
||||
* All helper extensions for `List<BaseMessageUpdate>`
|
||||
* All `RequestsExecutor#executeAsync` and `RequestsExecutor#executeUnsafe`
|
||||
* `TelegramBotAPI-extensions-api`:
|
||||
* A lot of `RequesstExecutor#getChat` extensions was added for more explicit types showing
|
||||
* `TelegramBotAPI-extensions-utils`:
|
||||
* `safely` function was introduced. It is in `PreviewFeature` state currently
|
||||
* `makeLinkToMessage` extensions has been added
|
||||
|
@ -2,8 +2,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.get
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get.GetChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.extended.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.PreviewFeature
|
||||
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chatId: ChatIdentifier
|
||||
@ -12,3 +16,117 @@ suspend fun RequestsExecutor.getChat(
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chat: Chat
|
||||
) = getChat(chat.id)
|
||||
|
||||
/**
|
||||
* Will cast incoming [com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat] to a
|
||||
* [ExtendedPublicChat] with unsafe operator "as"
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chat: PublicChat
|
||||
) = getChat(chat.id) as ExtendedPublicChat
|
||||
|
||||
|
||||
/**
|
||||
* Will cast incoming [com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat] to a
|
||||
* [ExtendedChannelChat] with unsafe operator "as"
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chat: ChannelChat
|
||||
) = getChat(chat.id) as ExtendedChannelChat
|
||||
|
||||
/**
|
||||
* Will cast incoming [com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat] to a
|
||||
* [ExtendedChannelChatImpl] with unsafe operator "as"
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chat: ChannelChatImpl
|
||||
) = getChat(chat.id) as ExtendedChannelChatImpl
|
||||
|
||||
|
||||
/**
|
||||
* Will cast incoming [com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat] to a
|
||||
* [ExtendedGroupChat] with unsafe operator "as"
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chat: GroupChat
|
||||
) = getChat(chat.id) as ExtendedGroupChat
|
||||
|
||||
/**
|
||||
* Will cast incoming [com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat] to a
|
||||
* [ExtendedGroupChatImpl] with unsafe operator "as"
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chat: GroupChatImpl
|
||||
) = getChat(chat.id) as ExtendedGroupChatImpl
|
||||
|
||||
|
||||
/**
|
||||
* Will cast incoming [com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat] to a
|
||||
* [ExtendedSupergroupChat] with unsafe operator "as"
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chat: SupergroupChat
|
||||
) = getChat(chat.id) as ExtendedSupergroupChat
|
||||
|
||||
/**
|
||||
* Will cast incoming [com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat] to a
|
||||
* [ExtendedSupergroupChatImpl] with unsafe operator "as"
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chat: SupergroupChatImpl
|
||||
) = getChat(chat.id) as ExtendedSupergroupChatImpl
|
||||
|
||||
|
||||
/**
|
||||
* Will cast incoming [com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat] to a
|
||||
* [ExtendedPrivateChat] with unsafe operator "as"
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chat: PrivateChat
|
||||
) = getChat(chat.id) as ExtendedPrivateChat
|
||||
|
||||
/**
|
||||
* Will cast incoming [com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat] to a
|
||||
* [ExtendedPrivateChatImpl] with unsafe operator "as"
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chat: PrivateChatImpl
|
||||
) = getChat(chat.id) as ExtendedPrivateChatImpl
|
||||
|
||||
/**
|
||||
* Will cast incoming [com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat] to a
|
||||
* [ExtendedUser] with unsafe operator "as"
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chat: CommonUser
|
||||
) = getChat(chat.id) as ExtendedUser
|
||||
|
Loading…
Reference in New Issue
Block a user