Has text check
This commit is contained in:
parent
ae829d07d3
commit
d802845c0a
@ -19,6 +19,7 @@ let UpdateIsAMessage (x: Update) = x.Type = UpdateType.Message
|
|||||||
let FromAdminChat (x: Message, c: BotConfig) = x.Chat.Id = c.adminChatId
|
let FromAdminChat (x: Message, c: BotConfig) = x.Chat.Id = c.adminChatId
|
||||||
let HasReply (x: Message) = not(isNull x.ReplyToMessage)
|
let HasReply (x: Message) = not(isNull x.ReplyToMessage)
|
||||||
let ExtractPhotoFromMessage (x: Message) = Array.map (fun (p: PhotoSize) -> p.FileId) x.Photo
|
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[] =
|
let UrlsAsAlbumInputMedia (urls: string[]): IAlbumInputMedia[] =
|
||||||
Array.map (fun (x: string) -> InputMediaPhoto(x)) urls
|
Array.map (fun (x: string) -> InputMediaPhoto(x)) urls
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ let YoutubeRepostMatchCmd = "\\ytdl"
|
|||||||
let public YoutubeRepostMatch: HandlerRequirements = fun (u, c) ->
|
let public YoutubeRepostMatch: HandlerRequirements = fun (u, c) ->
|
||||||
UpdateIsAMessage u &&
|
UpdateIsAMessage u &&
|
||||||
FromAdminChat <| (u.Message, c) &&
|
FromAdminChat <| (u.Message, c) &&
|
||||||
|
HasText <| u.Message &&
|
||||||
u.Message.Text.StartsWith YoutubeRepostMatchCmd &&
|
u.Message.Text.StartsWith YoutubeRepostMatchCmd &&
|
||||||
u.Message.Text.Split(' ').Length = 2
|
u.Message.Text.Split(' ').Length = 2
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user