com.github.stormbit.vksdk.objects.Chat.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vk-bot-sdk-kotlin Show documentation
Show all versions of vk-bot-sdk-kotlin Show documentation
The Kotlin library for working with VK api
The newest version!
package com.github.stormbit.vksdk.objects
import com.github.stormbit.vksdk.clients.Client
import com.github.stormbit.vksdk.objects.models.Chat
import com.github.stormbit.vksdk.vkapi.VkApiRequest
import com.github.stormbit.vksdk.vkapi.methods.messages.ChatChangePhotoResponse
@Suppress("unused")
class Chat(private val client: Client, private var chatId: Int) {
companion object {
const val CHAT_PREFIX = 2000000000
}
init {
chatId = if (chatId > CHAT_PREFIX) chatId - CHAT_PREFIX else chatId
}
fun addUser(userId: Int): VkApiRequest = client.messages.addChatUser(chatId, userId)
fun kickUser(userId: Int): VkApiRequest = client.messages.removeChatUser(chatId, userId)
fun deletePhoto(): VkApiRequest = client.messages.deleteChatPhoto(chatId)
fun editTitle(newTitle: String): VkApiRequest = client.messages.editChat(chatId, newTitle)
suspend fun getUsers(): List = client.messages.getChatUsers(chatId)
fun getChatInfo(): VkApiRequest> = client.messages.getChat(listOf(chatId))
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy