Skip to content

Instantly share code, notes, and snippets.

@Szer
Created December 14, 2018 08:59
Show Gist options
  • Select an option

  • Save Szer/7f148f21fdc1ba0df1a6adccbec71d2a to your computer and use it in GitHub Desktop.

Select an option

Save Szer/7f148f21fdc1ba0df1a6adccbec71d2a to your computer and use it in GitHub Desktop.
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