All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.dev.inmo.tgbotapi.libraries.cache.admins.AdminsCacheAPI.kt Maven / Gradle / Ivy

There is a newer version: 0.26.1
Show newest version
package dev.inmo.tgbotapi.libraries.cache.admins

import dev.inmo.tgbotapi.extensions.utils.asGroupContentMessage
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember
import dev.inmo.tgbotapi.types.message.abstracts.GroupContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message

interface AdminsCacheAPI {
    suspend fun getChatAdmins(chatId: IdChatIdentifier): List?
    suspend fun isAdmin(chatId: IdChatIdentifier, userId: UserId): Boolean = getChatAdmins(chatId) ?.any {
        it.user.id == userId
    } == true
    suspend fun sentByAdmin(groupContentMessage: GroupContentMessage<*>): Boolean
    suspend fun sentByAdmin(message: Message): Boolean? {
        return sentByAdmin(message.asGroupContentMessage() ?: return null)
    }

    suspend fun settings(): AdminsCacheSettingsAPI
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy