diff --git a/PublishHelperBot/Handlers.fs b/PublishHelperBot/Handlers.fs index a5c020d..3baedac 100644 --- a/PublishHelperBot/Handlers.fs +++ b/PublishHelperBot/Handlers.fs @@ -19,6 +19,7 @@ let UpdateIsAMessage (x: Update) = x.Type = UpdateType.Message let FromAdminChat (x: Message, c: BotConfig) = x.Chat.Id = c.adminChatId let HasReply (x: Message) = not(isNull x.ReplyToMessage) let ExtractPhotoFromMessage (x: Message) = Array.map (fun (p: PhotoSize) -> p.FileId) x.Photo +let HasText (x: Message) = not(isNull x.Text) let UrlsAsAlbumInputMedia (urls: string[]): IAlbumInputMedia[] = Array.map (fun (x: string) -> InputMediaPhoto(x)) urls @@ -76,6 +77,7 @@ let YoutubeRepostMatchCmd = "\\ytdl" let public YoutubeRepostMatch: HandlerRequirements = fun (u, c) -> UpdateIsAMessage u && FromAdminChat <| (u.Message, c) && + HasText <| u.Message && u.Message.Text.StartsWith YoutubeRepostMatchCmd && u.Message.Text.Split(' ').Length = 2