Created
December 14, 2018 08:59
-
-
Save Szer/7f148f21fdc1ba0df1a6adccbec71d2a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open FSharpPlus | |
| let inline (^) f x = f x | |
| let processUpdate context = | |
| context.Update.Message | |
| |> Option.iter ^fun message -> | |
| message.Entities | |
| |> Option.filter ^Seq.exists ^fun x -> x.Type = "url" | |
| |> Option.iter ^fun _ -> | |
| let username = | |
| monad { | |
| let! user = message.From | |
| let! nick = user.Username | |
| return sprintf "%s@%s" user.FirstName nick | |
| } |> Option.defaultValue "GLOBAL" | |
| printfn "Chat [%i] > User [%s] > Deleting the message %i " | |
| message.Chat.Id username message.MessageId | |
| deleteMessage message.Chat.Id message.MessageId | |
| |> api context.Config | |
| |> Async.Ignore | |
| |> Async.Start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment