2020-11-08 13:23:01 +00:00
|
|
|
package dev.inmo.plagubot
|
|
|
|
|
2020-11-11 17:05:21 +00:00
|
|
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
|
|
|
import dev.inmo.tgbotapi.types.BotCommand
|
|
|
|
import dev.inmo.tgbotapi.updateshandlers.FlowsUpdatesFilter
|
|
|
|
import kotlinx.coroutines.CoroutineScope
|
|
|
|
import org.jetbrains.exposed.sql.Database
|
|
|
|
|
2020-11-12 06:16:43 +00:00
|
|
|
/**
|
|
|
|
* Use this interface for your bot. It is possible to use [kotlinx.serialization.SerialName] annotations on your plugins
|
|
|
|
* to set up short name for your plugin. Besides, simple name of your class will be used as key for deserialization
|
|
|
|
* too.
|
|
|
|
*/
|
2020-11-11 17:05:21 +00:00
|
|
|
interface Plugin {
|
2020-11-12 06:16:43 +00:00
|
|
|
/**
|
|
|
|
* In case you want to publish some processed by your plugin commands, you can provide it via this method
|
|
|
|
*
|
|
|
|
* @see BotCommand
|
|
|
|
*/
|
2020-11-11 17:05:21 +00:00
|
|
|
suspend fun getCommands(): List<BotCommand> = emptyList()
|
2020-11-12 06:16:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This method (usually) will be invoked just one time in the whole application.
|
|
|
|
*/
|
2020-11-11 17:05:21 +00:00
|
|
|
suspend operator fun invoke(
|
|
|
|
bot: TelegramBot,
|
|
|
|
database: Database,
|
|
|
|
updatesFilter: FlowsUpdatesFilter,
|
|
|
|
scope: CoroutineScope
|
|
|
|
)
|
|
|
|
}
|