@@ -14,9 +14,9 @@ import Data.Either (Either(..))
14
14
import Data.Enum as DE
15
15
import Data.Maybe (Maybe (..))
16
16
import Data.Maybe as DM
17
-
18
17
import Data.Tuple.Nested ((/\))
19
18
import Debug (spy )
19
+ import Effect.Aff (Aff )
20
20
import Effect.Class (liftEffect )
21
21
import Effect.Random as ER
22
22
import Flame as F
@@ -32,18 +32,10 @@ nextSuggestion model =
32
32
{ freeToFetchSuggestions = true
33
33
, suggesting = Just next
34
34
, chatting = Nothing
35
+ , bugging = Nothing
35
36
} /\ [ bugUser ]
36
37
where
37
38
next = DM .maybe 0 (_ + 1 ) model.suggesting
38
- bugUser = do
39
- chance ← liftEffect $ ER .randomInt 0 100
40
- {- if chance <= 2 then
41
- pure <<< Just $ SetBugging Experimenting
42
- else -}
43
- if chance <= 10 then
44
- pure <<< Just $ SetBugging Backing
45
- else
46
- pure Nothing
47
39
48
40
previousSuggestion ∷ ImModel → MoreMessages
49
41
previousSuggestion model@{ suggesting } =
@@ -53,17 +45,30 @@ previousSuggestion model@{ suggesting } =
53
45
if previous < 0 then
54
46
fetchMoreSuggestions model
55
47
else
56
- F .noMessages $ model
48
+ model
57
49
{ freeToFetchSuggestions = true
58
50
, suggesting = Just previous
59
51
, chatting = Nothing
60
- }
52
+ , bugging = Nothing
53
+ } /\ [ bugUser ]
54
+
55
+ bugUser :: Aff (Maybe ImMessage )
56
+ bugUser = do
57
+ chance ← liftEffect $ ER .randomInt 0 100
58
+ {- if chance <= 2 then
59
+ pure <<< Just $ SetBugging Experimenting
60
+ else -}
61
+ if chance <= 10 then
62
+ pure <<< Just $ SetBugging Backing
63
+ else
64
+ pure Nothing
61
65
62
66
fetchMoreSuggestions ∷ ImModel → NextMessage
63
67
fetchMoreSuggestions model =
64
68
model
65
69
{ freeToFetchSuggestions = false
66
70
, failedRequests = []
71
+ , bugging = Nothing
67
72
} /\
68
73
[ CCN .retryableResponse NextSuggestion DisplayMoreSuggestions $ request.im.suggestions
69
74
{ query:
@@ -150,8 +155,8 @@ setBugging ∷ MeroChatCall → ImModel → NoMessages
150
155
setBugging mc model = F .noMessages $ model
151
156
{ bugging = Just mc
152
157
-- offset index to account for non profile suggestion
153
- , suggesting = case model.suggesting of
154
- Just s | s > 0 -> Just $ s - 1
155
- Just s -> Just s
156
- Nothing -> Nothing
158
+ , suggesting = case model.suggesting of
159
+ Just s | s > 0 → Just $ s - 1
160
+ Just s → Just s
161
+ Nothing → Nothing
157
162
}
0 commit comments