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

Telegram start/socials command text/buttons changes. #61

Merged
merged 7 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,14 @@ notifications: &notifications
wintr/multimedia/picture:
urlDownload: https://ice-staging.b-cdn.net
socials:
- notificationType: follow_us_on_x
link: https://x.com/sunwaves_token
- notificationType: join_our_telegram
link: 'https://t.me/sunwavestoken'
- notificationType: follow_ion_on_x
link: https://x.com/ice_blockchain
- notificationType: follow_us_on_x
link: https://x.com/sunwaves_token
- notificationType: join_ion_on_telegram
link: 'https://t.me/iceblockchain'
- notificationType: follow_zeus_on_x
link: https://x.com/ice_z3us
- notificationType: follow_ion_on_x
link: https://x.com/ice_blockchain
weeklyStats:
weekday: 1
hour: 10
Expand Down
13 changes: 8 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/google/uuid v1.6.0
github.com/hashicorp/go-multierror v1.1.1
github.com/ice-blockchain/eskimo v1.371.0
github.com/ice-blockchain/freezer v1.489.0
github.com/ice-blockchain/freezer v1.493.0
github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb
github.com/ice-blockchain/wintr v1.146.0
github.com/imroc/req/v3 v3.43.7
Expand Down Expand Up @@ -36,12 +36,12 @@ require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/MicahParks/keyfunc v1.9.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.12.4 // indirect
github.com/Microsoft/hcsshim v0.12.5 // indirect
github.com/alitto/pond v1.9.1 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/bsm/redislock v0.9.4 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/bytedance/sonic v1.11.9 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
Expand Down Expand Up @@ -122,7 +122,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/moby/sys/mount v0.3.3 // indirect
github.com/moby/sys/mountinfo v0.7.1 // indirect
github.com/moby/sys/mountinfo v0.7.2 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
Expand Down Expand Up @@ -179,7 +179,7 @@ require (
go.uber.org/zap v1.27.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20240707233637-46b078467d37 // indirect
golang.org/x/exp v0.0.0-20240716175740-e3f259677ff7 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.7.0 // indirect
Expand All @@ -202,7 +202,10 @@ require (

replace (
github.com/containerd/containerd => github.com/containerd/containerd v1.6.19
github.com/crate-crypto/go-ipa => github.com/crate-crypto/go-ipa v0.0.0-20231205143816-408dbffb2041
github.com/crate-crypto/go-kzg-4844 => github.com/crate-crypto/go-kzg-4844 v0.7.0
github.com/distribution/reference => github.com/distribution/reference v0.5.0
github.com/docker/docker => github.com/docker/docker v20.10.3+incompatible
github.com/ethereum/go-ethereum => github.com/ethereum/go-ethereum v1.13.15
github.com/testcontainers/testcontainers-go => github.com/testcontainers/testcontainers-go v0.15.0
)
40 changes: 20 additions & 20 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ github.com/MicahParks/keyfunc v1.9.0 h1:lhKd5xrFHLNOWrDc4Tyb/Q1AJ4LCzQ48GVJyVIID
github.com/MicahParks/keyfunc v1.9.0/go.mod h1:IdnCilugA0O/99dW+/MkvlyrsX8+L8+x95xuVNtM5jw=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/Microsoft/hcsshim v0.12.4 h1:Ev7YUMHAHoWNm+aDSPzc5W9s6E2jyL1szpVDJeZ/Rr4=
github.com/Microsoft/hcsshim v0.12.4/go.mod h1:Iyl1WVpZzr+UkzjekHZbV8o5Z9ZkxNGx6CtY2Qg/JVQ=
github.com/Microsoft/hcsshim v0.12.5 h1:bpTInLlDy/nDRWFVcefDZZ1+U8tS+rz3MxjKgu9boo0=
github.com/Microsoft/hcsshim v0.12.5/go.mod h1:tIUGego4G1EN5Hb6KC90aDYiUI2dqLSTTOCjVNpOgZ8=
github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI=
github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI=
github.com/alitto/pond v1.9.1 h1:OfCpIrMyrWJpn34f647DcFmUxjK8+7Nu3eoVN/WTP+o=
Expand All @@ -52,8 +52,8 @@ github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
github.com/bsm/redislock v0.9.4 h1:X/Wse1DPpiQgHbVYRE9zv6m070UcKoOGekgvpNhiSvw=
github.com/bsm/redislock v0.9.4/go.mod h1:Epf7AJLiSFwLCiZcfi6pWFO/8eAYrYpQXFxEDPoDeAk=
github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0=
github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ=
github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/bytedance/sonic v1.11.9 h1:LFHENlIY/SLzDWverzdOvgMztTxcfcF+cqNsz9pK5zg=
Expand Down Expand Up @@ -102,10 +102,10 @@ github.com/containerd/errdefs v0.1.0/go.mod h1:YgWiiHtLmSeBrvpw+UfPijzbLaB77mEG1
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c h1:uQYC5Z1mdLRPrZhHjHxufI8+2UG/i25QG92j0Er9p6I=
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs=
github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI=
github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc=
github.com/crate-crypto/go-ipa v0.0.0-20231205143816-408dbffb2041 h1:44imsFSR7HcR8VTSDNDAnm8QecxYbSmeOGAqPflRsyI=
github.com/crate-crypto/go-ipa v0.0.0-20231205143816-408dbffb2041/go.mod h1:geZJZH3SzKCqnz5VT0q/DyIG/tvu/dZk+VIfXicupJs=
github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBShovmncxvA=
github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc=
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -138,10 +138,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum/c-kzg-4844 v1.0.2 h1:8tV84BCEiPeOkiVgW9mpYBeBUir2bkCNVqxPwwVeO+s=
github.com/ethereum/c-kzg-4844 v1.0.2/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/go-ethereum v1.14.7 h1:EHpv3dE8evQmpVEQ/Ne2ahB06n2mQptdwqaMNhAT29g=
github.com/ethereum/go-ethereum v1.14.7/go.mod h1:Mq0biU2jbdmKSZoqOj29017ygFrMnB5/Rifwp980W4o=
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4=
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0/go.mod h1:D9AJLVXSyZQXJQVk8oh1EwjISE+sJTn2duYIZC0dy3w=
github.com/ethereum/go-ethereum v1.13.15 h1:U7sSGYGo4SPjP6iNIifNoyIAiNjrmQkz6EwQG+/EZWo=
github.com/ethereum/go-ethereum v1.13.15/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
Expand All @@ -156,6 +154,8 @@ github.com/gabriel-vasile/mimetype v1.4.4 h1:QjV6pZ7/XZ7ryI2KuyeEDE8wnh7fHP9YnQy
github.com/gabriel-vasile/mimetype v1.4.4/go.mod h1:JwLei5XPtWdGiMFB5Pjle1oEeoSeEuJfJE+TtfvdB/s=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
github.com/gballet/go-verkle v0.1.1-0.20231130133252-5a8a683fa581 h1:nKbTGOGvrSo4ei3AlYN+Cbnp23AzgOl7nezMsZEIyDI=
github.com/gballet/go-verkle v0.1.1-0.20231130133252-5a8a683fa581/go.mod h1:OzHSBt37xRRHc27lb9PaCldBnJYQZP8KcMdYyOB2dtU=
github.com/georgysavva/scany/v2 v2.1.3 h1:Zd4zm/ej79Den7tBSU2kaTDPAH64suq4qlQdhiBeGds=
github.com/georgysavva/scany/v2 v2.1.3/go.mod h1:fqp9yHZzM/PFVa3/rYEC57VmDx+KDch0LoqrJzkvtos=
github.com/getsentry/sentry-go v0.28.1 h1:zzaSm/vHmGllRM6Tpx1492r0YDzauArdBfkJRtY6P5k=
Expand Down Expand Up @@ -284,8 +284,8 @@ github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc=
github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8=
github.com/ice-blockchain/eskimo v1.371.0 h1:o9acbUNUZ80U7CLyzrQyd2T67O/92+a8jiut3BtTpV0=
github.com/ice-blockchain/eskimo v1.371.0/go.mod h1:7m6dFwOIi3aSAdPBJa2nJKjaEr1QDXXDVs4D3w+m7c4=
github.com/ice-blockchain/freezer v1.489.0 h1:JvSeQb4ipxJXmTQsyZj3K46WDGgnSQIgcSzisrYlW/s=
github.com/ice-blockchain/freezer v1.489.0/go.mod h1:DR5VMXlnDGYVnzmocSMTViMbYhHny4ee0iNVrYv1QKM=
github.com/ice-blockchain/freezer v1.493.0 h1:KKHyzdsvEQvSKTjQFLTpR1dSwKnkg6qcvRTVMRtMIVg=
github.com/ice-blockchain/freezer v1.493.0/go.mod h1:I+ZedQ6/aoRM9ZCrcbs2aZv7MSoaND6Bkp1ENOtVcmk=
github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb h1:8TnFP3mc7O+tc44kv2e0/TpZKnEVUaKH+UstwfBwRkk=
github.com/ice-blockchain/go-tarantool-client v0.0.0-20230327200757-4fc71fa3f7bb/go.mod h1:ZsQU7i3mxhgBBu43Oev7WPFbIjP4TniN/b1UPNGbrq8=
github.com/ice-blockchain/wintr v1.146.0 h1:bYkbImnMYNYVcDftwBmAV0NbcHJIcP+J7a86HeJnTA8=
Expand Down Expand Up @@ -352,8 +352,8 @@ github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFV
github.com/moby/sys/mount v0.3.3 h1:fX1SVkXFJ47XWDoeFW4Sq7PdQJnV2QIDZAqjNqgEjUs=
github.com/moby/sys/mount v0.3.3/go.mod h1:PBaEorSNTLG5t/+4EgukEQVlAvVEc6ZjTySwKdqp5K0=
github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI=
github.com/moby/sys/mountinfo v0.7.1 h1:/tTvQaSJRr2FshkhXiIpux6fQ2Zvc4j7tAhMTStAG2g=
github.com/moby/sys/mountinfo v0.7.1/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI=
github.com/moby/sys/mountinfo v0.7.2 h1:1shs6aH5s4o5H2zQLn796ADW1wMrIwHsyJ2v9KouLrg=
github.com/moby/sys/mountinfo v0.7.2/go.mod h1:1YOa8w8Ih7uW0wALDUgT1dTTSBrZ+HiBLGws92L2RU4=
github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand Down Expand Up @@ -540,8 +540,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240707233637-46b078467d37 h1:uLDX+AfeFCct3a2C7uIWBKMJIR3CJMhcgfrUAqjRK6w=
golang.org/x/exp v0.0.0-20240707233637-46b078467d37/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/exp v0.0.0-20240716175740-e3f259677ff7 h1:wDLEX9a7YQoKdKNQt88rtydkqDxeGaBUTnIYc3iG/mA=
golang.org/x/exp v0.0.0-20240716175740-e3f259677ff7/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
Expand Down Expand Up @@ -660,8 +660,8 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
3 changes: 2 additions & 1 deletion notifications/notification_type_socials.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package notifications
import (
"context"
"fmt"
"strings"
stdlibtime "time"

"github.com/pkg/errors"
Expand Down Expand Up @@ -54,7 +55,7 @@ func (r *repository) addScheduledSocialsNotifications(ctx context.Context, us *u
NotificationChannel: string(TelegramNotificationChannel),
NotificationChannelValue: us.ID,
Data: &users.JSON{
"TenantName": r.cfg.TenantName,
"TenantName": strings.ToUpper(r.cfg.TenantName),
},
})

Expand Down
2 changes: 1 addition & 1 deletion notifications/scheduler_telegram_notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (s *Scheduler) runTelegramNotificationsProcessor(ctx context.Context, worke
}
switch notification.NotificationType {
case string(SocialsNotificationType):
tn.tn.Buttons = append(tn.tn.Buttons, prepareTelegramButtonsForSocialNotificationType(s.cfg, tmpl.ButtonText)...)
tn.tn.Buttons = append(tn.tn.Buttons, prepareTelegramButtonsForSocialNotificationType(s.cfg, tmpl)...)
case string(ReplyNotificationType):
replyMessageID, pErr := strconv.ParseInt(notification.NotificationChannelValue, 10, 64)
if pErr != nil {
Expand Down
39 changes: 26 additions & 13 deletions notifications/telegram_notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/pkg/errors"

"github.com/ice-blockchain/eskimo/users"
"github.com/ice-blockchain/freezer/tokenomics"
storage "github.com/ice-blockchain/wintr/connectors/storage/v2"
"github.com/ice-blockchain/wintr/log"
"github.com/ice-blockchain/wintr/notifications/telegram"
Expand All @@ -35,7 +36,7 @@ type (
}
)

func (t *telegramNotificationTemplate) getButtonText(data any, ix int) string { //nolint:unparam // .
func (t *telegramNotificationTemplate) getButtonText(data any, ix int) string {
if ix > len(t.buttonText)-1 {
return ""
}
Expand Down Expand Up @@ -111,7 +112,7 @@ func loadTelegramNotificationTranslationTemplates() { //nolint:funlen,revive,goc
tmpl.inviteText = template.Must(template.New(fmt.Sprintf("telegram_%v_%v_invite_text", notificationType, language)).Parse(data.InviteText))
}
if tmpl.AltBody != "" {
tmpl.altBody = template.Must(template.New(fmt.Sprintf("push_%v_%v_alt_body", notificationType, language)).Parse(data.AltBody))
tmpl.altBody = template.Must(template.New(fmt.Sprintf("telegram_%v_%v_alt_body", notificationType, language)).Parse(data.AltBody))
}
tmpl.ButtonText = data.ButtonText
for ix := range data.ButtonText {
Expand Down Expand Up @@ -145,20 +146,25 @@ func getTelegramDeeplink(nt NotificationType, cfg *config, username, inviteText
return ""
}

func prepareTelegramButtonsForSocialNotificationType(cfg *config, buttonTexts []string) []telegram.Button {
func prepareTelegramButtonsForSocialNotificationType(cfg *config, tmpl *telegramNotificationTemplate) []telegram.Button {
urls := getSocialsMapURL(cfg)
if len(urls) != len(buttonTexts) {
if len(urls) != len(tmpl.ButtonText)-1 {
log.Error(errors.New("socials cfg/translation misconfiguration"))

return nil
}
res := make([]telegram.Button, 0, len(buttonTexts))
for ix, text := range buttonTexts {
data := struct{ TenantName string }{TenantName: strings.ToUpper(cfg.TenantName)}
res := make([]telegram.Button, 0, len(tmpl.ButtonText))
for ix := range len(tmpl.buttonText) - 1 {
res = append(res, telegram.Button{
Text: text,
Text: tmpl.getButtonText(data, ix),
URL: urls[ix],
})
}
res = append(res, telegram.Button{
Text: tmpl.getButtonText(data, len(tmpl.buttonText)-1),
URL: cfg.WebAppLink,
})

return res
}
Expand Down Expand Up @@ -287,9 +293,10 @@ func (r *repository) handleTelegramUpdates(
tn: &telegram.Notification{
ChatID: userInfoMap[id].TelegramUserID,
Text: tmpl.getBody(users.JSON{
"TenantName": r.cfg.TenantName,
"TokenName": r.cfg.TokenName,
"Username": username,
"TenantName": strings.ToUpper(r.cfg.TenantName),
"TokenName": strings.ToUpper(r.cfg.TokenName),
"Username": username,
"WelcomeBonus": tokenomics.WelcomeBonusV2Amount,
ice-ares marked this conversation as resolved.
Show resolved Hide resolved
}),
BotToken: botToken,
},
Expand All @@ -309,7 +316,7 @@ func (r *repository) handleTelegramUpdates(
case StartCommandNotificationType:
notification.tn.Buttons = append(notification.tn.Buttons, prepareTelegramButtonsForStartCommandNotificationType(r.cfg, tmpl.ButtonText)...)
case SocialsNotificationType:
notification.tn.Buttons = append(notification.tn.Buttons, prepareTelegramButtonsForSocialNotificationType(r.cfg, tmpl.ButtonText)...)
notification.tn.Buttons = append(notification.tn.Buttons, prepareTelegramButtonsForSocialNotificationType(r.cfg, tmpl)...)
default:
continue
}
Expand Down Expand Up @@ -366,15 +373,21 @@ func extractDataFromCallbackQuery(upd *telegram.Update) (skip bool, id, username
}

func prepareTelegramButtonsForStartCommandNotificationType(cfg *config, buttonTexts []string) []telegram.Button {
if len(cfg.Socials) == 0 {
return nil
}
res := make([]telegram.Button, 0, len(buttonTexts))
res = append(res, telegram.Button{
Text: buttonTexts[0],
URL: cfg.WebAppLink,
}, telegram.Button{
Text: buttonTexts[1],
CallbackData: string(SocialsTelegramCommand),
Text: buttonTexts[1],
URL: cfg.Socials[0].Link,
}, telegram.Button{
Text: buttonTexts[2],
URL: cfg.Socials[1].Link,
}, telegram.Button{
Text: buttonTexts[3],
URL: fmt.Sprintf("%v/%v", cfg.WebSiteURL, "knowledge-base"),
})

Expand Down
12 changes: 6 additions & 6 deletions notifications/translations/telegram/socials.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"en": {
"body": "🚀 Join our socials to stay updated on all the latest news and important updates!",
"body": "🌟 Join our social media channels to stay updated with the latest news and important announcements.",
"buttonText": [
"Follow us on X",
"Join us on Telegram",
"Follow Ice Open Network on X",
"Join Ice Open Network on Telegram",
"Follow Zeus on X"
"{{.TenantName}} TG Community",
"{{.TenantName}} on X",
"ION TG Community",
"ION on X",
"🌟 Launch App!"
]
}
}
Loading
Loading