From d802845c0a0578fed125e1d3c2da8893e89db82f Mon Sep 17 00:00:00 2001 From: Keroosha Date: Sat, 11 Feb 2023 07:27:02 +0300 Subject: [PATCH] Has text check --- PublishHelperBot/Handlers.fs | 2 ++ 1 file changed, 2 insertions(+) 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