UserKtx - libtd-ktx

Kotlin Coroutines extensions for Telegram API TDLib (Telegram Database library)


libtd-ktx / kotlinx.telegram.extensions / UserKtx

UserKtx

interface UserKtx : BaseKtx

Interface for access TdApi.User extension functions. Can be used alongside with other extension interfaces of the package. Must contain TelegramFlow instance field to access its functionality

Properties

api Instance of the TelegramFlow connecting extensions to the Telegram Clientabstract val api: TelegramFlow

Functions

addChatMember Suspend function, which adds a new member to a chat. Members can’t be added to private or secret chats. Members will not be added until the chat state has been synchronized with the server.open suspend fun User.addChatMember(chatId: Long, forwardLimit: Int): Unit
addStickerToSet Suspend function, which adds a new sticker to a set; for bots only. Returns the sticker set.open suspend fun User.addStickerToSet(name: String?, sticker: InputSticker?): StickerSet
block Suspend function, which adds a user to the blacklist.open suspend fun User.block(): Unit
createCall Suspend function, which creates a new call.open suspend fun User.createCall(protocol: CallProtocol?): CallId
createNewSecretChat Suspend function, which creates a new secret chat. Returns the newly created chat.open suspend fun User.createNewSecretChat(): Chat
createNewStickerSet Suspend function, which creates a new sticker set; for bots only. Returns the newly created sticker set.open suspend fun User.createNewStickerSet(title: String?, name: String?, isMasks: Boolean, stickers: Array<InputSticker>?): StickerSet
createPrivateChat Suspend function, which returns an existing chat corresponding to a given user.open suspend fun User.createPrivateChat(force: Boolean): Chat
deleteChatMessagesFrom Suspend function, which deletes all messages sent by the specified user to a chat. Supported only for supergroups; requires canDeleteMessages administrator privileges.open suspend fun User.deleteChatMessagesFrom(chatId: Long): Unit
get Suspend function, which returns information about a user by their identifier. This is an offline request if the current user is not a bot.open suspend fun User.get(): User
getChatMember Suspend function, which returns information about a single member of a chat.open suspend fun User.getChatMember(chatId: Long): ChatMember
getFullInfo Suspend function, which returns full information about a user by their identifier.open suspend fun User.getFullInfo(): UserFullInfo
getGameHighScores Suspend function, which returns the high scores for a game and some part of the high score table in the range of the specified user; for bots only.open suspend fun User.getGameHighScores(chatId: Long, messageId: Long): GameHighScores
getGroupsInCommon Suspend function, which returns a list of common group chats with a given user. Chats are sorted by their type and creation date.open suspend fun User.getGroupsInCommon(offsetChatId: Long, limit: Int): Chats
getInlineGameHighScores Suspend function, which returns game high scores and some part of the high score table in the range of the specified user; for bots only.open suspend fun User.getInlineGameHighScores(inlineMessageId: String?): GameHighScores
getProfilePhotos Suspend function, which returns the profile photos of a user. The result of this query may be outdated: some photos might have been deleted already.open suspend fun User.getProfilePhotos(offset: Int, limit: Int): UserProfilePhotos
reportSupergroupSpam Suspend function, which reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup.open suspend fun User.reportSupergroupSpam(supergroupId: Int, messageIds: LongArray?): Unit
setChatMemberStatus Suspend function, which changes the status of a chat member, needs appropriate privileges. This function is currently not suitable for adding new members to the chat and transferring chat ownership; instead, use addChatMember or transferChatOwnership. The chat member status will not be changed until it has been synchronized with the server.open suspend fun User.setChatMemberStatus(chatId: Long, status: ChatMemberStatus?): Unit
setGameScore Suspend function, which updates the game score of the specified user in the game; for bots only.open suspend fun User.setGameScore(chatId: Long, messageId: Long, editMessage: Boolean, score: Int, force: Boolean): Message
setInlineGameScore Suspend function, which updates the game score of the specified user in a game; for bots only.open suspend fun User.setInlineGameScore(inlineMessageId: String?, editMessage: Boolean, score: Int, force: Boolean): Unit
setPassportElementErrors Suspend function, which informs the user that some of the elements in their Telegram Passport contain errors; for bots only. The user will not be able to resend the elements, until the errors are fixed.open suspend fun User.setPassportElementErrors(errors: Array<InputPassportElementError>?): Unit
sharePhoneNumber Suspend function, which shares the phone number of the current user with a mutual contact. Supposed to be called when the user clicks on chatActionBarSharePhoneNumber.open suspend fun User.sharePhoneNumber(): Unit
transferChatOwnership Suspend function, which changes the owner of a chat. The current user must be a current owner of the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats.open suspend fun User.transferChatOwnership(chatId: Long, password: String?): Unit
unblock Suspend function, which removes a user from the blacklist.open suspend fun User.unblock(): Unit
uploadStickerFile Suspend function, which uploads a PNG image with a sticker; for bots only; returns the uploaded file.open suspend fun User.uploadStickerFile(pngSticker: InputFile?): File

Inheritors

TelegramKtx Interface for access all Telegram objects extension functions. Contains 182 extensionsinterface TelegramKtx : BasicGroupKtx, CallKtx, ChatKtx, FileKtx, MessageKtx, NotificationGroupKtx, ProxyKtx, SecretChatKtx, SupergroupKtx, UserKtx, CommonKtx