Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExceptionInLinkedThread: Missing field in record construction sendMessageMessageEffectId #188

Closed
thelissimus opened this issue Jun 27, 2024 · 1 comment · Fixed by #189 · May be fixed by fizruk/lambdaconf-2018-workshop#4

Comments

@thelissimus
Copy link

The code:

{-# LANGUAGE OverloadedStrings #-}

module Assistant (module Assistant) where

import Data.Kind (Type)
import Data.Text (Text)

import Telegram.Bot.API (Token (..), Update, defaultTelegramClientEnv)
import Telegram.Bot.Simple (BotApp (..), startBot_, (<#))
import Telegram.Bot.Simple qualified as TBS
import Telegram.Bot.Simple.Debug (traceBotDefault)
import Telegram.Bot.Simple.UpdateParser (updateMessageText)

type Model :: Type
type Model = ()

type Action :: Type
data Action
  = ActionHoogleSearch Text
  deriving stock (Show)

assistantBot :: BotApp Model Action
assistantBot =
  BotApp
    { botInitialModel = ()
    , botAction = updateToAction
    , botHandler = handleAction
    , botJobs = []
    }

updateToAction :: Update -> Model -> Maybe Action
updateToAction update _ = ActionHoogleSearch <$> updateMessageText update

handleAction :: Action -> Model -> TBS.Eff Action Model
handleAction action model = case action of
  ActionHoogleSearch str ->
    model <# do
      -- todo
      pure str

run :: IO ()
run = do
  env <- defaultTelegramClientEnv (Token "<hidden>")
  startBot_ (traceBotDefault assistantBot) env

Is failing with the following error:

ExceptionInLinkedThread (ThreadId 11) src/Telegram/Bot/Simple/Reply.hs:(61,64)-(74,3): Missing field in record construction sendMessageMessageEffectId

Tried scraping all of my code off and copy-pasting examples from the repository and the lambdaconf-2018-workshop. No use. Probably some new feature introduced the bug.

@gltronred
Copy link

It seems that telegram-bot-api has updated. My code failed with the same error message with 7.4 version, but worked with 7.3.1.

So, a workaround is to add to cabal.project (or equivalent) the following line:

constraints: telegram-bot-api==7.3.1

s-and-witch added a commit to s-and-witch/telegram-bot-simple that referenced this issue Jun 27, 2024
s-and-witch added a commit to s-and-witch/telegram-bot-simple that referenced this issue Jun 27, 2024
s-and-witch added a commit to s-and-witch/telegram-bot-simple that referenced this issue Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants