File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -171,11 +171,14 @@ updateCustomCommand builtinCommands =
171171 (Nothing , Nothing ) ->
172172 replyToSender sender [qms |Command '{name}' does not exist|]
173173
174+ evalExpr :: M. Map T. Text T. Text -> Expr -> T. Text
175+ evalExpr _ (TextExpr t) = t
176+ evalExpr vars (FunCallExpr " or" args) =
177+ fromMaybe " " $ listToMaybe $ dropWhile T. null $ map (evalExpr vars) args
178+ evalExpr vars (FunCallExpr funame _) = fromMaybe " " $ M. lookup funame vars
179+
174180expandVars :: M. Map T. Text T. Text -> [Expr ] -> T. Text
175- expandVars _ [] = " "
176- expandVars vars (TextExpr t: rest) = t <> expandVars vars rest
177- expandVars vars (FunCallExpr funame _: rest) =
178- (fromMaybe " " $ M. lookup funame vars) <> expandVars vars rest
181+ expandVars vars = T. concat . map (evalExpr vars)
179182
180183-- TODO(#598): reimplement expandCustomCommandVars with Bot.Expr when it's ready
181184expandCustomCommandVars ::
You can’t perform that action at this time.
0 commit comments