Skip to content

Commit 908fd1a

Browse files
authored
chore: apply channelx.Puller[T] to simplify long running tasks (#143)
1 parent df6da4a commit 908fd1a

File tree

18 files changed

+109
-565
lines changed

18 files changed

+109
-565
lines changed

go.mod

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ require (
66
entgo.io/ent v0.12.3
77
github.com/PuerkitoBio/goquery v1.8.1
88
github.com/alexliesenfeld/health v0.7.0
9-
github.com/davecgh/go-spew v1.1.1
109
github.com/disgoorg/disgo v0.16.4
1110
github.com/disgoorg/snowflake/v2 v2.0.1
1211
github.com/gin-gonic/gin v1.9.1
@@ -20,15 +19,16 @@ require (
2019
github.com/maxbrunsfeld/counterfeiter/v6 v6.6.1
2120
github.com/nekomeowww/fo v1.1.1
2221
github.com/nekomeowww/go-pinecone v0.1.0
23-
github.com/nekomeowww/timecapsule/v2 v2.1.1
22+
github.com/nekomeowww/timecapsule/v2 v2.1.3
23+
github.com/nekomeowww/xo v1.1.1
2424
github.com/pkoukk/tiktoken-go v0.1.1
25-
github.com/redis/rueidis v1.0.5
25+
github.com/redis/rueidis v1.0.8
2626
github.com/samber/lo v1.38.1
2727
github.com/sashabaranov/go-openai v1.11.1
28-
github.com/sirupsen/logrus v1.9.2
28+
github.com/sirupsen/logrus v1.9.3
2929
github.com/slack-go/slack v0.12.2
3030
github.com/sourcegraph/conc v0.3.0
31-
github.com/stretchr/testify v1.8.3
31+
github.com/stretchr/testify v1.8.4
3232
go.uber.org/fx v1.19.3
3333
go.uber.org/multierr v1.11.0
3434
go.uber.org/ratelimit v0.2.0
@@ -44,6 +44,7 @@ require (
4444
github.com/bytedance/sonic v1.9.1 // indirect
4545
github.com/cespare/xxhash/v2 v2.2.0 // indirect
4646
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
47+
github.com/davecgh/go-spew v1.1.1 // indirect
4748
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
4849
github.com/disgoorg/json v1.0.0 // indirect
4950
github.com/disgoorg/log v1.2.0 // indirect
@@ -81,9 +82,10 @@ require (
8182
github.com/quic-go/qtls-go1-19 v0.3.2 // indirect
8283
github.com/quic-go/qtls-go1-20 v0.2.2 // indirect
8384
github.com/quic-go/quic-go v0.32.0 // indirect
84-
github.com/redis/go-redis/v9 v9.0.4 // indirect
85+
github.com/redis/go-redis/v9 v9.0.5 // indirect
8586
github.com/samber/mo v1.8.0 // indirect
8687
github.com/sasha-s/go-csync v0.0.0-20210812194225-61421b77c44b // indirect
88+
github.com/shopspring/decimal v1.3.1 // indirect
8789
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
8890
github.com/ugorji/go/codec v1.2.11 // indirect
8991
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
@@ -92,12 +94,12 @@ require (
9294
go.uber.org/dig v1.17.0 // indirect
9395
go.uber.org/goleak v1.2.1 // indirect
9496
golang.org/x/arch v0.3.0 // indirect
95-
golang.org/x/crypto v0.9.0 // indirect
97+
golang.org/x/crypto v0.10.0 // indirect
9698
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
9799
golang.org/x/mod v0.10.0 // indirect
98-
golang.org/x/net v0.10.0 // indirect
99-
golang.org/x/sys v0.8.0 // indirect
100-
golang.org/x/text v0.9.0 // indirect
100+
golang.org/x/net v0.11.0 // indirect
101+
golang.org/x/sys v0.9.0 // indirect
102+
golang.org/x/text v0.10.0 // indirect
101103
golang.org/x/tools v0.9.1 // indirect
102104
google.golang.org/protobuf v1.30.0 // indirect
103105
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxB
1515
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
1616
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
1717
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
18-
github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=
1918
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
2019
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
2120
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
@@ -112,7 +111,6 @@ github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8t
112111
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
113112
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
114113
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4=
115-
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
116114
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
117115
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
118116
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
@@ -135,8 +133,10 @@ github.com/nekomeowww/fo v1.1.1 h1:948AqPsiF2SAUmOlMQhyXzgq89HAtuAZx2g0pUkxjCA=
135133
github.com/nekomeowww/fo v1.1.1/go.mod h1:KKW/q6aFa1k/IFL+nS9dDxsgZPfn4v4ADH7g8pb4nik=
136134
github.com/nekomeowww/go-pinecone v0.1.0 h1:byYmyHQJ4velNUeECvNuCN6KbXGuyVjSFlvO9VV2zj8=
137135
github.com/nekomeowww/go-pinecone v0.1.0/go.mod h1:p8I6F7G7fSrfaa9k3HpsWNxf2y+W1wqn8tw0jsV9e1s=
138-
github.com/nekomeowww/timecapsule/v2 v2.1.1 h1:1UeBgLhiWstn1pv7w9Bo+43AbhzYYrpyoVhtETtw0uI=
139-
github.com/nekomeowww/timecapsule/v2 v2.1.1/go.mod h1:4vevpnLBU2hsjHU7qKPRvD3NUQGjdAYb4y8dbL47Baw=
136+
github.com/nekomeowww/timecapsule/v2 v2.1.3 h1:KIg6jZSg4RkQG9qV2k5TMq9LUzM6cO3MiXvTyLnqZ9U=
137+
github.com/nekomeowww/timecapsule/v2 v2.1.3/go.mod h1:/DD0z43GI6mG6WmRxKwRPJNaYsy696wabZyyjKcL2/4=
138+
github.com/nekomeowww/xo v1.1.1 h1:IHcpIA2qEGe1Qx4rb2ZrX7xBfSKMbnuaLPA/5RXJs8M=
139+
github.com/nekomeowww/xo v1.1.1/go.mod h1:TgJ7VZ9UEBr3H6btyfyLIuZz+JEdd+3WWAJijPNYoHs=
140140
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
141141
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
142142
github.com/onsi/ginkgo/v2 v2.9.4 h1:xR7vG4IXt5RWx6FfIjyAtsoMAtnc3C/rFXBBd2AjZwE=
@@ -160,25 +160,25 @@ github.com/quic-go/qtls-go1-20 v0.2.2 h1:WLOPx6OY/hxtTxKV1Zrq20FtXtDEkeY00CGQm8G
160160
github.com/quic-go/qtls-go1-20 v0.2.2/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM=
161161
github.com/quic-go/quic-go v0.32.0 h1:lY02md31s1JgPiiyfqJijpu/UX/Iun304FI3yUqX7tA=
162162
github.com/quic-go/quic-go v0.32.0/go.mod h1:/fCsKANhQIeD5l76c2JFU+07gVE3KaA0FP+0zMWwfwo=
163-
github.com/redis/go-redis/v9 v9.0.4 h1:FC82T+CHJ/Q/PdyLW++GeCO+Ol59Y4T7R4jbgjvktgc=
164-
github.com/redis/go-redis/v9 v9.0.4/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk=
165-
github.com/redis/rueidis v1.0.5 h1:VQ8m2AfkNskm5nK9lswTvTpL6/clF+UY1KgIcAZcBx4=
166-
github.com/redis/rueidis v1.0.5/go.mod h1:yxbpgX+VYNxCvdE0KEQXDeUFcF2hB2Oz/TJiaqFxoEU=
163+
github.com/redis/go-redis/v9 v9.0.5 h1:CuQcn5HIEeK7BgElubPP8CGtE0KakrnbBSTLjathl5o=
164+
github.com/redis/go-redis/v9 v9.0.5/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk=
165+
github.com/redis/rueidis v1.0.8 h1:ZTQw0kIfvXlQexS4xCBXSiZUnloNlVhAMc3Kbfotsjo=
166+
github.com/redis/rueidis v1.0.8/go.mod h1:+1zDH4a8XhwIbCSlIhVGIu6Xib0ZMDoBM0qGhHXc1ew=
167167
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
168168
github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM=
169169
github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
170170
github.com/samber/mo v1.8.0 h1:vYjHTfg14JF9tD2NLhpoUsRi9bjyRoYwa4+do0nvbVw=
171171
github.com/samber/mo v1.8.0/go.mod h1:BfkrCPuYzVG3ZljnZB783WIJIGk1mcZr9c9CPf8tAxs=
172172
github.com/sasha-s/go-csync v0.0.0-20210812194225-61421b77c44b h1:qYTY2tN72LhgDj2rtWG+LI6TXFl2ygFQQ4YezfVaGQE=
173173
github.com/sasha-s/go-csync v0.0.0-20210812194225-61421b77c44b/go.mod h1:/pA7k3zsXKdjjAiUhB5CjuKib9KJGCaLvZwtxGC8U0s=
174-
github.com/sashabaranov/go-openai v1.9.4 h1:KanoCEoowAI45jVXlenMCckutSRr39qOmSi9MyPBfZM=
175-
github.com/sashabaranov/go-openai v1.9.4/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
176174
github.com/sashabaranov/go-openai v1.11.1 h1:QAyLx/MhiVrV4nsGTAZI+JPP/n0nlYZfxltzv9jTClw=
177175
github.com/sashabaranov/go-openai v1.11.1/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
178176
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
179177
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
180-
github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y=
181-
github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
178+
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
179+
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
180+
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
181+
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
182182
github.com/slack-go/slack v0.12.2 h1:x3OppyMyGIbbiyFhsBmpf9pwkUzMhthJMRNmNlA4LaQ=
183183
github.com/slack-go/slack v0.12.2/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw=
184184
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
@@ -199,8 +199,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
199199
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
200200
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
201201
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
202-
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
203202
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
203+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
204+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
204205
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
205206
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
206207
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
@@ -211,7 +212,6 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
211212
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
212213
github.com/zclconf/go-cty v1.13.1 h1:0a6bRwuiSHtAmqCqNOE+c2oHgepv0ctoxU4FUe43kwc=
213214
github.com/zclconf/go-cty v1.13.1/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0=
214-
github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8=
215215
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
216216
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
217217
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
@@ -233,8 +233,8 @@ golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
233233
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
234234
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
235235
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
236-
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
237-
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
236+
golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM=
237+
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
238238
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
239239
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
240240
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@@ -253,8 +253,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
253253
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
254254
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
255255
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
256-
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
257-
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
256+
golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU=
257+
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
258258
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
259259
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
260260
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -274,8 +274,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
274274
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
275275
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
276276
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
277-
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
278-
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
277+
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
278+
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
279279
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
280280
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
281281
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@@ -285,8 +285,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
285285
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
286286
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
287287
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
288-
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
289288
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
289+
golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
290+
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
290291
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
291292
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
292293
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=

internal/bots/telegram/handlers/recap/recap_command.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/nekomeowww/insights-bot/pkg/types/bot/handlers/recap"
1111
"github.com/nekomeowww/insights-bot/pkg/types/telegram"
1212
"github.com/nekomeowww/insights-bot/pkg/types/tgchat"
13-
"github.com/nekomeowww/insights-bot/pkg/utils"
13+
"github.com/nekomeowww/xo"
1414
"github.com/samber/lo"
1515
"go.uber.org/zap"
1616
)
@@ -151,7 +151,7 @@ func (h *CommandHandler) handleRecapCommandForPrivateSubscriptionsMode(c *tgbot.
151151
return h.handleUserNeverStartedChatOrBlockedErr(c, chatID, chatTitle, newRecapCommandWhenUserBlockedMessage(c.Bot, hashKey))
152152
} else {
153153
h.logger.Error("failed to send private message to user",
154-
zap.String("message", utils.SprintJSON(msg)),
154+
zap.String("message", xo.SprintJSON(msg)),
155155
zap.Int64("chat_id", c.Update.Message.From.ID),
156156
zap.Error(err),
157157
)

internal/bots/telegram/handlers/recap/subscribe_recap.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
88
"github.com/nekomeowww/insights-bot/pkg/bots/tgbot"
99
"github.com/nekomeowww/insights-bot/pkg/types/telegram"
10-
"github.com/nekomeowww/insights-bot/pkg/utils"
10+
"github.com/nekomeowww/xo"
1111
"github.com/samber/lo"
1212
"go.uber.org/zap"
1313
)
@@ -83,7 +83,7 @@ func (h *CommandHandler) handleSubscribeRecapCommand(c *tgbot.Context) (tgbot.Re
8383
return h.handleUserNeverStartedChatOrBlockedErr(c, chatID, chatTitle, newSubscribeRecapCommandWhenUserBlockedMessage(c.Bot, hashKey))
8484
} else {
8585
h.logger.Error("failed to send private message to user",
86-
zap.String("message", utils.SprintJSON(msg)),
86+
zap.String("message", xo.SprintJSON(msg)),
8787
zap.Int64("chat_id", c.Update.Message.From.ID),
8888
zap.Error(err),
8989
)
@@ -165,7 +165,7 @@ func (h *CommandHandler) handleUnsubscribeRecapCommand(c *tgbot.Context) (tgbot.
165165
c.Bot.MayRequest(tgbotapi.NewDeleteMessage(chatID, c.Update.Message.MessageID))
166166
} else {
167167
h.logger.Error("failed to send private message to user",
168-
zap.String("message", utils.SprintJSON(msg)),
168+
zap.String("message", xo.SprintJSON(msg)),
169169
zap.Int64("chat_id", c.Update.Message.From.ID),
170170
zap.Error(err),
171171
)

internal/models/chathistories/chat_histories_test.go

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"github.com/nekomeowww/insights-bot/internal/lib"
2020
"github.com/nekomeowww/insights-bot/internal/thirdparty/openai/openaimock"
2121
"github.com/nekomeowww/insights-bot/pkg/tutils"
22-
"github.com/nekomeowww/insights-bot/pkg/utils"
22+
"github.com/nekomeowww/xo"
2323
)
2424

2525
var model *Model
@@ -102,17 +102,17 @@ func TestSaveOneTelegramChatHistory(t *testing.T) {
102102
require := require.New(t)
103103

104104
message := &tgbotapi.Message{
105-
MessageID: int(utils.RandomInt64()),
105+
MessageID: int(xo.RandomInt64()),
106106
From: &tgbotapi.User{
107-
ID: utils.RandomInt64(),
108-
FirstName: utils.RandomHashString(5),
109-
UserName: utils.RandomHashString(10),
107+
ID: xo.RandomInt64(),
108+
FirstName: xo.RandomHashString(5),
109+
UserName: xo.RandomHashString(10),
110110
},
111111
Chat: &tgbotapi.Chat{
112-
ID: utils.RandomInt64(),
112+
ID: xo.RandomInt64(),
113113
},
114114
Date: int(time.Now().Unix()),
115-
Text: utils.RandomHashString(10),
115+
Text: xo.RandomHashString(10),
116116
}
117117
err := model.SaveOneTelegramChatHistory(message)
118118
require.NoError(err)
@@ -141,22 +141,22 @@ func TestUpdateOneTelegramChatHistory(t *testing.T) {
141141
require := require.New(t)
142142

143143
message := &tgbotapi.Message{
144-
MessageID: int(utils.RandomInt64()),
144+
MessageID: int(xo.RandomInt64()),
145145
From: &tgbotapi.User{
146-
ID: utils.RandomInt64(),
147-
FirstName: utils.RandomHashString(5),
148-
UserName: utils.RandomHashString(10),
146+
ID: xo.RandomInt64(),
147+
FirstName: xo.RandomHashString(5),
148+
UserName: xo.RandomHashString(10),
149149
},
150150
Chat: &tgbotapi.Chat{
151-
ID: utils.RandomInt64(),
151+
ID: xo.RandomInt64(),
152152
},
153153
Date: int(time.Now().Unix()),
154-
Text: utils.RandomHashString(10),
154+
Text: xo.RandomHashString(10),
155155
}
156156
err := model.SaveOneTelegramChatHistory(message)
157157
require.NoError(err)
158158

159-
message.Text = utils.RandomHashString(10)
159+
message.Text = xo.RandomHashString(10)
160160
err = model.UpdateOneTelegramChatHistory(message)
161161
require.NoError(err)
162162

@@ -178,42 +178,42 @@ func TestFindLastOneHourChatHistories(t *testing.T) {
178178
assert := assert.New(t)
179179
require := require.New(t)
180180

181-
chatID := utils.RandomInt64()
181+
chatID := xo.RandomInt64()
182182

183183
message1 := &tgbotapi.Message{
184184
MessageID: 1,
185185
From: &tgbotapi.User{
186-
ID: utils.RandomInt64(),
187-
FirstName: utils.RandomHashString(5),
188-
UserName: utils.RandomHashString(10),
186+
ID: xo.RandomInt64(),
187+
FirstName: xo.RandomHashString(5),
188+
UserName: xo.RandomHashString(10),
189189
},
190190
Chat: &tgbotapi.Chat{ID: chatID},
191191
Date: int(time.Now().Unix()),
192-
Text: utils.RandomHashString(10),
192+
Text: xo.RandomHashString(10),
193193
}
194194

195195
message2 := &tgbotapi.Message{
196196
MessageID: 2,
197197
From: &tgbotapi.User{
198-
ID: utils.RandomInt64(),
199-
FirstName: utils.RandomHashString(5),
200-
UserName: utils.RandomHashString(10),
198+
ID: xo.RandomInt64(),
199+
FirstName: xo.RandomHashString(5),
200+
UserName: xo.RandomHashString(10),
201201
},
202202
Chat: &tgbotapi.Chat{ID: chatID},
203203
Date: int(time.Now().Unix()),
204-
Text: utils.RandomHashString(10),
204+
Text: xo.RandomHashString(10),
205205
}
206206

207207
message3 := &tgbotapi.Message{
208208
MessageID: 3,
209209
From: &tgbotapi.User{
210-
ID: utils.RandomInt64(),
211-
FirstName: utils.RandomHashString(5),
212-
UserName: utils.RandomHashString(10),
210+
ID: xo.RandomInt64(),
211+
FirstName: xo.RandomHashString(5),
212+
UserName: xo.RandomHashString(10),
213213
},
214214
Chat: &tgbotapi.Chat{ID: chatID},
215215
Date: int(time.Now().Unix()),
216-
Text: utils.RandomHashString(10),
216+
Text: xo.RandomHashString(10),
217217
}
218218

219219
err := model.SaveOneTelegramChatHistory(message1)

0 commit comments

Comments
 (0)