module PublishHelperBot.Types open System open System.Text.Json.Serialization open Telegram.Bot open Telegram.Bot.Types type ConfigChatId = int64 type CreateYoutubeDlJob = { [] Url: string [] SavePath: string } type CreateYoutubeDlJobSuccess = { [] Task: Guid } type YoutubeDlInfoDict = { [] Title: string option [] Height: int option [] Width: int option } type YoutubeDlStateInfo = { [] InfoDict: YoutubeDlInfoDict option } type YoutubeDlStateResponse = { [] State: string [] VideoInfo: YoutubeDlStateInfo option } type YoutubeDlError = { [] Message: string } type CreateJobResult = Result type CheckJobResult = Result type CleanJobResult = Result type IYoutubeDlClient = abstract member CreateJob: CreateYoutubeDlJob -> Async abstract member CheckJob: externalId: Guid -> Async abstract member CleanJob: externalId: Guid -> Async type IYoutubeDlService = abstract member AddJob: url: string -> Async type TgServiceConfig = { Client: ITelegramBotClient ChannelId: ConfigChatId AdminChatId: ConfigChatId YoutubeDlClient: IYoutubeDlClient } type RelayCaptionMode = | WithAuthor | Anonymous | Unknown type RelayType = | Text | Photo of media: string * caption: string | Video of video: string * caption: string type RelayArgs = { ReplyChatId: int64 ReplyMessageId: int Relay: RelayType } [] type BotUpdateType = | RelayUpdate of RelayArgs | YoutubeRepost of url: string | Ping | Skip type ITgUpdateHandler = abstract member PostUpdate: Update -> unit type PostVideoArgs = { Url: string SavePath: string ExternalId: Guid Title: string option Width: int option Height: int option } type ITgService = abstract member PostRelay: args: RelayArgs -> unit abstract member PostMessageToAdminChat: text: string -> unit abstract member Ping: unit -> unit abstract member PostVideo: PostVideoArgs -> unit