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

com.github.insanusmokrassar.AutoPostTelegramBot.plugins.forwarders.Forwarder.kt Maven / Gradle / Ivy

package com.github.insanusmokrassar.AutoPostTelegramBot.plugins.forwarders

import com.github.insanusmokrassar.AutoPostTelegramBot.base.models.PostMessage
import com.pengrad.telegrambot.TelegramBot
import java.io.IOException

const val HIGH_PRIORITY = Int.MAX_VALUE
const val MIDDLE_PRIORITY = 0
const val LOW_PRIORITY = Int.MIN_VALUE

fun List.correctSort(): List = sortedDescending()

interface Forwarder : Comparable {
    val importance: Int
    fun canForward(message: PostMessage): Boolean

    @Throws(IOException::class)
    fun forward(
        bot: TelegramBot,
        targetChatId: Long,
        vararg messages: PostMessage
    ): List

    override fun compareTo(other: Forwarder): Int {
        return importance.compareTo(other.importance)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy