From bdfd2af828eebde50cfc122b77b3f5d303ea5577 Mon Sep 17 00:00:00 2001 From: boogiedk Date: Sun, 15 Oct 2023 16:43:56 +0300 Subject: [PATCH] fix --- SerfBot/TelegramBot.fs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SerfBot/TelegramBot.fs b/SerfBot/TelegramBot.fs index 9b6ee39..843dddd 100644 --- a/SerfBot/TelegramBot.fs +++ b/SerfBot/TelegramBot.fs @@ -9,7 +9,10 @@ open SerfBot.Log open SerfBot.Types open SerfBot.TelegramApi -let extractCommand (str: string) = (str.Split(" ")[0]).Trim().ToLower(); +let extractCommand (str: string) = + let command = (str.Split(" ")[0]).Trim().ToLower() + let userMessage = (str.Split(" ")[1]).Trim().ToLower() + (command, userMessage) let isValidUser (userId: int64) = if Array.contains userId Configuration.config.UserIds then Some () @@ -27,8 +30,7 @@ let updateArrived (ctx: UpdateContext) = match isValidUser user.Id with | Some () -> logInfo $"Message from user {Option.get user.Username} received: {Option.get text}" - let userMessage = text.Value; - let command = extractCommand userMessage + let command, userMessage = extractCommand text.Value match Commands.commandHandlers.TryGetValue command with | true, handler -> let replyText = handler userMessage