Skip to content

Commit

Permalink
Add Markdown check to testbot
Browse files Browse the repository at this point in the history
  • Loading branch information
Dolfik1 committed Feb 6, 2024
1 parent 5919f2e commit 388a107
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
20 changes: 17 additions & 3 deletions src/examples/Funogram.TestBot/Commands/Base.fs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ let defaultText = """⭐️Available test commands:
/cmdscan stringA stringB - Test cmdScan, concatenate stringA and stringB"""

let updateArrived (ctx: UpdateContext) =
let fromId () = ctx.Update.Message.Value.From.Value.Id

let wrap fn = fn ctx.Config (fromId ())
let wrap fn =
let fromId () = ctx.Update.Message.Value.From.Value.Id
fn ctx.Config (fromId ())

let result =
processCommands ctx [|
Expand Down Expand Up @@ -55,4 +56,17 @@ let updateArrived (ctx: UpdateContext) =
|]

if result then
Api.sendMessage (fromId()) defaultText |> bot ctx.Config
match ctx.Update.CallbackQuery with
| Some ({ Data = Some "callback2" } as c) ->
match c.Message with
| Some (MaybeInaccessibleMessage.Message msg) ->
let inlineKeyboardMarkup = InlineKeyboardMarkup.Create([| [| InlineKeyboardButton.Create("Changed!", callbackData = "Test") |] |])
Req.EditMessageReplyMarkup.Make(msg.Chat.Id, msg.MessageId, replyMarkup = inlineKeyboardMarkup)
|> bot ctx.Config
| _ -> ()
| _ -> ()

match ctx.Update.Message with
| Some { From = Some { Id = id } } ->
Api.sendMessage id defaultText |> bot ctx.Config
| _ -> ()
3 changes: 2 additions & 1 deletion src/examples/Funogram.TestBot/Commands/Markup.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ let testRemoveKeyboard config chatId =
let testInlineKeyboard config chatId =
let keyboard =
[|
[| InlineKeyboardButton.Create("Test", callbackData = "1234") |]
[| InlineKeyboardButton.Create("Test", callbackData = "callback1") |]
[| InlineKeyboardButton.Create("Replace", callbackData = "callback2") |]
|]
let markup = Markup.InlineKeyboardMarkup { InlineKeyboard = keyboard }
sendMessageMarkup "That's inline keyboard!" markup config chatId

0 comments on commit 388a107

Please sign in to comment.