From 910b6a2d64e79f950d2448f4e5157d3133a4b58b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 4 Aug 2024 00:03:23 +0800 Subject: [PATCH 01/58] Add files via upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新插件牛牛大作战 --- plugin/go.mod | 101 +++++++++++ plugin/go.sum | 303 +++++++++++++++++++++++++++++++++ plugin/main.go | 324 +++++++++++++++++++++++++++++++++++ plugin/niuniu/main.go | 362 ++++++++++++++++++++++++++++++++++++++++ plugin/niuniu/model.go | 80 +++++++++ plugin/niuniu/result.go | 113 +++++++++++++ 6 files changed, 1283 insertions(+) create mode 100644 plugin/go.mod create mode 100644 plugin/go.sum create mode 100644 plugin/main.go create mode 100644 plugin/niuniu/main.go create mode 100644 plugin/niuniu/model.go create mode 100644 plugin/niuniu/result.go diff --git a/plugin/go.mod b/plugin/go.mod new file mode 100644 index 0000000000..8036d343d0 --- /dev/null +++ b/plugin/go.mod @@ -0,0 +1,101 @@ +module github.com/FloatTech/ZeroBot-Plugin + +go 1.20 + +require ( + github.com/Baidu-AIP/golang-sdk v1.1.1 + github.com/FloatTech/AnimeAPI v1.7.1-0.20240530072450-71c23d2f01f8 + github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14 + github.com/FloatTech/gg v1.1.3-0.20230226151425-6ea91286ba08 + github.com/FloatTech/imgfactory v0.2.2-0.20230413152719-e101cc3606ef + github.com/FloatTech/rendercard v0.0.10-0.20230223064326-45d29fa4ede9 + github.com/FloatTech/sqlite v1.6.3 + github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 + github.com/FloatTech/zbpctrl v1.6.1 + github.com/FloatTech/zbputils v1.7.2-0.20240530064059-af6f6773ba94 + github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7 + github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5 + github.com/antchfx/htmlquery v1.3.1 + github.com/corona10/goimagehash v1.1.0 + github.com/davidscholberg/go-durationfmt v0.0.0-20170122144659-64843a2083d3 + github.com/disintegration/imaging v1.6.2 + github.com/fumiama/ahsai v0.1.0 + github.com/fumiama/cron v1.3.0 + github.com/fumiama/go-base16384 v1.7.0 + github.com/fumiama/go-registry v0.2.7 + github.com/fumiama/gotracemoe v0.0.3 + github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565 + github.com/fumiama/terasu v0.0.0-20240507144117-547a591149c0 + github.com/fumiama/unibase2n v0.0.0-20240530074540-ec743fd5a6d6 + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 + github.com/jinzhu/gorm v1.9.16 + github.com/jozsefsallai/gophersauce v1.0.1 + github.com/kanrichan/resvg-go v0.0.2-0.20231001163256-63db194ca9f5 + github.com/lithammer/fuzzysearch v1.1.8 + github.com/liuzl/gocc v0.0.0-20231231122217-0372e1059ca5 + github.com/mroth/weightedrand v1.0.0 + github.com/notnil/chess v1.9.0 + github.com/pkg/errors v0.9.1 + github.com/shirou/gopsutil/v3 v3.24.4 + github.com/shopspring/decimal v1.4.0 + github.com/sirupsen/logrus v1.9.3 + github.com/tidwall/gjson v1.17.1 + github.com/wcharczuk/go-chart/v2 v2.1.1 + github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240627150749-3ff3d73940da + gitlab.com/gomidi/midi/v2 v2.1.7 + golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8 + golang.org/x/image v0.16.0 + golang.org/x/sys v0.20.0 + golang.org/x/text v0.15.0 + gopkg.in/yaml.v3 v3.0.1 +) + +require ( + github.com/adamzy/cedar-go v0.0.0-20170805034717-80a9c64b256d // indirect + github.com/ajstarks/svgo v0.0.0-20200320125537-f189e35d30ca // indirect + github.com/antchfx/xpath v1.3.0 // indirect + github.com/blend/go-sdk v1.20220411.3 // indirect + github.com/dustin/go-humanize v1.0.1 // indirect + github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 // indirect + github.com/faiface/beep v1.1.0 // indirect + github.com/fumiama/go-simple-protobuf v0.2.0 // indirect + github.com/fumiama/gofastTEA v0.0.10 // indirect + github.com/fumiama/imgsz v0.0.4 // indirect + github.com/gabriel-vasile/mimetype v1.0.4 // indirect + github.com/go-ole/go-ole v1.2.6 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/hajimehoshi/oto v0.7.1 // indirect + github.com/jfreymuth/oggvorbis v1.0.1 // indirect + github.com/jfreymuth/vorbis v1.0.0 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/liuzl/cedar-go v0.0.0-20170805034717-80a9c64b256d // indirect + github.com/liuzl/da v0.0.0-20180704015230-14771aad5b1d // indirect + github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/ncruces/go-strftime v0.1.9 // indirect + github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect + github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect + github.com/pkumza/numcn v1.0.0 // indirect + github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect + github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/shoenig/go-m1cpu v0.1.6 // indirect + github.com/tetratelabs/wazero v1.5.0 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect + github.com/tklauser/numcpus v0.6.1 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect + golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6 // indirect + golang.org/x/net v0.24.0 // indirect + modernc.org/libc v1.49.3 // indirect + modernc.org/mathutil v1.6.0 // indirect + modernc.org/memory v1.8.0 // indirect + modernc.org/sqlite v1.20.0 // indirect +) + +replace modernc.org/sqlite => github.com/fumiama/sqlite3 v1.29.10-simp + +replace modernc.org/libc => github.com/fumiama/libc v0.0.0-20240530081950-6f6d8586b5c5 diff --git a/plugin/go.sum b/plugin/go.sum new file mode 100644 index 0000000000..09d78f405b --- /dev/null +++ b/plugin/go.sum @@ -0,0 +1,303 @@ +github.com/Baidu-AIP/golang-sdk v1.1.1 h1:RQsAmgDSAkiq22I6n7XJ2t3afgzFeqjY46FGhvrx4cw= +github.com/Baidu-AIP/golang-sdk v1.1.1/go.mod h1:bXnGw7xPeKt8aF7UCELKrV6UZ/46spItONK1RQBQj1Y= +github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/FloatTech/AnimeAPI v1.7.1-0.20240530072450-71c23d2f01f8 h1:2i36tl5VlBWxWxv4WyfWmCA23NaV1fB5/smJtdORHf4= +github.com/FloatTech/AnimeAPI v1.7.1-0.20240530072450-71c23d2f01f8/go.mod h1:Ru6q5pZUnfMg1iu0M1Hp73q9N3LNIbDr16kjkzyG6Xk= +github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14 h1:8O0Iq9MnKsKowltY9txhOqcJdmGTjxHPQ4gEYzbJc9A= +github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14/go.mod h1:OzGLhvmtz1TKIdGaJDd8pQumvD36UqK+dWsiCISmzQQ= +github.com/FloatTech/gg v1.1.3-0.20230226151425-6ea91286ba08 h1:dPLeoiTVSBlgls+66EB/UJ2e38BaASmBN5nANaycSBU= +github.com/FloatTech/gg v1.1.3-0.20230226151425-6ea91286ba08/go.mod h1:uzPzAeT35egARdRuu+1oyjU3CmTwCceoq3Vvje7LpcI= +github.com/FloatTech/imgfactory v0.2.2-0.20230413152719-e101cc3606ef h1:CJbK/2FRwPuZpeb6M4sWK2d7oXDnBEGhpkQuQrgc91A= +github.com/FloatTech/imgfactory v0.2.2-0.20230413152719-e101cc3606ef/go.mod h1:el5hGpj1C1bDRxcTXYRwEivDCr40zZeJpcrLrB1fajs= +github.com/FloatTech/rendercard v0.0.10-0.20230223064326-45d29fa4ede9 h1:hffajvmQFfP68U6wUwHemPuuwCUoss+SEFfoLYwbGwE= +github.com/FloatTech/rendercard v0.0.10-0.20230223064326-45d29fa4ede9/go.mod h1:NBFPhWae4hqVMeG8ELBBnUQkKce3nDjkljVn6PdiUNs= +github.com/FloatTech/sqlite v1.6.3 h1:MQkqBNlkPuCoKQQgoNLuTL/2Ci3tBTFAnVYBdD0Wy4M= +github.com/FloatTech/sqlite v1.6.3/go.mod h1:zFbHzRfB+CJ+VidfjuVbrcin3DAz283F7hF1hIeHzpY= +github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 h1:g4pTnDJUW4VbJ9NvoRfUvdjDrHz/6QhfN/LoIIpICbo= +github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs= +github.com/FloatTech/zbpctrl v1.6.1 h1:SilK5R2poO8iUT6JPzpgr/BSzxYAaybBYNZkMyZ8STw= +github.com/FloatTech/zbpctrl v1.6.1/go.mod h1:I+MetM++1sJhNPg3zww1aw04BicYsNohvHC4Jh52XSo= +github.com/FloatTech/zbputils v1.7.2-0.20240530064059-af6f6773ba94 h1:ITQPmNSHE5bNFBpdwldUpfTDLXROEahSKspkJrSLWvQ= +github.com/FloatTech/zbputils v1.7.2-0.20240530064059-af6f6773ba94/go.mod h1:nHWYtF4g2NRv3GXZiAZDvgPjdcHGUaQHxGgD0aHz30I= +github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= +github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7 h1:S/ferNiehVjNaBMNNBxUjLtVmP/YWD6Yh79RfPv4ehU= +github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7/go.mod h1:vD7Ra3Q9onRtojoY5sMCLQ7JBgjUsrXDnDKyFxqpf9w= +github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5 h1:bBmmB7he0iVN4m5mcehfheeRUEer/Avo4ujnxI3uCqs= +github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5/go.mod h1:0UcFaCkhp6vZw6l5Dpq0Dp673CoF9GdvA8lTfst0GiU= +github.com/adamzy/cedar-go v0.0.0-20170805034717-80a9c64b256d h1:ir/IFJU5xbja5UaBEQLjcvn7aAU01nqU/NUyOBEU+ew= +github.com/adamzy/cedar-go v0.0.0-20170805034717-80a9c64b256d/go.mod h1:PRWNwWq0yifz6XDPZu48aSld8BWwBfr2JKB2bGWiEd4= +github.com/ajstarks/svgo v0.0.0-20200320125537-f189e35d30ca h1:kWzLcty5V2rzOqJM7Tp/MfSX0RMSI1x4IOLApEefYxA= +github.com/ajstarks/svgo v0.0.0-20200320125537-f189e35d30ca/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= +github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= +github.com/antchfx/htmlquery v1.3.1 h1:wm0LxjLMsZhRHfQKKZscDf2COyH4vDYA3wyH+qZ+Ylc= +github.com/antchfx/htmlquery v1.3.1/go.mod h1:PTj+f1V2zksPlwNt7uVvZPsxpKNa7mlVliCRxLX6Nx8= +github.com/antchfx/xpath v1.3.0 h1:nTMlzGAK3IJ0bPpME2urTuFL76o4A96iYvoKFHRXJgc= +github.com/antchfx/xpath v1.3.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= +github.com/blend/go-sdk v1.20220411.3 h1:GFV4/FQX5UzXLPwWV03gP811pj7B8J2sbuq+GJQofXc= +github.com/blend/go-sdk v1.20220411.3/go.mod h1:7lnH8fTi6U4i1fArEXRyOIY2E1X4MALg09qsQqY1+ak= +github.com/corona10/goimagehash v1.1.0 h1:teNMX/1e+Wn/AYSbLHX8mj+mF9r60R1kBeqE9MkoYwI= +github.com/corona10/goimagehash v1.1.0/go.mod h1:VkvE0mLn84L4aF8vCb6mafVajEb6QYMHl2ZJLn0mOGI= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/d4l3k/messagediff v1.2.2-0.20190829033028-7e0a312ae40b/go.mod h1:Oozbb1TVXFac9FtSIxHBMnBCq2qeH/2KkEQxENCrlLo= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davidscholberg/go-durationfmt v0.0.0-20170122144659-64843a2083d3 h1:qshMBFxVjYjzI+kwvWvgoByF3uMCvnJiaK8KslWAbr8= +github.com/davidscholberg/go-durationfmt v0.0.0-20170122144659-64843a2083d3/go.mod h1:M9fx6rAdHSYLKxXPgUXGgblb586CA7ceNrpu4DEc2No= +github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd h1:83Wprp6ROGeiHFAP8WJdI2RoxALQYgdllERc3N5N2DM= +github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= +github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= +github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 h1:BBade+JlV/f7JstZ4pitd4tHhpN+w+6I+LyOS7B4fyU= +github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4/go.mod h1:H7chHJglrhPPzetLdzBleF8d22WYOv7UM/lEKYiwlKM= +github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y= +github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= +github.com/faiface/beep v1.1.0 h1:A2gWP6xf5Rh7RG/p9/VAW2jRSDEGQm5sbOb38sf5d4c= +github.com/faiface/beep v1.1.0/go.mod h1:6I8p6kK2q4opL/eWb+kAkk38ehnTunWeToJB+s51sT4= +github.com/fumiama/ahsai v0.1.0 h1:LXD61Kaj6kJHa3AEGsLIfKNzcgaVxg7JB72OR4yNNZ4= +github.com/fumiama/ahsai v0.1.0/go.mod h1:fFeNnqgo44i8FIaguK659aQryuZeFy+4klYLQu/rfdk= +github.com/fumiama/cron v1.3.0 h1:ZWlwuexF+HQHl3cYytEE5HNwD99q+3vNZF1GrEiXCFo= +github.com/fumiama/cron v1.3.0/go.mod h1:bz5Izvgi/xEUI8tlBN8BI2jr9Moo8N4or0KV8xXuPDY= +github.com/fumiama/go-base16384 v1.7.0 h1:6fep7XPQWxRlh4Hu+KsdH+6+YdUp+w6CwRXtMWSsXCA= +github.com/fumiama/go-base16384 v1.7.0/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM= +github.com/fumiama/go-registry v0.2.7 h1:tLEqgEpsiybQMqBv0dLHm5leia/z1DhajMupwnOHeNs= +github.com/fumiama/go-registry v0.2.7/go.mod h1:m+wp5fF8dYgVoFkBPZl+vlK90loymaJE0JCtocVQLEs= +github.com/fumiama/go-simple-protobuf v0.2.0 h1:ACyN1MAlu7pDR3EszWgzUeNP+IRsSHwH6V9JCJA5R5o= +github.com/fumiama/go-simple-protobuf v0.2.0/go.mod h1:5yYNapXq1tQMOZg9bOIVhQlZk9pQqpuFIO4DZLbsdy4= +github.com/fumiama/gofastTEA v0.0.10 h1:JJJ+brWD4kie+mmK2TkspDXKzqq0IjXm89aGYfoGhhQ= +github.com/fumiama/gofastTEA v0.0.10/go.mod h1:RIdbYZyB4MbH6ZBlPymRaXn3cD6SedlCu5W/HHfMPBk= +github.com/fumiama/gotracemoe v0.0.3 h1:iI5EbE9A3UUbfukG6+/soYPjp1S31eCNYf4tw7s6/Jc= +github.com/fumiama/gotracemoe v0.0.3/go.mod h1:tyqahdUzHf0bQIAVY/GYmDWvYYe5ik1ZbhnGYh+zl40= +github.com/fumiama/imgsz v0.0.4 h1:Lsasu2hdSSFS+vnD+nvR1UkiRMK7hcpyYCC0FzgSMFI= +github.com/fumiama/imgsz v0.0.4/go.mod h1:bISOQVTlw9sRytPwe8ir7tAaEmyz9hSNj9n8mXMBG0E= +github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565 h1:sQuR2+N5HurnvsZhiKdEg+Ig354TaqgCQRxd/0KgIOQ= +github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565/go.mod h1:UUEvyLTJ7yoOA/viKG4wEis4ERydM7+Ny6gZUWgkS80= +github.com/fumiama/libc v0.0.0-20240530081950-6f6d8586b5c5 h1:jDxsIupsT84A6WHcs6kWbst+KqrRQ8/o0VyoFMnbBOA= +github.com/fumiama/libc v0.0.0-20240530081950-6f6d8586b5c5/go.mod h1:15P6ublJ9FJR8YQCGy8DeQ2Uwur7iW9Hserr/T3OFZE= +github.com/fumiama/sqlite3 v1.29.10-simp h1:c5y3uKyU0q9t0/SyfynzYyuslQ5zP+5CD8e0yYY554A= +github.com/fumiama/sqlite3 v1.29.10-simp/go.mod h1:ItX2a1OVGgNsFh6Dv60JQvGfJfTPHPVpV6DF59akYOA= +github.com/fumiama/terasu v0.0.0-20240507144117-547a591149c0 h1:So/3Bg/m2ZcUvqCzzEjjkjHBjcvnV3AN5tCxwsdMwYU= +github.com/fumiama/terasu v0.0.0-20240507144117-547a591149c0/go.mod h1:UVx8YP1jKKL1Cj+uy+OnQRM2Ih6U36Mqy9GSf7jabsI= +github.com/fumiama/unibase2n v0.0.0-20240530074540-ec743fd5a6d6 h1:LtDgr628eji8jRpjPCxsk7ibjcfi97QieZVCTjxLCBw= +github.com/fumiama/unibase2n v0.0.0-20240530074540-ec743fd5a6d6/go.mod h1:lEaZsT4FRSqcjnQ5q8y+mkenkzR/r1D3BJmfdp0vqDg= +github.com/gabriel-vasile/mimetype v1.0.4 h1:uBejfH8l3/2f+5vjl1e4xIaSyNEhRBZ5N/ij7ohpNd8= +github.com/gabriel-vasile/mimetype v1.0.4/go.mod h1:6CDPel/o/3/s4+bp6kIbsWATq8pmgOisOPG40CJa6To= +github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= +github.com/gdamore/tcell v1.3.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM= +github.com/go-audio/audio v1.0.0/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs= +github.com/go-audio/riff v1.0.0/go.mod h1:l3cQwc85y79NQFCRB7TiPoNiaijp6q8Z0Uv38rVG498= +github.com/go-audio/wav v1.0.0/go.mod h1:3yoReyQOsiARkvPl3ERCi8JFjihzG6WhjYpZCf5zAWE= +github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY= +github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hajimehoshi/go-mp3 v0.3.0/go.mod h1:qMJj/CSDxx6CGHiZeCgbiq2DSUkbK0UbtXShQcnfyMM= +github.com/hajimehoshi/oto v0.6.1/go.mod h1:0QXGEkbuJRohbJaxr7ZQSxnju7hEhseiPx2hrh6raOI= +github.com/hajimehoshi/oto v0.7.1 h1:I7maFPz5MBCwiutOrz++DLdbr4rTzBsbBuV2VpgU9kk= +github.com/hajimehoshi/oto v0.7.1/go.mod h1:wovJ8WWMfFKvP587mhHgot/MBr4DnNy9m6EepeVGnos= +github.com/icza/bitio v1.0.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A= +github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBDIWGCdTt54nHt6EeI639SmHycLYL7FkA= +github.com/jfreymuth/oggvorbis v1.0.1 h1:NT0eXBgE2WHzu6RT/6zcb2H10Kxj6Fm3PccT0LE6bqw= +github.com/jfreymuth/oggvorbis v1.0.1/go.mod h1:NqS+K+UXKje0FUYUPosyQ+XTVvjmVjps1aEZH1sumIk= +github.com/jfreymuth/vorbis v1.0.0 h1:SmDf783s82lIjGZi8EGUUaS7YxPHgRj4ZXW/h7rUi7U= +github.com/jfreymuth/vorbis v1.0.0/go.mod h1:8zy3lUAm9K/rJJk223RKy6vjCZTWC61NA2QD06bfOE0= +github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o= +github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M= +github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jozsefsallai/gophersauce v1.0.1 h1:BA3ovtQRrAb1qYU9JoRLbDHpxnDunlNcEkEfhCvDDCM= +github.com/jozsefsallai/gophersauce v1.0.1/go.mod h1:YVEI7djliMTmZ1Vh01YPF8bUHi+oKhe3yXgKf1T49vg= +github.com/kanrichan/resvg-go v0.0.2-0.20231001163256-63db194ca9f5 h1:BXnB1Gz4y/zwQh+ZFNy7rgd+ZfMOrwRr4uZSHEI+ieY= +github.com/kanrichan/resvg-go v0.0.2-0.20231001163256-63db194ca9f5/go.mod h1:c9+VS9GaommgIOzNWb5ze4lYwfT8BZ2UDyGiuQTT7yc= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4= +github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8LFgLN4= +github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ5ajtkr5xPLts4= +github.com/liuzl/cedar-go v0.0.0-20170805034717-80a9c64b256d h1:qSmEGTgjkESUX5kPMSGJ4pcBUtYVDdkNzMrjQyvRvp0= +github.com/liuzl/cedar-go v0.0.0-20170805034717-80a9c64b256d/go.mod h1:x7SghIWwLVcJObXbjK7S2ENsT1cAcdJcPl7dRaSFog0= +github.com/liuzl/da v0.0.0-20180704015230-14771aad5b1d h1:hTRDIpJ1FjS9ULJuEzu69n3qTgc18eI+ztw/pJv47hs= +github.com/liuzl/da v0.0.0-20180704015230-14771aad5b1d/go.mod h1:7xD3p0XnHvJFQ3t/stEJd877CSIMkH/fACVWen5pYnc= +github.com/liuzl/gocc v0.0.0-20231231122217-0372e1059ca5 h1:wnbHIeP1UX8ClYEWKGnw66PfYvReCHu9G5lXSte3Sqc= +github.com/liuzl/gocc v0.0.0-20231231122217-0372e1059ca5/go.mod h1:7KaV9YIR92M1FpbczAcfYQ3UZ5ayT27pNtunDmXvLBo= +github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= +github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA= +github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= +github.com/mewkiz/flac v1.0.7/go.mod h1:yU74UH277dBUpqxPouHSQIar3G1X/QIclVbFahSd1pU= +github.com/mewkiz/pkg v0.0.0-20190919212034-518ade7978e2/go.mod h1:3E2FUC/qYUfM8+r9zAwpeHJzqRVVMIYnpzD/clwWxyA= +github.com/mroth/weightedrand v1.0.0 h1:V8JeHChvl2MP1sAoXq4brElOcza+jxLkRuwvtQu8L3E= +github.com/mroth/weightedrand v1.0.0/go.mod h1:3p2SIcC8al1YMzGhAIoXD+r9olo/g/cdJgAD905gyNE= +github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= +github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= +github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= +github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= +github.com/notnil/chess v1.9.0 h1:YMxR5kUVjtwcuFptGU0/3q7eG3MSHQNbg0VUekvRKV0= +github.com/notnil/chess v1.9.0/go.mod h1:cRuJUIBFq9Xki05TWHJxHYkC+fFpq45IWwk94DdlCrA= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkumza/numcn v1.0.0 h1:ZT5cf9IJkUZgRgEtCiNNykk0RwsrKXSTsvDHOwUTzgE= +github.com/pkumza/numcn v1.0.0/go.mod h1:QSeH+al9dWCd8di5HZM/ZqHqhZmUKfph572e9Ev/ETc= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= +github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= +github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/shirou/gopsutil/v3 v3.24.4 h1:dEHgzZXt4LMNm+oYELpzl9YCqV65Yr/6SfrvgRBtXeU= +github.com/shirou/gopsutil/v3 v3.24.4/go.mod h1:lTd2mdiOspcqLgAnr9/nGi71NkeMpWKdmhuxm9GusH8= +github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= +github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= +github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= +github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= +github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= +github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tetratelabs/wazero v1.5.0 h1:Yz3fZHivfDiZFUXnWMPUoiW7s8tC1sjdBtlJn08qYa0= +github.com/tetratelabs/wazero v1.5.0/go.mod h1:0U0G41+ochRKoPKCJlh0jMg1CHkyfK8kDqiirMmKY8A= +github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U= +github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= +github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= +github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= +github.com/wcharczuk/go-chart/v2 v2.1.1 h1:2u7na789qiD5WzccZsFz4MJWOJP72G+2kUuJoSNqWnE= +github.com/wcharczuk/go-chart/v2 v2.1.1/go.mod h1:CyCAUt2oqvfhCl6Q5ZvAZwItgpQKZOkCJGb+VGv6l14= +github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240627150749-3ff3d73940da h1:VDoA8sK4unUQIscev0k+flDFqgyZ8HNdEm9QO8xLKYg= +github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240627150749-3ff3d73940da/go.mod h1:J6uHaXS/Am2VsLxF9TcU6il19PbOeC4SvgxHJ1E2jaE= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +gitlab.com/gomidi/midi/v2 v2.1.7 h1:lIjVXH+bnGG04j/kUVOFILt0BQvBeGz8Kyz0l6aM830= +gitlab.com/gomidi/midi/v2 v2.1.7/go.mod h1:Cj6K9VH5GhYvPgL2JddxHBmZiP3nxKxB5XyTxiXvL9U= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8 h1:idBdZTd9UioThJp8KpM/rTSinK/ChZFBE43/WtIy8zg= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/image v0.0.0-20190220214146-31aff87c08e9/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.11.0/go.mod h1:bglhjqbqVuEb9e9+eNR45Jfu7D+T4Qan+NhQk8Ck2P8= +golang.org/x/image v0.16.0 h1:9kloLAKhUufZhA12l5fwnx2NZW39/we1UhBesW433jw= +golang.org/x/image v0.16.0/go.mod h1:ugSZItdV4nOxyqp56HmXwH0Ry0nBCpjnZdpDaIHdoPs= +golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6 h1:vyLBGJPIl9ZYbcQFM2USFmJBK6KI+t+z6jL0lbwjrnc= +golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= +golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190429190828-d89cdac9e872/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +modernc.org/cc/v4 v4.21.2 h1:dycHFB/jDc3IyacKipCNSDrjIC0Lm1hyoWOZTRR20Lk= +modernc.org/ccgo/v4 v4.17.8 h1:yyWBf2ipA0Y9GGz/MmCmi3EFpKgeS7ICrAFes+suEbs= +modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE= +modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw= +modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= +modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= +modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E= +modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU= +modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= +modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc= +modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= +modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= diff --git a/plugin/main.go b/plugin/main.go new file mode 100644 index 0000000000..2a95f0b6cf --- /dev/null +++ b/plugin/main.go @@ -0,0 +1,324 @@ +// Package main ZeroBot-Plugin main file +package main + +import ( + "encoding/json" + "flag" + "fmt" + "math/rand" + "os" + "runtime" + "strconv" + "strings" + "time" + + _ "github.com/FloatTech/ZeroBot-Plugin/console" // 更改控制台属性 + + "github.com/FloatTech/ZeroBot-Plugin/kanban" // 打印 banner + + // ---------以下插件均可通过前面加 // 注释,注释后停用并不加载插件--------- // + // ----------------------插件优先级按顺序从高到低---------------------- // + // // + // // + // // + // // + // // + // ----------------------------高优先级区---------------------------- // + // vvvvvvvvvvvvvvvvvvvvvvvvvvvv高优先级区vvvvvvvvvvvvvvvvvvvvvvvvvvvv // + // vvvvvvvvvvvvvv高优先级区vvvvvvvvvvvvvv // + // vvvvvvv高优先级区vvvvvvv // + // vvvvvvvvvvvvvv // + // vvvv // + + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/antiabuse" // 违禁词 + + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chat" // 基础词库 + + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chatcount" // 聊天时长统计 + + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/sleepmanage" // 统计睡眠时间 + + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/atri" // ATRI词库 + + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/manager" // 群管 + + _ "github.com/FloatTech/zbputils/job" // 定时指令触发器 + + // ^^^^ // + // ^^^^^^^^^^^^^^ // + // ^^^^^^^高优先级区^^^^^^^ // + // ^^^^^^^^^^^^^^高优先级区^^^^^^^^^^^^^^ // + // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^高优先级区^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // + // ----------------------------高优先级区---------------------------- // + // // + // // + // // + // // + // // + // ----------------------------中优先级区---------------------------- // + // vvvvvvvvvvvvvvvvvvvvvvvvvvvv中优先级区vvvvvvvvvvvvvvvvvvvvvvvvvvvv // + // vvvvvvvvvvvvvv中优先级区vvvvvvvvvvvvvv // + // vvvvvvv中优先级区vvvvvvv // + // vvvvvvvvvvvvvv // + // vvvv // + + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ahsai" // ahsai tts + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aifalse" // 服务器监控 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aiwife" // 随机老婆 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/alipayvoice" // 支付宝到账语音 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/autowithdraw" // 触发者撤回时也自动撤回 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baiduaudit" // 百度内容审核 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/base16384" // base16384加解密 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/base64gua" // base64卦加解密 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baseamasiro" // base天城文加解密 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/bilibili" // b站相关 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/bookreview" // 哀伤雪刃吧推书记录 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chess" // 国际象棋 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/choose" // 选择困难症帮手 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chouxianghua" // 说抽象话 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chrev" // 英文字符翻转 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/coser" // 三次元小姐姐 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/cpstory" // cp短打 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/dailynews" // 今日早报 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/danbooru" // DeepDanbooru二次元图标签识别 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/diana" // 嘉心糖发病 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/dish" // 程序员做饭指南 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/drawlots" // 多功能抽签 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/driftbottle" // 漂流瓶 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/emojimix" // 合成emoji + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/event" // 好友申请群聊邀请事件处理 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/font" // 渲染任意文字到图片 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/fortune" // 运势 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/funny" // 笑话 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/genshin" // 原神抽卡 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/gif" // 制图 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/github" // 搜索GitHub仓库 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/guessmusic" // 猜歌 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hitokoto" // 一言 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hs" // 炉石 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hyaku" // 百人一首 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/inject" // 注入指令 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jandan" // 煎蛋网无聊图 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jptingroom" // 日语听力学习材料 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/kfccrazythursday" // 疯狂星期四 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/lolicon" // lolicon 随机图片 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/lolimi" // 桑帛云 API + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/magicprompt" // magicprompt吟唱提示 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/mcfish" // 钓鱼模拟器 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/midicreate" // 简易midi音乐制作 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moegoe" // 日韩 VITS 模型拟声 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyu" // 摸鱼 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyucalendar" // 摸鱼人日历 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/music" // 点歌 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nativesetu" // 本地涩图 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nbnhhsh" // 拼音首字母缩写释义工具 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nihongo" // 日语语法学习 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/niuniu" // 牛牛大作战 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/novel" // 铅笔小说网搜索 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nsfw" // nsfw图片识别 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nwife" // 本地老婆 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/omikuji" // 浅草寺求签 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/poker" // 抽扑克 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/qqwife" // 一群一天一夫一妻制群老婆 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/qzone" // qq空间表白墙 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/realcugan" // realcugan清晰术 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/reborn" // 投胎 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/robbery" // 打劫群友的ATRI币 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/runcode" // 在线运行代码 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/saucenao" // 以图搜图 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/score" // 分数 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/setutime" // 来份涩图 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/shadiao" // 沙雕app + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/shindan" // 测定 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/steam" // steam相关 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tarot" // 抽塔罗牌 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tiangou" // 舔狗日记 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tracemoe" // 搜番 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/translation" // 翻译 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vitsnyaru" // vits猫雷 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wallet" // 钱包 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wantquotes" // 据意查句 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/warframeapi" // warframeAPI插件 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wenxinvilg" // 百度文心AI画图 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wife" // 抽老婆 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wordcount" // 聊天热词 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wordle" // 猜单词 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ygo" // 游戏王相关插件 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ymgal" // 月幕galgame + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/yujn" // 遇见API + + // _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wtf" // 鬼东西 + + // ^^^^ // + // ^^^^^^^^^^^^^^ // + // ^^^^^^^中优先级区^^^^^^^ // + // ^^^^^^^^^^^^^^中优先级区^^^^^^^^^^^^^^ // + // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^中优先级区^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // + // ----------------------------中优先级区---------------------------- // + // // + // // + // // + // // + // // + // ----------------------------低优先级区---------------------------- // + // vvvvvvvvvvvvvvvvvvvvvvvvvvvv低优先级区vvvvvvvvvvvvvvvvvvvvvvvvvvvv // + // vvvvvvvvvvvvvv低优先级区vvvvvvvvvvvvvv // + // vvvvvvv低优先级区vvvvvvv // + // vvvvvvvvvvvvvv // + // vvvv // + + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/curse" // 骂人 + + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aireply" // 人工智能回复 + + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/thesaurus" // 词典匹配回复 + + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/breakrepeat" // 打断复读 + + // ^^^^ // + // ^^^^^^^^^^^^^^ // + // ^^^^^^^低优先级区^^^^^^^ // + // ^^^^^^^^^^^^^^低优先级区^^^^^^^^^^^^^^ // + // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^低优先级区^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // + // ----------------------------低优先级区---------------------------- // + // // + // // + // // + // // + // // + // -----------------------以下为内置依赖,勿动------------------------ // + "github.com/FloatTech/floatbox/file" + "github.com/FloatTech/floatbox/process" + "github.com/sirupsen/logrus" + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/driver" + "github.com/wdvxdr1123/ZeroBot/message" + + // webctrl "github.com/FloatTech/zbputils/control/web" + + "github.com/FloatTech/ZeroBot-Plugin/kanban/banner" + // -----------------------以上为内置依赖,勿动------------------------ // +) + +type zbpcfg struct { + Z zero.Config `json:"zero"` + W []*driver.WSClient `json:"ws"` + S []*driver.WSServer `json:"wss"` +} + +var config zbpcfg + +func init() { + sus := make([]int64, 0, 16) + // 解析命令行参数 + d := flag.Bool("d", false, "Enable debug level log and higher.") + w := flag.Bool("w", false, "Enable warning level log and higher.") + h := flag.Bool("h", false, "Display this help.") + // g := flag.String("g", "127.0.0.1:3000", "Set webui url.") + // 直接写死 AccessToken 时,请更改下面第二个参数 + token := flag.String("t", "", "Set AccessToken of WSClient.") + // 直接写死 URL 时,请更改下面第二个参数 + url := flag.String("u", "ws://127.0.0.1:6700", "Set Url of WSClient.") + // 默认昵称 + adana := flag.String("n", "椛椛", "Set default nickname.") + prefix := flag.String("p", "/", "Set command prefix.") + runcfg := flag.String("c", "", "Run from config file.") + save := flag.String("s", "", "Save default config to file and exit.") + late := flag.Uint("l", 233, "Response latency (ms).") + rsz := flag.Uint("r", 4096, "Receiving buffer ring size.") + maxpt := flag.Uint("x", 4, "Max process time (min).") + markmsg := flag.Bool("m", false, "Don't mark message as read automatically") + flag.BoolVar(&file.SkipOriginal, "mirror", false, "Use mirrored lazy data at first") + + flag.Parse() + + if *h { + fmt.Println("Usage:") + flag.PrintDefaults() + os.Exit(0) + } + if *d && !*w { + logrus.SetLevel(logrus.DebugLevel) + } + if *w { + logrus.SetLevel(logrus.WarnLevel) + } + + for _, s := range flag.Args() { + i, err := strconv.ParseInt(s, 10, 64) + if err != nil { + continue + } + sus = append(sus, i) + } + + // 通过代码写死的方式添加主人账号 + // sus = append(sus, 12345678) + // sus = append(sus, 87654321) + + // 启用 webui + // go webctrl.RunGui(*g) + + if *runcfg != "" { + f, err := os.Open(*runcfg) + if err != nil { + panic(err) + } + config.W = make([]*driver.WSClient, 0, 2) + err = json.NewDecoder(f).Decode(&config) + f.Close() + if err != nil { + panic(err) + } + config.Z.Driver = make([]zero.Driver, len(config.W)+len(config.S)) + for i, w := range config.W { + config.Z.Driver[i] = w + } + for i, s := range config.S { + config.Z.Driver[i+len(config.W)] = s + } + logrus.Infoln("[main] 从", *runcfg, "读取配置文件") + return + } + config.W = []*driver.WSClient{driver.NewWebSocketClient(*url, *token)} + config.Z = zero.Config{ + NickName: append([]string{*adana}, "ATRI", "atri", "亚托莉", "アトリ"), + CommandPrefix: *prefix, + SuperUsers: sus, + RingLen: *rsz, + Latency: time.Duration(*late) * time.Millisecond, + MaxProcessTime: time.Duration(*maxpt) * time.Minute, + MarkMessage: !*markmsg, + Driver: []zero.Driver{config.W[0]}, + } + + if *save != "" { + f, err := os.Create(*save) + if err != nil { + panic(err) + } + err = json.NewEncoder(f).Encode(&config) + f.Close() + if err != nil { + panic(err) + } + logrus.Infoln("[main] 配置文件已保存到", *save) + os.Exit(0) + } +} + +func main() { + if !strings.Contains(runtime.Version(), "go1.2") { // go1.20之前版本需要全局 seed,其他插件无需再 seed + rand.Seed(time.Now().UnixNano()) //nolint: staticcheck + } + // 帮助 + zero.OnFullMatchGroup([]string{"help", "/help", ".help", "菜单"}, zero.OnlyToMe).SetBlock(true). + Handle(func(ctx *zero.Ctx) { + ctx.SendChain(message.Text(banner.Banner, "\n管理发送\"/服务列表\"查看 bot 功能\n发送\"/用法name\"查看功能用法")) + }) + zero.OnFullMatch("查看zbp公告", zero.OnlyToMe, zero.AdminPermission).SetBlock(true). + Handle(func(ctx *zero.Ctx) { + ctx.SendChain(message.Text(strings.ReplaceAll(kanban.Kanban(), "\t", ""))) + }) + zero.RunAndBlock(&config.Z, process.GlobalInitMutex.Unlock) +} diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go new file mode 100644 index 0000000000..8e51ae854e --- /dev/null +++ b/plugin/niuniu/main.go @@ -0,0 +1,362 @@ +package niuniu + +import ( + "fmt" + ctrl "github.com/FloatTech/zbpctrl" + "github.com/FloatTech/zbputils/control" + "github.com/shopspring/decimal" + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/message" + "golang.org/x/exp/rand" + "math" + "sort" + "strconv" + "sync" + "time" +) + +var ( + en = control.Register("niuniu", &ctrl.Options[*zero.Ctx]{ + DisableOnDefault: false, + Brief: "牛牛大作战", + Help: "- 打胶" + + "- 查看我的牛牛" + + "jj@xxx" + + "牛子长度排行" + + "牛子深度排行", + PrivateDataFolder: "niuniu", + }) +) + +// 设置超时 +type userLimit struct { + gid int64 + uid int64 +} + +var dajiaoLimitMap = make(map[userLimit]*time.Time) +var lock sync.RWMutex +var jjLimitMap = make(map[userLimit]*time.Time) + +func init() { + en.OnFullMatch("牛子长度排行", zero.OnlyGroup, getdb).SetBlock(false).Handle(func(ctx *zero.Ctx) { + gid := ctx.Event.GroupID + niuniuList, err := db.readAllTable(gid) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + var m []UserInfo + for _, info := range niuniuList { + if info.Long > 0 { + m = append(m, info) + } + } + if m == nil { + ctx.SendChain(message.Text("暂时没有男孩子哦")) + } + var messages string + userInfos := sortUsersByNegativeLong(m) + for i, userInfo := range userInfos { + messages += fmt.Sprintf("第%d名 长度:%.2f\n", i+1, userInfo.Long) + } + ctx.SendChain(message.Text(messages)) + }) + en.OnFullMatch("牛子深度排行", zero.OnlyGroup, getdb).SetBlock(false).Handle(func(ctx *zero.Ctx) { + gid := ctx.Event.GroupID + niuniuList, err := db.readAllTable(gid) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return + } + var m []UserInfo + for _, info := range niuniuList { + if info.Long <= 0 { + m = append(m, info) + } + } + if m == nil { + ctx.SendChain(message.Text("暂时没有女孩子哦")) + } + var messages string + userInfos := sortUsersByNegativeLong(m) + for i, userInfo := range userInfos { + messages += fmt.Sprintf("第%d名 长度:%.2f\n", i+1, userInfo.Long) + } + ctx.SendChain(message.Text(messages)) + }) + en.OnFullMatch("查看我的牛牛", getdb, zero.OnlyGroup).SetBlock(false).Handle(func(ctx *zero.Ctx) { + uid := ctx.Event.UserID + gid := ctx.Event.GroupID + niuniu, err := db.Findniuniu(gid, uid) + if err != nil { + ctx.SendChain(message.Text("ta还没有牛牛呢不能查看!")) + return + } + var result string + sexLong := "长" + sex := "♂️" + if niuniu < 0 { + sexLong = "深" + sex = "♀️" + } + result = fmt.Sprintf("\n📛%s<%s>的牛牛信息\n⭕性别:%s\n⭕%s度:%.2fcm\n⭕ ", ctx.CardOrNickName(uid), strconv.FormatInt(uid, 10), sex, sexLong, niuniu) + switch { + case niuniu <= -100: + result += "wtf?你已经进化成魅魔了!魅魔在击剑时有20%的几率消耗自身长度吞噬对方牛牛呢。" + case niuniu <= -50: + result += "嗯....好像已经穿过了身体吧..从另一面来看也可以算是凸出来的吧?" + case niuniu <= -25: + result += RandomChoice([]string{ + "这名女生,你的身体很健康哦!", + "WOW,真的凹进去了好多呢!", + "你已经是我们女孩子的一员啦!", + }) + case niuniu <= -10: + result += RandomChoice([]string{ + "你已经是一名女生了呢,", + "从女生的角度来说,你发育良好(,", + "你醒啦?你已经是一名女孩子啦!", + "唔...可以放进去一根手指了都...", + }) + case niuniu <= 0: + result += RandomChoice([]string{ + "安了安了,不要伤心嘛,做女生有什么不好的啊。", + "不哭不哭,摸摸头,虽然很难再长出来,但是请不要伤心啦啊!", + "加油加油!我看好你哦!", + "你醒啦?你现在已经是一名女孩子啦!", + }) + case niuniu <= 10: + result += RandomChoice([]string{ + "你行不行啊?细狗!", + "虽然短,但是小小的也很可爱呢。", + "像一只蚕宝宝。", + "长大了。", + }) + case niuniu <= 25: + result += RandomChoice([]string{ + "唔...没话说", + "已经很长了呢!", + }) + case niuniu <= 50: + result += RandomChoice([]string{ + "话说这种真的有可能吗?", + "厚礼谢!", + }) + case niuniu <= 100: + result += RandomChoice([]string{ + "已经突破天际了嘛...", + "唔...这玩意应该不会变得比我高吧?", + "你这个长度会死人的...!", + "你马上要进化成牛头人了!!", + "你是什么怪物,不要过来啊!!", + }) + case niuniu > 100: + result += "惊世骇俗!你已经进化成牛头人了!牛头人在击剑时有20%的几率消耗自身长度吞噬对方牛牛呢。" + } + ctx.SendChain(message.At(uid), message.Text(result)) + }) + en.OnFullMatchGroup([]string{"打胶"}, zero.OnlyGroup, getdb).SetBlock(false).Handle(func(ctx *zero.Ctx) { + // 获取群号和用户ID + gid := ctx.Event.GroupID + uid := ctx.Event.UserID + niuniu, err := db.Findniuniu(gid, uid) + if err != nil { + ctx.SendChain(message.Text("请先注册牛牛!")) + return + } + probability := rand.Intn(100 + 1) + reduce := math.Abs(hitGlue(decimal.NewFromFloat(niuniu))) + var timePass int64 + lock.RLock() + if len(dajiaoLimitMap) > 0 { + if t, ok := dajiaoLimitMap[userLimit{gid: gid, uid: uid}]; ok { + timePass = int64(time.Since(t.Local()).Seconds()) + if timePass < 90 { + ctx.SendChain(message.Text([]string{ + fmt.Sprintf("才过去了%ds时间,你就又要打🦶了,身体受得住吗", timePass), + fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 90-timePass), + fmt.Sprintf("休息一下吧,会炸膛的!%ds后再来吧", 90-timePass), + fmt.Sprintf("打咩哟,你的牛牛会爆炸的,休息%ds再来吧", 90-timePass), + }[rand.Intn(4)])) + lock.RUnlock() + return + } else { + lock.RUnlock() + lock.Lock() + delete(dajiaoLimitMap, userLimit{gid: gid, uid: uid}) + lock.Unlock() + lock.RLock() + } + } + } + lock.RUnlock() + switch { + case probability <= 40: + niuniu += reduce + ctx.SendChain(message.Text([]string{ + fmt.Sprintf("你嘿咻嘿咻一下,促进了牛牛发育,牛牛增加%.2fcm了呢!", reduce), + fmt.Sprintf("你打了个舒服痛快的🦶呐,牛牛增加了%.2fcm呢!", reduce), + }[rand.Intn(2)])) + case probability <= 60: + ctx.SendChain(message.Text([]string{ + "你打了个🦶,但是什么变化也没有,好奇怪捏~", + "你的牛牛刚开始变长了,可过了一会又回来了,什么变化也没有,好奇怪捏~", + }[rand.Intn(2)])) + default: + niuniu -= reduce + if niuniu < 0 { + ctx.SendChain(message.Text([]string{ + fmt.Sprintf("哦吼!?看来你的牛牛凹进去了%.2fcm呢!", reduce), + fmt.Sprintf("你突发恶疾!你的牛牛凹进去了%.2fcm!", reduce), + fmt.Sprintf("笑死,你因为打🦶过度导致牛牛凹进去了%.2fcm!🤣🤣🤣", reduce), + }[rand.Intn(3)])) + } else { + ctx.SendChain(message.Text([]string{ + fmt.Sprintf("阿哦,你过度打🦶,牛牛缩短%.2fcm了呢!", reduce), + fmt.Sprintf("你的牛牛变长了很多,你很激动地继续打🦶,然后牛牛缩短了%.2fcm呢!", reduce), + fmt.Sprintf("小打怡情,大打伤身,强打灰飞烟灭!你过度打🦶,牛牛缩短了%.2fcm捏!", reduce), + }[rand.Intn(3)])) + } + } + u := UserInfo{ + Uid: uid, + Long: niuniu, + Id: 1, + } + if err = db.Insertniuniu(u, gid); err != nil { + ctx.SendChain(message.Text("ERROR:", err)) + return + } + t := time.Now() + dajiaoLimitMap[userLimit{ + gid: gid, + uid: uid, + }] = &t + }) + en.OnFullMatch("注册牛牛", zero.OnlyGroup, getdb).SetBlock(false).Handle(func(ctx *zero.Ctx) { + gid := ctx.Event.GroupID + uid := ctx.Event.UserID + if _, err := db.Findniuniu(gid, uid); err == nil { + ctx.SendChain(message.Text("你已经注册过了")) + return + } + //获取初始长度 + long, _ := randomLong().Float64() + u := UserInfo{ + Uid: uid, + Long: long, + Id: 1, + } + //添加数据进入表 + err := db.Insertniuniu(u, gid) + if err != nil { + ctx.SendChain(message.Text("ERROR:", err)) + err = db.CreateGidTable(gid) + if err != nil { + ctx.SendChain(message.Text("ERROR:", err)) + return + } + err = db.Insertniuniu(u, gid) + if err != nil { + ctx.SendChain(message.Text("ERROR:", err)) + return + } + } + ctx.SendChain(message.Reply(ctx.Event.GroupID), + message.Text("注册成功,你的牛牛现在有", u.Long, "cm")) + }) + en.OnRegex(`jj\[CQ:at,qq=([0-9]+)\].*`, getdb, zero.OnlyGroup).SetBlock(false).Handle(func(ctx *zero.Ctx) { + adduser, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) + if err != nil { + ctx.SendChain(message.Text("ERROR:", err)) + return + } + uid := ctx.Event.UserID + gid := ctx.Event.GroupID + myniuniu, err := db.Findniuniu(gid, uid) + if err != nil { + ctx.SendChain(message.Text("你还没有牛牛快去注册一个吧!")) + return + } + adduserniuniu, err := db.Findniuniu(gid, adduser) + if err != nil { + ctx.SendChain(message.At(uid), message.Text("对方还没有牛牛呢,不能🤺")) + return + } + var timePass int64 + lock.RLock() + if len(jjLimitMap) > 0 { + if t, ok := dajiaoLimitMap[userLimit{gid: gid, uid: uid}]; ok { + timePass = int64(time.Since(t.Local()).Seconds()) + if timePass < 150 { + ctx.SendChain(message.Text([]string{ + fmt.Sprintf("才过去了%ds时间,你就又要击剑了,真是饥渴难耐啊", timePass), + fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 150-timePass), + fmt.Sprintf("你这种男同就应该被送去集中营!等待%ds再来吧", 150-timePass), + fmt.Sprintf("打咩哟!你的牛牛会炸的,休息%ds再来吧", 150-timePass), + }[rand.Intn(4)])) + lock.RUnlock() + return + } else { + lock.RUnlock() + lock.Lock() + delete(jjLimitMap, userLimit{gid: gid, uid: uid}) + lock.Unlock() + lock.RLock() + } + } + } + lock.RUnlock() + if myniuniu == adduserniuniu { + ctx.SendChain(message.Text("你要和谁🤺?你自己吗?")) + return + } + fencingResult, f := fencing(myniuniu, adduserniuniu) + err = db.Insertniuniu(UserInfo{Uid: uid, Long: f}, gid) + if err != nil { + ctx.SendChain(message.Text("ERROR:", err)) + return + } + err = db.Insertniuniu(UserInfo{Uid: adduser, Long: -f}, gid) + if err != nil { + ctx.SendChain(message.Text("ERROR:", err)) + return + } + ctx.SendChain(message.At(uid), message.Text(fencingResult)) + t := time.Now() + lock.Lock() + jjLimitMap[userLimit{ + gid: gid, + uid: uid, + }] = &t + lock.Unlock() + }) + en.OnFullMatch("注销牛牛", getdb, zero.OnlyGroup).SetBlock(false).Handle(func(ctx *zero.Ctx) { + uid := ctx.Event.UserID + gid := ctx.Event.GroupID + _, err := db.Findniuniu(gid, uid) + if err != nil { + ctx.SendChain(message.Text("你还没有牛牛呢,不能注销")) + return + } + err = db.Deleteniuniu(gid, uid) + if err != nil { + ctx.SendChain(message.Text("注销失败")) + return + } + ctx.SendChain(message.Text("注销成功")) + }) +} + +func RandomChoice(options []string) string { + return options[rand.Intn(len(options))] +} + +// sortUsersByNegativeLong 接收一个UserInfo切片,并按Long字段负数越大(绝对值越小)排序后返回 +func sortUsersByNegativeLong(users []UserInfo) []UserInfo { + sort.Slice(users, func(i, j int) bool { + return users[i].Long > users[j].Long + }) + return users +} diff --git a/plugin/niuniu/model.go b/plugin/niuniu/model.go new file mode 100644 index 0000000000..80ac152f9f --- /dev/null +++ b/plugin/niuniu/model.go @@ -0,0 +1,80 @@ +package niuniu + +import ( + fcext "github.com/FloatTech/floatbox/ctxext" + sql "github.com/FloatTech/sqlite" + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/message" + "strconv" + "sync" + "time" +) + +type Model struct { + sql *sql.Sqlite + sync.RWMutex +} + +type UserInfo struct { + Uid int64 + Long float64 + Id int +} + +var ( + db = &Model{sql: &sql.Sqlite{}} + getdb = fcext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool { + db.sql.DBPath = en.DataFolder() + "niuniu.db" + err := db.sql.Open(time.Hour * 24) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return false + } + return true + }) +) + +func (db *Model) CreateGidTable(gid int64) error { + db.Lock() + defer db.Unlock() + return db.sql.Create(strconv.FormatInt(gid, 10), &UserInfo{}) +} + +func (db *Model) Findniuniu(gid, uid int64) (float64, error) { + db.RLock() + defer db.RUnlock() + u := UserInfo{} + err := db.sql.Find(strconv.FormatInt(gid, 10), &u, "where Uid = "+strconv.FormatInt(uid, 10)) + return u.Long, err +} + +func (db *Model) Insertniuniu(u UserInfo, gid int64) error { + db.Lock() + defer db.Unlock() + return db.sql.Insert(strconv.FormatInt(gid, 10), &u) +} + +func (db *Model) Deleteniuniu(gid, uid int64) error { + db.Lock() + defer db.Unlock() + return db.sql.Del(strconv.FormatInt(gid, 10), "where Uid = "+strconv.FormatInt(uid, 10)) +} + +func (db *Model) readAllTable(gid int64) ([]UserInfo, error) { + db.Lock() + defer db.Unlock() + a, err := sql.FindAll[UserInfo](db.sql, strconv.FormatInt(gid, 10), "where Id = 1") + slice := convertSocialHostInfoPointersToSlice(a) + return slice, err +} + +// 返回一个不是指针类型的切片 +func convertSocialHostInfoPointersToSlice(pointers []*UserInfo) []UserInfo { + var slice []UserInfo + for _, ptr := range pointers { + if ptr != nil { + slice = append(slice, *ptr) + } + } + return slice +} diff --git a/plugin/niuniu/result.go b/plugin/niuniu/result.go new file mode 100644 index 0000000000..5a8324aec9 --- /dev/null +++ b/plugin/niuniu/result.go @@ -0,0 +1,113 @@ +package niuniu + +import ( + "fmt" + "github.com/shopspring/decimal" + "math" + "math/rand" +) + +// fencing 击剑对决逻辑,返回对决结果和myLength的变化值 +func fencing(myLength, oppoLength float64) (string, float64) { + lossLimit := 0.25 + devourLimit := 0.27 + + probability := rand.Intn(100) + 1 + + switch { + case oppoLength <= -100 && myLength > 0 && 10 < probability && probability <= 20: + oppoLength *= 0.85 + change := -math.Min(math.Abs(lossLimit*myLength), math.Abs(1.5*myLength)) + myLength += change + return fmt.Sprintf("对方身为魅魔诱惑了你,你同化成魅魔!当前长度%.2fcm!", myLength), change + + case oppoLength >= 100 && myLength > 0 && 10 < probability && probability <= 20: + oppoLength *= 0.85 + change := -math.Min(math.Abs(devourLimit*myLength), math.Abs(1.5*myLength)) + myLength += change + return fmt.Sprintf("对方以牛头人的荣誉摧毁了你的牛牛!当前长度%.2fcm!", myLength), change + + case myLength <= -100 && oppoLength > 0 && 10 < probability && probability <= 20: + myLength *= 0.85 + change := math.Min(math.Abs(lossLimit*oppoLength), math.Abs(1.5*oppoLength)) + oppoLength -= change + return fmt.Sprintf("你身为魅魔诱惑了对方,吞噬了对方部分长度!当前长度%.2fcm!", myLength), change + + case myLength >= 100 && oppoLength > 0 && 10 < probability && probability <= 20: + myLength *= 0.85 + change := math.Min(math.Abs(devourLimit*oppoLength), math.Abs(1.5*oppoLength)) + oppoLength -= change + return fmt.Sprintf("你以牛头人的荣誉摧毁了对方的牛牛!当前长度%.2fcm!", myLength), change + + default: + return determineResultBySkill(myLength, oppoLength) + } +} + +// determineResultBySkill 根据击剑技巧决定结果 +func determineResultBySkill(myLength, oppoLength float64) (string, float64) { + probability := rand.Intn(100) + 1 + winProbability := calculateWinProbability(myLength, oppoLength) * 100 + + if 0 < probability && float64(probability) <= winProbability { + return applySkill(myLength, oppoLength, true) + } else { + return applySkill(myLength, oppoLength, false) + } +} + +// calculateWinProbability 计算胜率 +func calculateWinProbability(heightA, heightB float64) float64 { + pA := 0.9 + heightRatio := math.Max(heightA, heightB) / math.Min(heightA, heightB) + reductionRate := 0.1 * (heightRatio - 1) + reduction := pA * reductionRate + adjustedPA := pA - reduction + return math.Max(adjustedPA, 0.01) +} + +// applySkill 应用击剑技巧并生成结果 +func applySkill(myLength, oppoLength float64, increaseLength1 bool) (string, float64) { + reduce := fence(oppoLength) + var change float64 + + if increaseLength1 { + myLength += reduce + oppoLength -= 0.8 * reduce + change = reduce + + if myLength < 0 { + return fmt.Sprintf("哦吼!?你的牛牛在长大欸!长大了%.2fcm!", reduce), change + } + return fmt.Sprintf("你以绝对的长度让对方屈服了呢!你的长度增加%.2fcm,当前长度%.2fcm!", reduce, myLength), change + + } else { + myLength -= reduce + oppoLength += 0.8 * reduce + change = -reduce + + if myLength < 0 { + return fmt.Sprintf("哦吼!?看来你的牛牛因为击剑而凹进去了呢🤣🤣🤣!凹进去了%.2fcm!", reduce), change + } + return fmt.Sprintf("对方以绝对的长度让你屈服了呢!你的长度减少%.2fcm,当前长度%.2fcm!", reduce, myLength), change + } +} + +// fence 简单模拟击剑技巧效果 +func fence(oppoLength float64) float64 { + return float64(rand.Intn(5)+1) + rand.Float64() +} + +// randomLong 生成一个随机的数值 +func randomLong() decimal.Decimal { + return decimal.NewFromFloat(float64(rand.Intn(9)+1) + float64(rand.Intn(100))/100) +} + +// hitGlue 调整传入的值 +func hitGlue(l decimal.Decimal) float64 { + l = l.Sub(decimal.NewFromInt(1)) + randomFactor := decimal.NewFromFloat(rand.Float64()) + adjustedValue := randomFactor.Mul(l).Div(decimal.NewFromInt(2)) + f, _ := adjustedValue.Float64() + return f +} From 68356a0e9b11c0fef2954d8c79b6c90943718382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 4 Aug 2024 00:09:09 +0800 Subject: [PATCH 02/58] Delete plugin/main.go --- plugin/main.go | 324 ------------------------------------------------- 1 file changed, 324 deletions(-) delete mode 100644 plugin/main.go diff --git a/plugin/main.go b/plugin/main.go deleted file mode 100644 index 2a95f0b6cf..0000000000 --- a/plugin/main.go +++ /dev/null @@ -1,324 +0,0 @@ -// Package main ZeroBot-Plugin main file -package main - -import ( - "encoding/json" - "flag" - "fmt" - "math/rand" - "os" - "runtime" - "strconv" - "strings" - "time" - - _ "github.com/FloatTech/ZeroBot-Plugin/console" // 更改控制台属性 - - "github.com/FloatTech/ZeroBot-Plugin/kanban" // 打印 banner - - // ---------以下插件均可通过前面加 // 注释,注释后停用并不加载插件--------- // - // ----------------------插件优先级按顺序从高到低---------------------- // - // // - // // - // // - // // - // // - // ----------------------------高优先级区---------------------------- // - // vvvvvvvvvvvvvvvvvvvvvvvvvvvv高优先级区vvvvvvvvvvvvvvvvvvvvvvvvvvvv // - // vvvvvvvvvvvvvv高优先级区vvvvvvvvvvvvvv // - // vvvvvvv高优先级区vvvvvvv // - // vvvvvvvvvvvvvv // - // vvvv // - - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/antiabuse" // 违禁词 - - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chat" // 基础词库 - - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chatcount" // 聊天时长统计 - - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/sleepmanage" // 统计睡眠时间 - - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/atri" // ATRI词库 - - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/manager" // 群管 - - _ "github.com/FloatTech/zbputils/job" // 定时指令触发器 - - // ^^^^ // - // ^^^^^^^^^^^^^^ // - // ^^^^^^^高优先级区^^^^^^^ // - // ^^^^^^^^^^^^^^高优先级区^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^高优先级区^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ----------------------------高优先级区---------------------------- // - // // - // // - // // - // // - // // - // ----------------------------中优先级区---------------------------- // - // vvvvvvvvvvvvvvvvvvvvvvvvvvvv中优先级区vvvvvvvvvvvvvvvvvvvvvvvvvvvv // - // vvvvvvvvvvvvvv中优先级区vvvvvvvvvvvvvv // - // vvvvvvv中优先级区vvvvvvv // - // vvvvvvvvvvvvvv // - // vvvv // - - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ahsai" // ahsai tts - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aifalse" // 服务器监控 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aiwife" // 随机老婆 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/alipayvoice" // 支付宝到账语音 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/autowithdraw" // 触发者撤回时也自动撤回 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baiduaudit" // 百度内容审核 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/base16384" // base16384加解密 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/base64gua" // base64卦加解密 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/baseamasiro" // base天城文加解密 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/bilibili" // b站相关 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/bookreview" // 哀伤雪刃吧推书记录 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chess" // 国际象棋 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/choose" // 选择困难症帮手 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chouxianghua" // 说抽象话 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/chrev" // 英文字符翻转 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/coser" // 三次元小姐姐 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/cpstory" // cp短打 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/dailynews" // 今日早报 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/danbooru" // DeepDanbooru二次元图标签识别 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/diana" // 嘉心糖发病 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/dish" // 程序员做饭指南 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/drawlots" // 多功能抽签 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/driftbottle" // 漂流瓶 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/emojimix" // 合成emoji - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/event" // 好友申请群聊邀请事件处理 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/font" // 渲染任意文字到图片 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/fortune" // 运势 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/funny" // 笑话 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/genshin" // 原神抽卡 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/gif" // 制图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/github" // 搜索GitHub仓库 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/guessmusic" // 猜歌 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hitokoto" // 一言 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hs" // 炉石 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/hyaku" // 百人一首 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/inject" // 注入指令 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jandan" // 煎蛋网无聊图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/jptingroom" // 日语听力学习材料 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/kfccrazythursday" // 疯狂星期四 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/lolicon" // lolicon 随机图片 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/lolimi" // 桑帛云 API - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/magicprompt" // magicprompt吟唱提示 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/mcfish" // 钓鱼模拟器 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/midicreate" // 简易midi音乐制作 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moegoe" // 日韩 VITS 模型拟声 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyu" // 摸鱼 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/moyucalendar" // 摸鱼人日历 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/music" // 点歌 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nativesetu" // 本地涩图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nbnhhsh" // 拼音首字母缩写释义工具 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nihongo" // 日语语法学习 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/niuniu" // 牛牛大作战 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/novel" // 铅笔小说网搜索 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nsfw" // nsfw图片识别 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nwife" // 本地老婆 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/omikuji" // 浅草寺求签 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/poker" // 抽扑克 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/qqwife" // 一群一天一夫一妻制群老婆 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/qzone" // qq空间表白墙 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/realcugan" // realcugan清晰术 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/reborn" // 投胎 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/robbery" // 打劫群友的ATRI币 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/runcode" // 在线运行代码 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/saucenao" // 以图搜图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/score" // 分数 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/setutime" // 来份涩图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/shadiao" // 沙雕app - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/shindan" // 测定 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/steam" // steam相关 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tarot" // 抽塔罗牌 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tiangou" // 舔狗日记 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/tracemoe" // 搜番 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/translation" // 翻译 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/vitsnyaru" // vits猫雷 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wallet" // 钱包 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wantquotes" // 据意查句 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/warframeapi" // warframeAPI插件 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wenxinvilg" // 百度文心AI画图 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wife" // 抽老婆 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wordcount" // 聊天热词 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wordle" // 猜单词 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ygo" // 游戏王相关插件 - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/ymgal" // 月幕galgame - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/yujn" // 遇见API - - // _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wtf" // 鬼东西 - - // ^^^^ // - // ^^^^^^^^^^^^^^ // - // ^^^^^^^中优先级区^^^^^^^ // - // ^^^^^^^^^^^^^^中优先级区^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^中优先级区^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ----------------------------中优先级区---------------------------- // - // // - // // - // // - // // - // // - // ----------------------------低优先级区---------------------------- // - // vvvvvvvvvvvvvvvvvvvvvvvvvvvv低优先级区vvvvvvvvvvvvvvvvvvvvvvvvvvvv // - // vvvvvvvvvvvvvv低优先级区vvvvvvvvvvvvvv // - // vvvvvvv低优先级区vvvvvvv // - // vvvvvvvvvvvvvv // - // vvvv // - - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/curse" // 骂人 - - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/aireply" // 人工智能回复 - - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/thesaurus" // 词典匹配回复 - - _ "github.com/FloatTech/ZeroBot-Plugin/plugin/breakrepeat" // 打断复读 - - // ^^^^ // - // ^^^^^^^^^^^^^^ // - // ^^^^^^^低优先级区^^^^^^^ // - // ^^^^^^^^^^^^^^低优先级区^^^^^^^^^^^^^^ // - // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^低优先级区^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // - // ----------------------------低优先级区---------------------------- // - // // - // // - // // - // // - // // - // -----------------------以下为内置依赖,勿动------------------------ // - "github.com/FloatTech/floatbox/file" - "github.com/FloatTech/floatbox/process" - "github.com/sirupsen/logrus" - zero "github.com/wdvxdr1123/ZeroBot" - "github.com/wdvxdr1123/ZeroBot/driver" - "github.com/wdvxdr1123/ZeroBot/message" - - // webctrl "github.com/FloatTech/zbputils/control/web" - - "github.com/FloatTech/ZeroBot-Plugin/kanban/banner" - // -----------------------以上为内置依赖,勿动------------------------ // -) - -type zbpcfg struct { - Z zero.Config `json:"zero"` - W []*driver.WSClient `json:"ws"` - S []*driver.WSServer `json:"wss"` -} - -var config zbpcfg - -func init() { - sus := make([]int64, 0, 16) - // 解析命令行参数 - d := flag.Bool("d", false, "Enable debug level log and higher.") - w := flag.Bool("w", false, "Enable warning level log and higher.") - h := flag.Bool("h", false, "Display this help.") - // g := flag.String("g", "127.0.0.1:3000", "Set webui url.") - // 直接写死 AccessToken 时,请更改下面第二个参数 - token := flag.String("t", "", "Set AccessToken of WSClient.") - // 直接写死 URL 时,请更改下面第二个参数 - url := flag.String("u", "ws://127.0.0.1:6700", "Set Url of WSClient.") - // 默认昵称 - adana := flag.String("n", "椛椛", "Set default nickname.") - prefix := flag.String("p", "/", "Set command prefix.") - runcfg := flag.String("c", "", "Run from config file.") - save := flag.String("s", "", "Save default config to file and exit.") - late := flag.Uint("l", 233, "Response latency (ms).") - rsz := flag.Uint("r", 4096, "Receiving buffer ring size.") - maxpt := flag.Uint("x", 4, "Max process time (min).") - markmsg := flag.Bool("m", false, "Don't mark message as read automatically") - flag.BoolVar(&file.SkipOriginal, "mirror", false, "Use mirrored lazy data at first") - - flag.Parse() - - if *h { - fmt.Println("Usage:") - flag.PrintDefaults() - os.Exit(0) - } - if *d && !*w { - logrus.SetLevel(logrus.DebugLevel) - } - if *w { - logrus.SetLevel(logrus.WarnLevel) - } - - for _, s := range flag.Args() { - i, err := strconv.ParseInt(s, 10, 64) - if err != nil { - continue - } - sus = append(sus, i) - } - - // 通过代码写死的方式添加主人账号 - // sus = append(sus, 12345678) - // sus = append(sus, 87654321) - - // 启用 webui - // go webctrl.RunGui(*g) - - if *runcfg != "" { - f, err := os.Open(*runcfg) - if err != nil { - panic(err) - } - config.W = make([]*driver.WSClient, 0, 2) - err = json.NewDecoder(f).Decode(&config) - f.Close() - if err != nil { - panic(err) - } - config.Z.Driver = make([]zero.Driver, len(config.W)+len(config.S)) - for i, w := range config.W { - config.Z.Driver[i] = w - } - for i, s := range config.S { - config.Z.Driver[i+len(config.W)] = s - } - logrus.Infoln("[main] 从", *runcfg, "读取配置文件") - return - } - config.W = []*driver.WSClient{driver.NewWebSocketClient(*url, *token)} - config.Z = zero.Config{ - NickName: append([]string{*adana}, "ATRI", "atri", "亚托莉", "アトリ"), - CommandPrefix: *prefix, - SuperUsers: sus, - RingLen: *rsz, - Latency: time.Duration(*late) * time.Millisecond, - MaxProcessTime: time.Duration(*maxpt) * time.Minute, - MarkMessage: !*markmsg, - Driver: []zero.Driver{config.W[0]}, - } - - if *save != "" { - f, err := os.Create(*save) - if err != nil { - panic(err) - } - err = json.NewEncoder(f).Encode(&config) - f.Close() - if err != nil { - panic(err) - } - logrus.Infoln("[main] 配置文件已保存到", *save) - os.Exit(0) - } -} - -func main() { - if !strings.Contains(runtime.Version(), "go1.2") { // go1.20之前版本需要全局 seed,其他插件无需再 seed - rand.Seed(time.Now().UnixNano()) //nolint: staticcheck - } - // 帮助 - zero.OnFullMatchGroup([]string{"help", "/help", ".help", "菜单"}, zero.OnlyToMe).SetBlock(true). - Handle(func(ctx *zero.Ctx) { - ctx.SendChain(message.Text(banner.Banner, "\n管理发送\"/服务列表\"查看 bot 功能\n发送\"/用法name\"查看功能用法")) - }) - zero.OnFullMatch("查看zbp公告", zero.OnlyToMe, zero.AdminPermission).SetBlock(true). - Handle(func(ctx *zero.Ctx) { - ctx.SendChain(message.Text(strings.ReplaceAll(kanban.Kanban(), "\t", ""))) - }) - zero.RunAndBlock(&config.Z, process.GlobalInitMutex.Unlock) -} From a48c9f532f8c27e168ff8898a94823d75855a87e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 4 Aug 2024 00:09:29 +0800 Subject: [PATCH 03/58] Delete plugin/go.sum --- plugin/go.sum | 303 -------------------------------------------------- 1 file changed, 303 deletions(-) delete mode 100644 plugin/go.sum diff --git a/plugin/go.sum b/plugin/go.sum deleted file mode 100644 index 09d78f405b..0000000000 --- a/plugin/go.sum +++ /dev/null @@ -1,303 +0,0 @@ -github.com/Baidu-AIP/golang-sdk v1.1.1 h1:RQsAmgDSAkiq22I6n7XJ2t3afgzFeqjY46FGhvrx4cw= -github.com/Baidu-AIP/golang-sdk v1.1.1/go.mod h1:bXnGw7xPeKt8aF7UCELKrV6UZ/46spItONK1RQBQj1Y= -github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/FloatTech/AnimeAPI v1.7.1-0.20240530072450-71c23d2f01f8 h1:2i36tl5VlBWxWxv4WyfWmCA23NaV1fB5/smJtdORHf4= -github.com/FloatTech/AnimeAPI v1.7.1-0.20240530072450-71c23d2f01f8/go.mod h1:Ru6q5pZUnfMg1iu0M1Hp73q9N3LNIbDr16kjkzyG6Xk= -github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14 h1:8O0Iq9MnKsKowltY9txhOqcJdmGTjxHPQ4gEYzbJc9A= -github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14/go.mod h1:OzGLhvmtz1TKIdGaJDd8pQumvD36UqK+dWsiCISmzQQ= -github.com/FloatTech/gg v1.1.3-0.20230226151425-6ea91286ba08 h1:dPLeoiTVSBlgls+66EB/UJ2e38BaASmBN5nANaycSBU= -github.com/FloatTech/gg v1.1.3-0.20230226151425-6ea91286ba08/go.mod h1:uzPzAeT35egARdRuu+1oyjU3CmTwCceoq3Vvje7LpcI= -github.com/FloatTech/imgfactory v0.2.2-0.20230413152719-e101cc3606ef h1:CJbK/2FRwPuZpeb6M4sWK2d7oXDnBEGhpkQuQrgc91A= -github.com/FloatTech/imgfactory v0.2.2-0.20230413152719-e101cc3606ef/go.mod h1:el5hGpj1C1bDRxcTXYRwEivDCr40zZeJpcrLrB1fajs= -github.com/FloatTech/rendercard v0.0.10-0.20230223064326-45d29fa4ede9 h1:hffajvmQFfP68U6wUwHemPuuwCUoss+SEFfoLYwbGwE= -github.com/FloatTech/rendercard v0.0.10-0.20230223064326-45d29fa4ede9/go.mod h1:NBFPhWae4hqVMeG8ELBBnUQkKce3nDjkljVn6PdiUNs= -github.com/FloatTech/sqlite v1.6.3 h1:MQkqBNlkPuCoKQQgoNLuTL/2Ci3tBTFAnVYBdD0Wy4M= -github.com/FloatTech/sqlite v1.6.3/go.mod h1:zFbHzRfB+CJ+VidfjuVbrcin3DAz283F7hF1hIeHzpY= -github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 h1:g4pTnDJUW4VbJ9NvoRfUvdjDrHz/6QhfN/LoIIpICbo= -github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs= -github.com/FloatTech/zbpctrl v1.6.1 h1:SilK5R2poO8iUT6JPzpgr/BSzxYAaybBYNZkMyZ8STw= -github.com/FloatTech/zbpctrl v1.6.1/go.mod h1:I+MetM++1sJhNPg3zww1aw04BicYsNohvHC4Jh52XSo= -github.com/FloatTech/zbputils v1.7.2-0.20240530064059-af6f6773ba94 h1:ITQPmNSHE5bNFBpdwldUpfTDLXROEahSKspkJrSLWvQ= -github.com/FloatTech/zbputils v1.7.2-0.20240530064059-af6f6773ba94/go.mod h1:nHWYtF4g2NRv3GXZiAZDvgPjdcHGUaQHxGgD0aHz30I= -github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= -github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7 h1:S/ferNiehVjNaBMNNBxUjLtVmP/YWD6Yh79RfPv4ehU= -github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7/go.mod h1:vD7Ra3Q9onRtojoY5sMCLQ7JBgjUsrXDnDKyFxqpf9w= -github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5 h1:bBmmB7he0iVN4m5mcehfheeRUEer/Avo4ujnxI3uCqs= -github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5/go.mod h1:0UcFaCkhp6vZw6l5Dpq0Dp673CoF9GdvA8lTfst0GiU= -github.com/adamzy/cedar-go v0.0.0-20170805034717-80a9c64b256d h1:ir/IFJU5xbja5UaBEQLjcvn7aAU01nqU/NUyOBEU+ew= -github.com/adamzy/cedar-go v0.0.0-20170805034717-80a9c64b256d/go.mod h1:PRWNwWq0yifz6XDPZu48aSld8BWwBfr2JKB2bGWiEd4= -github.com/ajstarks/svgo v0.0.0-20200320125537-f189e35d30ca h1:kWzLcty5V2rzOqJM7Tp/MfSX0RMSI1x4IOLApEefYxA= -github.com/ajstarks/svgo v0.0.0-20200320125537-f189e35d30ca/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= -github.com/antchfx/htmlquery v1.3.1 h1:wm0LxjLMsZhRHfQKKZscDf2COyH4vDYA3wyH+qZ+Ylc= -github.com/antchfx/htmlquery v1.3.1/go.mod h1:PTj+f1V2zksPlwNt7uVvZPsxpKNa7mlVliCRxLX6Nx8= -github.com/antchfx/xpath v1.3.0 h1:nTMlzGAK3IJ0bPpME2urTuFL76o4A96iYvoKFHRXJgc= -github.com/antchfx/xpath v1.3.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= -github.com/blend/go-sdk v1.20220411.3 h1:GFV4/FQX5UzXLPwWV03gP811pj7B8J2sbuq+GJQofXc= -github.com/blend/go-sdk v1.20220411.3/go.mod h1:7lnH8fTi6U4i1fArEXRyOIY2E1X4MALg09qsQqY1+ak= -github.com/corona10/goimagehash v1.1.0 h1:teNMX/1e+Wn/AYSbLHX8mj+mF9r60R1kBeqE9MkoYwI= -github.com/corona10/goimagehash v1.1.0/go.mod h1:VkvE0mLn84L4aF8vCb6mafVajEb6QYMHl2ZJLn0mOGI= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/d4l3k/messagediff v1.2.2-0.20190829033028-7e0a312ae40b/go.mod h1:Oozbb1TVXFac9FtSIxHBMnBCq2qeH/2KkEQxENCrlLo= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davidscholberg/go-durationfmt v0.0.0-20170122144659-64843a2083d3 h1:qshMBFxVjYjzI+kwvWvgoByF3uMCvnJiaK8KslWAbr8= -github.com/davidscholberg/go-durationfmt v0.0.0-20170122144659-64843a2083d3/go.mod h1:M9fx6rAdHSYLKxXPgUXGgblb586CA7ceNrpu4DEc2No= -github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd h1:83Wprp6ROGeiHFAP8WJdI2RoxALQYgdllERc3N5N2DM= -github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= -github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= -github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= -github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= -github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 h1:BBade+JlV/f7JstZ4pitd4tHhpN+w+6I+LyOS7B4fyU= -github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4/go.mod h1:H7chHJglrhPPzetLdzBleF8d22WYOv7UM/lEKYiwlKM= -github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y= -github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= -github.com/faiface/beep v1.1.0 h1:A2gWP6xf5Rh7RG/p9/VAW2jRSDEGQm5sbOb38sf5d4c= -github.com/faiface/beep v1.1.0/go.mod h1:6I8p6kK2q4opL/eWb+kAkk38ehnTunWeToJB+s51sT4= -github.com/fumiama/ahsai v0.1.0 h1:LXD61Kaj6kJHa3AEGsLIfKNzcgaVxg7JB72OR4yNNZ4= -github.com/fumiama/ahsai v0.1.0/go.mod h1:fFeNnqgo44i8FIaguK659aQryuZeFy+4klYLQu/rfdk= -github.com/fumiama/cron v1.3.0 h1:ZWlwuexF+HQHl3cYytEE5HNwD99q+3vNZF1GrEiXCFo= -github.com/fumiama/cron v1.3.0/go.mod h1:bz5Izvgi/xEUI8tlBN8BI2jr9Moo8N4or0KV8xXuPDY= -github.com/fumiama/go-base16384 v1.7.0 h1:6fep7XPQWxRlh4Hu+KsdH+6+YdUp+w6CwRXtMWSsXCA= -github.com/fumiama/go-base16384 v1.7.0/go.mod h1:OEn+947GV5gsbTAnyuUW/SrfxJYUdYupSIQXOuGOcXM= -github.com/fumiama/go-registry v0.2.7 h1:tLEqgEpsiybQMqBv0dLHm5leia/z1DhajMupwnOHeNs= -github.com/fumiama/go-registry v0.2.7/go.mod h1:m+wp5fF8dYgVoFkBPZl+vlK90loymaJE0JCtocVQLEs= -github.com/fumiama/go-simple-protobuf v0.2.0 h1:ACyN1MAlu7pDR3EszWgzUeNP+IRsSHwH6V9JCJA5R5o= -github.com/fumiama/go-simple-protobuf v0.2.0/go.mod h1:5yYNapXq1tQMOZg9bOIVhQlZk9pQqpuFIO4DZLbsdy4= -github.com/fumiama/gofastTEA v0.0.10 h1:JJJ+brWD4kie+mmK2TkspDXKzqq0IjXm89aGYfoGhhQ= -github.com/fumiama/gofastTEA v0.0.10/go.mod h1:RIdbYZyB4MbH6ZBlPymRaXn3cD6SedlCu5W/HHfMPBk= -github.com/fumiama/gotracemoe v0.0.3 h1:iI5EbE9A3UUbfukG6+/soYPjp1S31eCNYf4tw7s6/Jc= -github.com/fumiama/gotracemoe v0.0.3/go.mod h1:tyqahdUzHf0bQIAVY/GYmDWvYYe5ik1ZbhnGYh+zl40= -github.com/fumiama/imgsz v0.0.4 h1:Lsasu2hdSSFS+vnD+nvR1UkiRMK7hcpyYCC0FzgSMFI= -github.com/fumiama/imgsz v0.0.4/go.mod h1:bISOQVTlw9sRytPwe8ir7tAaEmyz9hSNj9n8mXMBG0E= -github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565 h1:sQuR2+N5HurnvsZhiKdEg+Ig354TaqgCQRxd/0KgIOQ= -github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565/go.mod h1:UUEvyLTJ7yoOA/viKG4wEis4ERydM7+Ny6gZUWgkS80= -github.com/fumiama/libc v0.0.0-20240530081950-6f6d8586b5c5 h1:jDxsIupsT84A6WHcs6kWbst+KqrRQ8/o0VyoFMnbBOA= -github.com/fumiama/libc v0.0.0-20240530081950-6f6d8586b5c5/go.mod h1:15P6ublJ9FJR8YQCGy8DeQ2Uwur7iW9Hserr/T3OFZE= -github.com/fumiama/sqlite3 v1.29.10-simp h1:c5y3uKyU0q9t0/SyfynzYyuslQ5zP+5CD8e0yYY554A= -github.com/fumiama/sqlite3 v1.29.10-simp/go.mod h1:ItX2a1OVGgNsFh6Dv60JQvGfJfTPHPVpV6DF59akYOA= -github.com/fumiama/terasu v0.0.0-20240507144117-547a591149c0 h1:So/3Bg/m2ZcUvqCzzEjjkjHBjcvnV3AN5tCxwsdMwYU= -github.com/fumiama/terasu v0.0.0-20240507144117-547a591149c0/go.mod h1:UVx8YP1jKKL1Cj+uy+OnQRM2Ih6U36Mqy9GSf7jabsI= -github.com/fumiama/unibase2n v0.0.0-20240530074540-ec743fd5a6d6 h1:LtDgr628eji8jRpjPCxsk7ibjcfi97QieZVCTjxLCBw= -github.com/fumiama/unibase2n v0.0.0-20240530074540-ec743fd5a6d6/go.mod h1:lEaZsT4FRSqcjnQ5q8y+mkenkzR/r1D3BJmfdp0vqDg= -github.com/gabriel-vasile/mimetype v1.0.4 h1:uBejfH8l3/2f+5vjl1e4xIaSyNEhRBZ5N/ij7ohpNd8= -github.com/gabriel-vasile/mimetype v1.0.4/go.mod h1:6CDPel/o/3/s4+bp6kIbsWATq8pmgOisOPG40CJa6To= -github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell v1.3.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM= -github.com/go-audio/audio v1.0.0/go.mod h1:6uAu0+H2lHkwdGsAY+j2wHPNPpPoeg5AaEFh9FlA+Zs= -github.com/go-audio/riff v1.0.0/go.mod h1:l3cQwc85y79NQFCRB7TiPoNiaijp6q8Z0Uv38rVG498= -github.com/go-audio/wav v1.0.0/go.mod h1:3yoReyQOsiARkvPl3ERCi8JFjihzG6WhjYpZCf5zAWE= -github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= -github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= -github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= -github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY= -github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hajimehoshi/go-mp3 v0.3.0/go.mod h1:qMJj/CSDxx6CGHiZeCgbiq2DSUkbK0UbtXShQcnfyMM= -github.com/hajimehoshi/oto v0.6.1/go.mod h1:0QXGEkbuJRohbJaxr7ZQSxnju7hEhseiPx2hrh6raOI= -github.com/hajimehoshi/oto v0.7.1 h1:I7maFPz5MBCwiutOrz++DLdbr4rTzBsbBuV2VpgU9kk= -github.com/hajimehoshi/oto v0.7.1/go.mod h1:wovJ8WWMfFKvP587mhHgot/MBr4DnNy9m6EepeVGnos= -github.com/icza/bitio v1.0.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A= -github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBDIWGCdTt54nHt6EeI639SmHycLYL7FkA= -github.com/jfreymuth/oggvorbis v1.0.1 h1:NT0eXBgE2WHzu6RT/6zcb2H10Kxj6Fm3PccT0LE6bqw= -github.com/jfreymuth/oggvorbis v1.0.1/go.mod h1:NqS+K+UXKje0FUYUPosyQ+XTVvjmVjps1aEZH1sumIk= -github.com/jfreymuth/vorbis v1.0.0 h1:SmDf783s82lIjGZi8EGUUaS7YxPHgRj4ZXW/h7rUi7U= -github.com/jfreymuth/vorbis v1.0.0/go.mod h1:8zy3lUAm9K/rJJk223RKy6vjCZTWC61NA2QD06bfOE0= -github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o= -github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs= -github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= -github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= -github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M= -github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/jozsefsallai/gophersauce v1.0.1 h1:BA3ovtQRrAb1qYU9JoRLbDHpxnDunlNcEkEfhCvDDCM= -github.com/jozsefsallai/gophersauce v1.0.1/go.mod h1:YVEI7djliMTmZ1Vh01YPF8bUHi+oKhe3yXgKf1T49vg= -github.com/kanrichan/resvg-go v0.0.2-0.20231001163256-63db194ca9f5 h1:BXnB1Gz4y/zwQh+ZFNy7rgd+ZfMOrwRr4uZSHEI+ieY= -github.com/kanrichan/resvg-go v0.0.2-0.20231001163256-63db194ca9f5/go.mod h1:c9+VS9GaommgIOzNWb5ze4lYwfT8BZ2UDyGiuQTT7yc= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4= -github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lithammer/fuzzysearch v1.1.8 h1:/HIuJnjHuXS8bKaiTMeeDlW2/AyIWk2brx1V8LFgLN4= -github.com/lithammer/fuzzysearch v1.1.8/go.mod h1:IdqeyBClc3FFqSzYq/MXESsS4S0FsZ5ajtkr5xPLts4= -github.com/liuzl/cedar-go v0.0.0-20170805034717-80a9c64b256d h1:qSmEGTgjkESUX5kPMSGJ4pcBUtYVDdkNzMrjQyvRvp0= -github.com/liuzl/cedar-go v0.0.0-20170805034717-80a9c64b256d/go.mod h1:x7SghIWwLVcJObXbjK7S2ENsT1cAcdJcPl7dRaSFog0= -github.com/liuzl/da v0.0.0-20180704015230-14771aad5b1d h1:hTRDIpJ1FjS9ULJuEzu69n3qTgc18eI+ztw/pJv47hs= -github.com/liuzl/da v0.0.0-20180704015230-14771aad5b1d/go.mod h1:7xD3p0XnHvJFQ3t/stEJd877CSIMkH/fACVWen5pYnc= -github.com/liuzl/gocc v0.0.0-20231231122217-0372e1059ca5 h1:wnbHIeP1UX8ClYEWKGnw66PfYvReCHu9G5lXSte3Sqc= -github.com/liuzl/gocc v0.0.0-20231231122217-0372e1059ca5/go.mod h1:7KaV9YIR92M1FpbczAcfYQ3UZ5ayT27pNtunDmXvLBo= -github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= -github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= -github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA= -github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= -github.com/mewkiz/flac v1.0.7/go.mod h1:yU74UH277dBUpqxPouHSQIar3G1X/QIclVbFahSd1pU= -github.com/mewkiz/pkg v0.0.0-20190919212034-518ade7978e2/go.mod h1:3E2FUC/qYUfM8+r9zAwpeHJzqRVVMIYnpzD/clwWxyA= -github.com/mroth/weightedrand v1.0.0 h1:V8JeHChvl2MP1sAoXq4brElOcza+jxLkRuwvtQu8L3E= -github.com/mroth/weightedrand v1.0.0/go.mod h1:3p2SIcC8al1YMzGhAIoXD+r9olo/g/cdJgAD905gyNE= -github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= -github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= -github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= -github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= -github.com/notnil/chess v1.9.0 h1:YMxR5kUVjtwcuFptGU0/3q7eG3MSHQNbg0VUekvRKV0= -github.com/notnil/chess v1.9.0/go.mod h1:cRuJUIBFq9Xki05TWHJxHYkC+fFpq45IWwk94DdlCrA= -github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= -github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkumza/numcn v1.0.0 h1:ZT5cf9IJkUZgRgEtCiNNykk0RwsrKXSTsvDHOwUTzgE= -github.com/pkumza/numcn v1.0.0/go.mod h1:QSeH+al9dWCd8di5HZM/ZqHqhZmUKfph572e9Ev/ETc= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= -github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= -github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/shirou/gopsutil/v3 v3.24.4 h1:dEHgzZXt4LMNm+oYELpzl9YCqV65Yr/6SfrvgRBtXeU= -github.com/shirou/gopsutil/v3 v3.24.4/go.mod h1:lTd2mdiOspcqLgAnr9/nGi71NkeMpWKdmhuxm9GusH8= -github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM= -github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= -github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU= -github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= -github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= -github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/tetratelabs/wazero v1.5.0 h1:Yz3fZHivfDiZFUXnWMPUoiW7s8tC1sjdBtlJn08qYa0= -github.com/tetratelabs/wazero v1.5.0/go.mod h1:0U0G41+ochRKoPKCJlh0jMg1CHkyfK8kDqiirMmKY8A= -github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U= -github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= -github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= -github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= -github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= -github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= -github.com/wcharczuk/go-chart/v2 v2.1.1 h1:2u7na789qiD5WzccZsFz4MJWOJP72G+2kUuJoSNqWnE= -github.com/wcharczuk/go-chart/v2 v2.1.1/go.mod h1:CyCAUt2oqvfhCl6Q5ZvAZwItgpQKZOkCJGb+VGv6l14= -github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240627150749-3ff3d73940da h1:VDoA8sK4unUQIscev0k+flDFqgyZ8HNdEm9QO8xLKYg= -github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240627150749-3ff3d73940da/go.mod h1:J6uHaXS/Am2VsLxF9TcU6il19PbOeC4SvgxHJ1E2jaE= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= -github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -gitlab.com/gomidi/midi/v2 v2.1.7 h1:lIjVXH+bnGG04j/kUVOFILt0BQvBeGz8Kyz0l6aM830= -gitlab.com/gomidi/midi/v2 v2.1.7/go.mod h1:Cj6K9VH5GhYvPgL2JddxHBmZiP3nxKxB5XyTxiXvL9U= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8 h1:idBdZTd9UioThJp8KpM/rTSinK/ChZFBE43/WtIy8zg= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/image v0.0.0-20190220214146-31aff87c08e9/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.11.0/go.mod h1:bglhjqbqVuEb9e9+eNR45Jfu7D+T4Qan+NhQk8Ck2P8= -golang.org/x/image v0.16.0 h1:9kloLAKhUufZhA12l5fwnx2NZW39/we1UhBesW433jw= -golang.org/x/image v0.16.0/go.mod h1:ugSZItdV4nOxyqp56HmXwH0Ry0nBCpjnZdpDaIHdoPs= -golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6 h1:vyLBGJPIl9ZYbcQFM2USFmJBK6KI+t+z6jL0lbwjrnc= -golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= -golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190429190828-d89cdac9e872/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -modernc.org/cc/v4 v4.21.2 h1:dycHFB/jDc3IyacKipCNSDrjIC0Lm1hyoWOZTRR20Lk= -modernc.org/ccgo/v4 v4.17.8 h1:yyWBf2ipA0Y9GGz/MmCmi3EFpKgeS7ICrAFes+suEbs= -modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE= -modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw= -modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= -modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= -modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E= -modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU= -modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= -modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc= -modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= -modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= From c2bf903bc47b7ed7b3d8b53267fd61a87f330e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 4 Aug 2024 00:09:40 +0800 Subject: [PATCH 04/58] Delete plugin/go.mod --- plugin/go.mod | 101 -------------------------------------------------- 1 file changed, 101 deletions(-) delete mode 100644 plugin/go.mod diff --git a/plugin/go.mod b/plugin/go.mod deleted file mode 100644 index 8036d343d0..0000000000 --- a/plugin/go.mod +++ /dev/null @@ -1,101 +0,0 @@ -module github.com/FloatTech/ZeroBot-Plugin - -go 1.20 - -require ( - github.com/Baidu-AIP/golang-sdk v1.1.1 - github.com/FloatTech/AnimeAPI v1.7.1-0.20240530072450-71c23d2f01f8 - github.com/FloatTech/floatbox v0.0.0-20240505082030-226ec6713e14 - github.com/FloatTech/gg v1.1.3-0.20230226151425-6ea91286ba08 - github.com/FloatTech/imgfactory v0.2.2-0.20230413152719-e101cc3606ef - github.com/FloatTech/rendercard v0.0.10-0.20230223064326-45d29fa4ede9 - github.com/FloatTech/sqlite v1.6.3 - github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 - github.com/FloatTech/zbpctrl v1.6.1 - github.com/FloatTech/zbputils v1.7.2-0.20240530064059-af6f6773ba94 - github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7 - github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5 - github.com/antchfx/htmlquery v1.3.1 - github.com/corona10/goimagehash v1.1.0 - github.com/davidscholberg/go-durationfmt v0.0.0-20170122144659-64843a2083d3 - github.com/disintegration/imaging v1.6.2 - github.com/fumiama/ahsai v0.1.0 - github.com/fumiama/cron v1.3.0 - github.com/fumiama/go-base16384 v1.7.0 - github.com/fumiama/go-registry v0.2.7 - github.com/fumiama/gotracemoe v0.0.3 - github.com/fumiama/jieba v0.0.0-20221203025406-36c17a10b565 - github.com/fumiama/terasu v0.0.0-20240507144117-547a591149c0 - github.com/fumiama/unibase2n v0.0.0-20240530074540-ec743fd5a6d6 - github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 - github.com/jinzhu/gorm v1.9.16 - github.com/jozsefsallai/gophersauce v1.0.1 - github.com/kanrichan/resvg-go v0.0.2-0.20231001163256-63db194ca9f5 - github.com/lithammer/fuzzysearch v1.1.8 - github.com/liuzl/gocc v0.0.0-20231231122217-0372e1059ca5 - github.com/mroth/weightedrand v1.0.0 - github.com/notnil/chess v1.9.0 - github.com/pkg/errors v0.9.1 - github.com/shirou/gopsutil/v3 v3.24.4 - github.com/shopspring/decimal v1.4.0 - github.com/sirupsen/logrus v1.9.3 - github.com/tidwall/gjson v1.17.1 - github.com/wcharczuk/go-chart/v2 v2.1.1 - github.com/wdvxdr1123/ZeroBot v1.7.5-0.20240627150749-3ff3d73940da - gitlab.com/gomidi/midi/v2 v2.1.7 - golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8 - golang.org/x/image v0.16.0 - golang.org/x/sys v0.20.0 - golang.org/x/text v0.15.0 - gopkg.in/yaml.v3 v3.0.1 -) - -require ( - github.com/adamzy/cedar-go v0.0.0-20170805034717-80a9c64b256d // indirect - github.com/ajstarks/svgo v0.0.0-20200320125537-f189e35d30ca // indirect - github.com/antchfx/xpath v1.3.0 // indirect - github.com/blend/go-sdk v1.20220411.3 // indirect - github.com/dustin/go-humanize v1.0.1 // indirect - github.com/ericpauley/go-quantize v0.0.0-20200331213906-ae555eb2afa4 // indirect - github.com/faiface/beep v1.1.0 // indirect - github.com/fumiama/go-simple-protobuf v0.2.0 // indirect - github.com/fumiama/gofastTEA v0.0.10 // indirect - github.com/fumiama/imgsz v0.0.4 // indirect - github.com/gabriel-vasile/mimetype v1.0.4 // indirect - github.com/go-ole/go-ole v1.2.6 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/hajimehoshi/oto v0.7.1 // indirect - github.com/jfreymuth/oggvorbis v1.0.1 // indirect - github.com/jfreymuth/vorbis v1.0.0 // indirect - github.com/jinzhu/inflection v1.0.0 // indirect - github.com/kr/text v0.2.0 // indirect - github.com/liuzl/cedar-go v0.0.0-20170805034717-80a9c64b256d // indirect - github.com/liuzl/da v0.0.0-20180704015230-14771aad5b1d // indirect - github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/ncruces/go-strftime v0.1.9 // indirect - github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect - github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect - github.com/pkumza/numcn v1.0.0 // indirect - github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect - github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect - github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/shoenig/go-m1cpu v0.1.6 // indirect - github.com/tetratelabs/wazero v1.5.0 // indirect - github.com/tidwall/match v1.1.1 // indirect - github.com/tidwall/pretty v1.2.0 // indirect - github.com/tklauser/go-sysconf v0.3.12 // indirect - github.com/tklauser/numcpus v0.6.1 // indirect - github.com/yusufpapurcu/wmi v1.2.4 // indirect - golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6 // indirect - golang.org/x/net v0.24.0 // indirect - modernc.org/libc v1.49.3 // indirect - modernc.org/mathutil v1.6.0 // indirect - modernc.org/memory v1.8.0 // indirect - modernc.org/sqlite v1.20.0 // indirect -) - -replace modernc.org/sqlite => github.com/fumiama/sqlite3 v1.29.10-simp - -replace modernc.org/libc => github.com/fumiama/libc v0.0.0-20240530081950-6f6d8586b5c5 From 02500b8049e5657266b14acc2c5a87cc60506594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 4 Aug 2024 09:28:07 +0800 Subject: [PATCH 05/58] Update main.go --- plugin/niuniu/main.go | 45 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 8e51ae854e..89459438e1 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -46,7 +46,7 @@ func init() { ctx.SendChain(message.Text("ERROR: ", err)) return } - var m []UserInfo + var m []userInfo for _, info := range niuniuList { if info.Long > 0 { m = append(m, info) @@ -57,8 +57,8 @@ func init() { } var messages string userInfos := sortUsersByNegativeLong(m) - for i, userInfo := range userInfos { - messages += fmt.Sprintf("第%d名 长度:%.2f\n", i+1, userInfo.Long) + for i, user := range userInfos { + messages += fmt.Sprintf("第%d名 id:%s 长度:%.2fcom\n", i+1, ctx.CardOrNickName(user.Uid), user.Long) } ctx.SendChain(message.Text(messages)) }) @@ -69,7 +69,7 @@ func init() { ctx.SendChain(message.Text("ERROR: ", err)) return } - var m []UserInfo + var m []userInfo for _, info := range niuniuList { if info.Long <= 0 { m = append(m, info) @@ -80,15 +80,15 @@ func init() { } var messages string userInfos := sortUsersByNegativeLong(m) - for i, userInfo := range userInfos { - messages += fmt.Sprintf("第%d名 长度:%.2f\n", i+1, userInfo.Long) + for i, user := range userInfos { + messages += fmt.Sprintf("第%d名 id:%s 长度:%.2fcom\n", i+1, ctx.CardOrNickName(user.Uid), user.Long) } ctx.SendChain(message.Text(messages)) }) en.OnFullMatch("查看我的牛牛", getdb, zero.OnlyGroup).SetBlock(false).Handle(func(ctx *zero.Ctx) { uid := ctx.Event.UserID gid := ctx.Event.GroupID - niuniu, err := db.Findniuniu(gid, uid) + niuniu, err := db.findniuniu(gid, uid) if err != nil { ctx.SendChain(message.Text("ta还没有牛牛呢不能查看!")) return @@ -160,7 +160,7 @@ func init() { // 获取群号和用户ID gid := ctx.Event.GroupID uid := ctx.Event.UserID - niuniu, err := db.Findniuniu(gid, uid) + niuniu, err := db.findniuniu(gid, uid) if err != nil { ctx.SendChain(message.Text("请先注册牛牛!")) return @@ -219,12 +219,12 @@ func init() { }[rand.Intn(3)])) } } - u := UserInfo{ + u := userInfo{ Uid: uid, Long: niuniu, Id: 1, } - if err = db.Insertniuniu(u, gid); err != nil { + if err = db.insertniuniu(u, gid); err != nil { ctx.SendChain(message.Text("ERROR:", err)) return } @@ -237,27 +237,26 @@ func init() { en.OnFullMatch("注册牛牛", zero.OnlyGroup, getdb).SetBlock(false).Handle(func(ctx *zero.Ctx) { gid := ctx.Event.GroupID uid := ctx.Event.UserID - if _, err := db.Findniuniu(gid, uid); err == nil { + if _, err := db.findniuniu(gid, uid); err == nil { ctx.SendChain(message.Text("你已经注册过了")) return } //获取初始长度 long, _ := randomLong().Float64() - u := UserInfo{ + u := userInfo{ Uid: uid, Long: long, Id: 1, } //添加数据进入表 - err := db.Insertniuniu(u, gid) + err := db.insertniuniu(u, gid) if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) - err = db.CreateGidTable(gid) + err = db.createGidTable(gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return } - err = db.Insertniuniu(u, gid) + err = db.insertniuniu(u, gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return @@ -274,12 +273,12 @@ func init() { } uid := ctx.Event.UserID gid := ctx.Event.GroupID - myniuniu, err := db.Findniuniu(gid, uid) + myniuniu, err := db.findniuniu(gid, uid) if err != nil { ctx.SendChain(message.Text("你还没有牛牛快去注册一个吧!")) return } - adduserniuniu, err := db.Findniuniu(gid, adduser) + adduserniuniu, err := db.findniuniu(gid, adduser) if err != nil { ctx.SendChain(message.At(uid), message.Text("对方还没有牛牛呢,不能🤺")) return @@ -313,12 +312,12 @@ func init() { return } fencingResult, f := fencing(myniuniu, adduserniuniu) - err = db.Insertniuniu(UserInfo{Uid: uid, Long: f}, gid) + err = db.insertniuniu(userInfo{Uid: uid, Long: f}, gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return } - err = db.Insertniuniu(UserInfo{Uid: adduser, Long: -f}, gid) + err = db.insertniuniu(userInfo{Uid: adduser, Long: -f}, gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return @@ -335,12 +334,12 @@ func init() { en.OnFullMatch("注销牛牛", getdb, zero.OnlyGroup).SetBlock(false).Handle(func(ctx *zero.Ctx) { uid := ctx.Event.UserID gid := ctx.Event.GroupID - _, err := db.Findniuniu(gid, uid) + _, err := db.findniuniu(gid, uid) if err != nil { ctx.SendChain(message.Text("你还没有牛牛呢,不能注销")) return } - err = db.Deleteniuniu(gid, uid) + err = db.deleteniuniu(gid, uid) if err != nil { ctx.SendChain(message.Text("注销失败")) return @@ -354,7 +353,7 @@ func RandomChoice(options []string) string { } // sortUsersByNegativeLong 接收一个UserInfo切片,并按Long字段负数越大(绝对值越小)排序后返回 -func sortUsersByNegativeLong(users []UserInfo) []UserInfo { +func sortUsersByNegativeLong(users []userInfo) []userInfo { sort.Slice(users, func(i, j int) bool { return users[i].Long > users[j].Long }) From 667f9e101cd9a27ca9b407d3aefd2c5372065cd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 4 Aug 2024 09:28:36 +0800 Subject: [PATCH 06/58] Update model.go --- plugin/niuniu/model.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/plugin/niuniu/model.go b/plugin/niuniu/model.go index 80ac152f9f..93dacf678c 100644 --- a/plugin/niuniu/model.go +++ b/plugin/niuniu/model.go @@ -10,19 +10,19 @@ import ( "time" ) -type Model struct { +type model struct { sql *sql.Sqlite sync.RWMutex } -type UserInfo struct { +type userInfo struct { Uid int64 Long float64 Id int } var ( - db = &Model{sql: &sql.Sqlite{}} + db = &model{sql: &sql.Sqlite{}} getdb = fcext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool { db.sql.DBPath = en.DataFolder() + "niuniu.db" err := db.sql.Open(time.Hour * 24) @@ -34,43 +34,43 @@ var ( }) ) -func (db *Model) CreateGidTable(gid int64) error { +func (db *model) createGidTable(gid int64) error { db.Lock() defer db.Unlock() - return db.sql.Create(strconv.FormatInt(gid, 10), &UserInfo{}) + return db.sql.Create(strconv.FormatInt(gid, 10), &userInfo{}) } -func (db *Model) Findniuniu(gid, uid int64) (float64, error) { +func (db *model) findniuniu(gid, uid int64) (float64, error) { db.RLock() defer db.RUnlock() - u := UserInfo{} + u := userInfo{} err := db.sql.Find(strconv.FormatInt(gid, 10), &u, "where Uid = "+strconv.FormatInt(uid, 10)) return u.Long, err } -func (db *Model) Insertniuniu(u UserInfo, gid int64) error { +func (db *model) insertniuniu(u userInfo, gid int64) error { db.Lock() defer db.Unlock() return db.sql.Insert(strconv.FormatInt(gid, 10), &u) } -func (db *Model) Deleteniuniu(gid, uid int64) error { +func (db *model) deleteniuniu(gid, uid int64) error { db.Lock() defer db.Unlock() return db.sql.Del(strconv.FormatInt(gid, 10), "where Uid = "+strconv.FormatInt(uid, 10)) } -func (db *Model) readAllTable(gid int64) ([]UserInfo, error) { +func (db *model) readAllTable(gid int64) ([]userInfo, error) { db.Lock() defer db.Unlock() - a, err := sql.FindAll[UserInfo](db.sql, strconv.FormatInt(gid, 10), "where Id = 1") + a, err := sql.FindAll[userInfo](db.sql, strconv.FormatInt(gid, 10), "where Id = 1") slice := convertSocialHostInfoPointersToSlice(a) return slice, err } // 返回一个不是指针类型的切片 -func convertSocialHostInfoPointersToSlice(pointers []*UserInfo) []UserInfo { - var slice []UserInfo +func convertSocialHostInfoPointersToSlice(pointers []*userInfo) []userInfo { + var slice []userInfo for _, ptr := range pointers { if ptr != nil { slice = append(slice, *ptr) From 97be553f19f81d141f1d99d0fe5e67c15fe7560a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 4 Aug 2024 09:29:17 +0800 Subject: [PATCH 07/58] Update main.go --- plugin/niuniu/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 89459438e1..80d1871a84 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -21,9 +21,9 @@ var ( Brief: "牛牛大作战", Help: "- 打胶" + "- 查看我的牛牛" + - "jj@xxx" + - "牛子长度排行" + - "牛子深度排行", + "- jj@xxx" + + "- 牛子长度排行" + + "- 牛子深度排行", PrivateDataFolder: "niuniu", }) ) From a7d3fc976389871772b8cd180e9022c25d301a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 4 Aug 2024 09:40:41 +0800 Subject: [PATCH 08/58] Update main.go --- plugin/niuniu/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 80d1871a84..461b73d727 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -348,7 +348,7 @@ func init() { }) } -func RandomChoice(options []string) string { +func randomChoice(options []string) string { return options[rand.Intn(len(options))] } From e048296198aaa38343e556a022ecb04449c58519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 4 Aug 2024 14:49:32 +0800 Subject: [PATCH 09/58] Update main.go --- plugin/niuniu/main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 461b73d727..3e97ee5121 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -19,11 +19,11 @@ var ( en = control.Register("niuniu", &ctrl.Options[*zero.Ctx]{ DisableOnDefault: false, Brief: "牛牛大作战", - Help: "- 打胶" + - "- 查看我的牛牛" + - "- jj@xxx" + - "- 牛子长度排行" + - "- 牛子深度排行", + Help: "- 打胶\n" + + "- 查看我的牛牛\n" + + "- jj@xxx\n" + + "- 牛子长度排行\n" + + "- 牛子深度排行\n", PrivateDataFolder: "niuniu", }) ) From 699b80cc7cb308b0a84815bd40cb21fc0465d429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 4 Aug 2024 15:48:43 +0800 Subject: [PATCH 10/58] Update result.go --- plugin/niuniu/result.go | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/plugin/niuniu/result.go b/plugin/niuniu/result.go index 5a8324aec9..92700baae9 100644 --- a/plugin/niuniu/result.go +++ b/plugin/niuniu/result.go @@ -8,7 +8,7 @@ import ( ) // fencing 击剑对决逻辑,返回对决结果和myLength的变化值 -func fencing(myLength, oppoLength float64) (string, float64) { +func fencing(myLength, oppoLength float64) (string, float64, float64) { lossLimit := 0.25 devourLimit := 0.27 @@ -19,25 +19,24 @@ func fencing(myLength, oppoLength float64) (string, float64) { oppoLength *= 0.85 change := -math.Min(math.Abs(lossLimit*myLength), math.Abs(1.5*myLength)) myLength += change - return fmt.Sprintf("对方身为魅魔诱惑了你,你同化成魅魔!当前长度%.2fcm!", myLength), change - + return fmt.Sprintf("对方身为魅魔诱惑了你,你同化成魅魔!当前长度%.2fcm!", myLength), myLength, oppoLength case oppoLength >= 100 && myLength > 0 && 10 < probability && probability <= 20: oppoLength *= 0.85 change := -math.Min(math.Abs(devourLimit*myLength), math.Abs(1.5*myLength)) myLength += change - return fmt.Sprintf("对方以牛头人的荣誉摧毁了你的牛牛!当前长度%.2fcm!", myLength), change + return fmt.Sprintf("对方以牛头人的荣誉摧毁了你的牛牛!当前长度%.2fcm!", myLength), myLength, oppoLength case myLength <= -100 && oppoLength > 0 && 10 < probability && probability <= 20: myLength *= 0.85 change := math.Min(math.Abs(lossLimit*oppoLength), math.Abs(1.5*oppoLength)) oppoLength -= change - return fmt.Sprintf("你身为魅魔诱惑了对方,吞噬了对方部分长度!当前长度%.2fcm!", myLength), change + return fmt.Sprintf("你身为魅魔诱惑了对方,吞噬了对方部分长度!当前长度%.2fcm!", myLength), myLength, oppoLength case myLength >= 100 && oppoLength > 0 && 10 < probability && probability <= 20: myLength *= 0.85 change := math.Min(math.Abs(devourLimit*oppoLength), math.Abs(1.5*oppoLength)) - oppoLength -= change - return fmt.Sprintf("你以牛头人的荣誉摧毁了对方的牛牛!当前长度%.2fcm!", myLength), change + oppoLength += change + return fmt.Sprintf("你以牛头人的荣誉摧毁了对方的牛牛!当前长度%.2fcm!", myLength), myLength, oppoLength default: return determineResultBySkill(myLength, oppoLength) @@ -45,7 +44,7 @@ func fencing(myLength, oppoLength float64) (string, float64) { } // determineResultBySkill 根据击剑技巧决定结果 -func determineResultBySkill(myLength, oppoLength float64) (string, float64) { +func determineResultBySkill(myLength, oppoLength float64) (string, float64, float64) { probability := rand.Intn(100) + 1 winProbability := calculateWinProbability(myLength, oppoLength) * 100 @@ -67,34 +66,30 @@ func calculateWinProbability(heightA, heightB float64) float64 { } // applySkill 应用击剑技巧并生成结果 -func applySkill(myLength, oppoLength float64, increaseLength1 bool) (string, float64) { - reduce := fence(oppoLength) - var change float64 +func applySkill(myLength, oppoLength float64, increaseLength1 bool) (string, float64, float64) { + reduce := fence() if increaseLength1 { myLength += reduce oppoLength -= 0.8 * reduce - change = reduce if myLength < 0 { - return fmt.Sprintf("哦吼!?你的牛牛在长大欸!长大了%.2fcm!", reduce), change + return fmt.Sprintf("哦吼!?你的牛牛在长大欸!长大了%.2fcm!", reduce), myLength, oppoLength } - return fmt.Sprintf("你以绝对的长度让对方屈服了呢!你的长度增加%.2fcm,当前长度%.2fcm!", reduce, myLength), change + return fmt.Sprintf("你以绝对的长度让对方屈服了呢!你的长度增加%.2fcm,当前长度%.2fcm!", reduce, myLength), myLength, oppoLength } else { myLength -= reduce oppoLength += 0.8 * reduce - change = -reduce - if myLength < 0 { - return fmt.Sprintf("哦吼!?看来你的牛牛因为击剑而凹进去了呢🤣🤣🤣!凹进去了%.2fcm!", reduce), change + return fmt.Sprintf("哦吼!?看来你的牛牛因为击剑而凹进去了呢🤣🤣🤣!凹进去了%.2fcm!", reduce), myLength, oppoLength } - return fmt.Sprintf("对方以绝对的长度让你屈服了呢!你的长度减少%.2fcm,当前长度%.2fcm!", reduce, myLength), change + return fmt.Sprintf("对方以绝对的长度让你屈服了呢!你的长度减少%.2fcm,当前长度%.2fcm!", reduce, myLength), myLength, oppoLength } } // fence 简单模拟击剑技巧效果 -func fence(oppoLength float64) float64 { +func fence() float64 { return float64(rand.Intn(5)+1) + rand.Float64() } From 9da476f2d7ea8cba301664b9018ccbf6ca32c5d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 4 Aug 2024 15:49:14 +0800 Subject: [PATCH 11/58] Update main.go --- plugin/niuniu/main.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 3e97ee5121..56f962a68a 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -20,6 +20,8 @@ var ( DisableOnDefault: false, Brief: "牛牛大作战", Help: "- 打胶\n" + + "- 注册牛牛\n" + + "- 注销牛牛\n" + "- 查看我的牛牛\n" + "- jj@xxx\n" + "- 牛子长度排行\n" + @@ -107,44 +109,44 @@ func init() { case niuniu <= -50: result += "嗯....好像已经穿过了身体吧..从另一面来看也可以算是凸出来的吧?" case niuniu <= -25: - result += RandomChoice([]string{ + result += randomChoice([]string{ "这名女生,你的身体很健康哦!", "WOW,真的凹进去了好多呢!", "你已经是我们女孩子的一员啦!", }) case niuniu <= -10: - result += RandomChoice([]string{ + result += randomChoice([]string{ "你已经是一名女生了呢,", "从女生的角度来说,你发育良好(,", "你醒啦?你已经是一名女孩子啦!", "唔...可以放进去一根手指了都...", }) case niuniu <= 0: - result += RandomChoice([]string{ + result += randomChoice([]string{ "安了安了,不要伤心嘛,做女生有什么不好的啊。", "不哭不哭,摸摸头,虽然很难再长出来,但是请不要伤心啦啊!", "加油加油!我看好你哦!", "你醒啦?你现在已经是一名女孩子啦!", }) case niuniu <= 10: - result += RandomChoice([]string{ + result += randomChoice([]string{ "你行不行啊?细狗!", "虽然短,但是小小的也很可爱呢。", "像一只蚕宝宝。", "长大了。", }) case niuniu <= 25: - result += RandomChoice([]string{ + result += randomChoice([]string{ "唔...没话说", "已经很长了呢!", }) case niuniu <= 50: - result += RandomChoice([]string{ + result += randomChoice([]string{ "话说这种真的有可能吗?", "厚礼谢!", }) case niuniu <= 100: - result += RandomChoice([]string{ + result += randomChoice([]string{ "已经突破天际了嘛...", "唔...这玩意应该不会变得比我高吧?", "你这个长度会死人的...!", @@ -311,13 +313,13 @@ func init() { ctx.SendChain(message.Text("你要和谁🤺?你自己吗?")) return } - fencingResult, f := fencing(myniuniu, adduserniuniu) + fencingResult, f, f1 := fencing(myniuniu, adduserniuniu) err = db.insertniuniu(userInfo{Uid: uid, Long: f}, gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return } - err = db.insertniuniu(userInfo{Uid: adduser, Long: -f}, gid) + err = db.insertniuniu(userInfo{Uid: adduser, Long: f1}, gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return @@ -336,7 +338,7 @@ func init() { gid := ctx.Event.GroupID _, err := db.findniuniu(gid, uid) if err != nil { - ctx.SendChain(message.Text("你还没有牛牛呢,不能注销")) + ctx.SendChain(message.Text("你还没有牛牛呢,咋的你想凭空造一个啊")) return } err = db.deleteniuniu(gid, uid) @@ -344,7 +346,7 @@ func init() { ctx.SendChain(message.Text("注销失败")) return } - ctx.SendChain(message.Text("注销成功")) + ctx.SendChain(message.Text("注销成功,你已经没有牛牛了")) }) } From 2a913e00a44ff0e7543444b9b9ac2faebc783341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 11 Aug 2024 10:46:43 +0800 Subject: [PATCH 12/58] Update main.go --- plugin/niuniu/main.go | 95 ++++++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 41 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 56f962a68a..07fd672980 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -11,12 +11,13 @@ import ( "math" "sort" "strconv" + "strings" "sync" "time" ) var ( - en = control.Register("niuniu", &ctrl.Options[*zero.Ctx]{ + en = control.AutoRegister(&ctrl.Options[*zero.Ctx]{ DisableOnDefault: false, Brief: "牛牛大作战", Help: "- 打胶\n" + @@ -41,7 +42,7 @@ var lock sync.RWMutex var jjLimitMap = make(map[userLimit]*time.Time) func init() { - en.OnFullMatch("牛子长度排行", zero.OnlyGroup, getdb).SetBlock(false).Handle(func(ctx *zero.Ctx) { + en.OnFullMatch("牛子长度排行", zero.OnlyGroup, getdb).SetBlock(true).Handle(func(ctx *zero.Ctx) { gid := ctx.Event.GroupID niuniuList, err := db.readAllTable(gid) if err != nil { @@ -50,21 +51,24 @@ func init() { } var m []userInfo for _, info := range niuniuList { - if info.Long > 0 { - m = append(m, info) + if info.Length > 0 { + m = append(m, *info) } } if m == nil { ctx.SendChain(message.Text("暂时没有男孩子哦")) + return } - var messages string + var messages strings.Builder + messages.WriteString("牛子长度排行\n") userInfos := sortUsersByNegativeLong(m) for i, user := range userInfos { - messages += fmt.Sprintf("第%d名 id:%s 长度:%.2fcom\n", i+1, ctx.CardOrNickName(user.Uid), user.Long) + messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcom\n", i+1, + ctx.CardOrNickName(user.Uid), user.Length)) } ctx.SendChain(message.Text(messages)) }) - en.OnFullMatch("牛子深度排行", zero.OnlyGroup, getdb).SetBlock(false).Handle(func(ctx *zero.Ctx) { + en.OnFullMatch("牛子深度排行", zero.OnlyGroup, getdb).SetBlock(true).Handle(func(ctx *zero.Ctx) { gid := ctx.Event.GroupID niuniuList, err := db.readAllTable(gid) if err != nil { @@ -73,26 +77,30 @@ func init() { } var m []userInfo for _, info := range niuniuList { - if info.Long <= 0 { - m = append(m, info) + if info.Length <= 0 { + m = append(m, *info) } } if m == nil { ctx.SendChain(message.Text("暂时没有女孩子哦")) + return } - var messages string + var messages strings.Builder userInfos := sortUsersByNegativeLong(m) + messages.WriteString("牛牛深度排行榜\n") for i, user := range userInfos { - messages += fmt.Sprintf("第%d名 id:%s 长度:%.2fcom\n", i+1, ctx.CardOrNickName(user.Uid), user.Long) + messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcom\n", i+1, + ctx.CardOrNickName(user.Uid), user.Length)) } ctx.SendChain(message.Text(messages)) }) - en.OnFullMatch("查看我的牛牛", getdb, zero.OnlyGroup).SetBlock(false).Handle(func(ctx *zero.Ctx) { + + en.OnFullMatch("查看我的牛牛", getdb, zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) { uid := ctx.Event.UserID gid := ctx.Event.GroupID niuniu, err := db.findniuniu(gid, uid) if err != nil { - ctx.SendChain(message.Text("ta还没有牛牛呢不能查看!")) + ctx.SendChain(message.Text("你还没有牛牛呢不能查看!")) return } var result string @@ -158,7 +166,7 @@ func init() { } ctx.SendChain(message.At(uid), message.Text(result)) }) - en.OnFullMatchGroup([]string{"打胶"}, zero.OnlyGroup, getdb).SetBlock(false).Handle(func(ctx *zero.Ctx) { + en.OnFullMatchGroup([]string{"dj", "打胶"}, zero.OnlyGroup, getdb).SetBlock(true).Handle(func(ctx *zero.Ctx) { // 获取群号和用户ID gid := ctx.Event.GroupID uid := ctx.Event.UserID @@ -175,12 +183,14 @@ func init() { if t, ok := dajiaoLimitMap[userLimit{gid: gid, uid: uid}]; ok { timePass = int64(time.Since(t.Local()).Seconds()) if timePass < 90 { - ctx.SendChain(message.Text([]string{ + r := rand.Intn(4) + messages1 := []string{ fmt.Sprintf("才过去了%ds时间,你就又要打🦶了,身体受得住吗", timePass), fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 90-timePass), fmt.Sprintf("休息一下吧,会炸膛的!%ds后再来吧", 90-timePass), fmt.Sprintf("打咩哟,你的牛牛会爆炸的,休息%ds再来吧", 90-timePass), - }[rand.Intn(4)])) + } + ctx.SendChain(message.Text(messages1[r])) lock.RUnlock() return } else { @@ -196,47 +206,49 @@ func init() { switch { case probability <= 40: niuniu += reduce + r := rand.Intn(2) ctx.SendChain(message.Text([]string{ fmt.Sprintf("你嘿咻嘿咻一下,促进了牛牛发育,牛牛增加%.2fcm了呢!", reduce), fmt.Sprintf("你打了个舒服痛快的🦶呐,牛牛增加了%.2fcm呢!", reduce), - }[rand.Intn(2)])) + }[r])) case probability <= 60: + r := rand.Intn(2) ctx.SendChain(message.Text([]string{ "你打了个🦶,但是什么变化也没有,好奇怪捏~", "你的牛牛刚开始变长了,可过了一会又回来了,什么变化也没有,好奇怪捏~", - }[rand.Intn(2)])) + }[r])) default: niuniu -= reduce + r := rand.Intn(3) if niuniu < 0 { ctx.SendChain(message.Text([]string{ fmt.Sprintf("哦吼!?看来你的牛牛凹进去了%.2fcm呢!", reduce), fmt.Sprintf("你突发恶疾!你的牛牛凹进去了%.2fcm!", reduce), fmt.Sprintf("笑死,你因为打🦶过度导致牛牛凹进去了%.2fcm!🤣🤣🤣", reduce), - }[rand.Intn(3)])) + }[r])) } else { ctx.SendChain(message.Text([]string{ fmt.Sprintf("阿哦,你过度打🦶,牛牛缩短%.2fcm了呢!", reduce), fmt.Sprintf("你的牛牛变长了很多,你很激动地继续打🦶,然后牛牛缩短了%.2fcm呢!", reduce), fmt.Sprintf("小打怡情,大打伤身,强打灰飞烟灭!你过度打🦶,牛牛缩短了%.2fcm捏!", reduce), - }[rand.Intn(3)])) + }[r])) } } u := userInfo{ - Uid: uid, - Long: niuniu, - Id: 1, + Uid: uid, + Length: niuniu, + Id: 1, } if err = db.insertniuniu(u, gid); err != nil { ctx.SendChain(message.Text("ERROR:", err)) return } - t := time.Now() - dajiaoLimitMap[userLimit{ - gid: gid, - uid: uid, - }] = &t + timer := time.Now() + lock.Lock() + dajiaoLimitMap[userLimit{gid: gid, uid: uid}] = &timer + lock.Unlock() }) - en.OnFullMatch("注册牛牛", zero.OnlyGroup, getdb).SetBlock(false).Handle(func(ctx *zero.Ctx) { + en.OnFullMatch("注册牛牛", zero.OnlyGroup, getdb).SetBlock(true).Handle(func(ctx *zero.Ctx) { gid := ctx.Event.GroupID uid := ctx.Event.UserID if _, err := db.findniuniu(gid, uid); err == nil { @@ -244,11 +256,11 @@ func init() { return } //获取初始长度 - long, _ := randomLong().Float64() + long := db.randomLong().InexactFloat64() u := userInfo{ - Uid: uid, - Long: long, - Id: 1, + Uid: uid, + Length: long, + Id: 1, } //添加数据进入表 err := db.insertniuniu(u, gid) @@ -265,9 +277,9 @@ func init() { } } ctx.SendChain(message.Reply(ctx.Event.GroupID), - message.Text("注册成功,你的牛牛现在有", u.Long, "cm")) + message.Text("注册成功,你的牛牛现在有", u.Length, "cm")) }) - en.OnRegex(`jj\[CQ:at,qq=([0-9]+)\].*`, getdb, zero.OnlyGroup).SetBlock(false).Handle(func(ctx *zero.Ctx) { + en.OnRegex(`jj\[CQ:at,qq=([0-9]+)\].*`, getdb, zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) { adduser, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) @@ -288,15 +300,16 @@ func init() { var timePass int64 lock.RLock() if len(jjLimitMap) > 0 { - if t, ok := dajiaoLimitMap[userLimit{gid: gid, uid: uid}]; ok { + if t, ok := jjLimitMap[userLimit{gid: gid, uid: uid}]; ok { timePass = int64(time.Since(t.Local()).Seconds()) if timePass < 150 { + r := rand.Intn(4) ctx.SendChain(message.Text([]string{ fmt.Sprintf("才过去了%ds时间,你就又要击剑了,真是饥渴难耐啊", timePass), fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 150-timePass), fmt.Sprintf("你这种男同就应该被送去集中营!等待%ds再来吧", 150-timePass), fmt.Sprintf("打咩哟!你的牛牛会炸的,休息%ds再来吧", 150-timePass), - }[rand.Intn(4)])) + }[r])) lock.RUnlock() return } else { @@ -314,12 +327,12 @@ func init() { return } fencingResult, f, f1 := fencing(myniuniu, adduserniuniu) - err = db.insertniuniu(userInfo{Uid: uid, Long: f}, gid) + err = db.insertniuniu(userInfo{Uid: uid, Length: f}, gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return } - err = db.insertniuniu(userInfo{Uid: adduser, Long: f1}, gid) + err = db.insertniuniu(userInfo{Uid: adduser, Length: f1}, gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return @@ -333,7 +346,7 @@ func init() { }] = &t lock.Unlock() }) - en.OnFullMatch("注销牛牛", getdb, zero.OnlyGroup).SetBlock(false).Handle(func(ctx *zero.Ctx) { + en.OnFullMatch("注销牛牛", getdb, zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) { uid := ctx.Event.UserID gid := ctx.Event.GroupID _, err := db.findniuniu(gid, uid) @@ -357,7 +370,7 @@ func randomChoice(options []string) string { // sortUsersByNegativeLong 接收一个UserInfo切片,并按Long字段负数越大(绝对值越小)排序后返回 func sortUsersByNegativeLong(users []userInfo) []userInfo { sort.Slice(users, func(i, j int) bool { - return users[i].Long > users[j].Long + return int(math.Abs(users[i].Length)) > int(math.Abs(users[j].Length)) }) return users } From 25ebd17d8d16fa59681d4d594851f35d281ef20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 11 Aug 2024 10:47:25 +0800 Subject: [PATCH 13/58] Update model.go --- plugin/niuniu/model.go | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/plugin/niuniu/model.go b/plugin/niuniu/model.go index 93dacf678c..091a693318 100644 --- a/plugin/niuniu/model.go +++ b/plugin/niuniu/model.go @@ -3,26 +3,28 @@ package niuniu import ( fcext "github.com/FloatTech/floatbox/ctxext" sql "github.com/FloatTech/sqlite" + "github.com/shopspring/decimal" zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/message" + "math/rand" "strconv" "sync" "time" ) type model struct { - sql *sql.Sqlite + sql sql.Sqlite sync.RWMutex } type userInfo struct { - Uid int64 - Long float64 - Id int + Uid int64 + Length float64 + Id int } var ( - db = &model{sql: &sql.Sqlite{}} + db = &model{} getdb = fcext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool { db.sql.DBPath = en.DataFolder() + "niuniu.db" err := db.sql.Open(time.Hour * 24) @@ -34,6 +36,10 @@ var ( }) ) +func (db *model) randomLong() decimal.Decimal { + return decimal.NewFromFloat(float64(rand.Intn(9)+1) + float64(rand.Intn(100))/100) +} + func (db *model) createGidTable(gid int64) error { db.Lock() defer db.Unlock() @@ -44,8 +50,8 @@ func (db *model) findniuniu(gid, uid int64) (float64, error) { db.RLock() defer db.RUnlock() u := userInfo{} - err := db.sql.Find(strconv.FormatInt(gid, 10), &u, "where Uid = "+strconv.FormatInt(uid, 10)) - return u.Long, err + err := db.sql.Find(strconv.FormatInt(gid, 10), &u, "where UID = "+strconv.FormatInt(uid, 10)) + return u.Length, err } func (db *model) insertniuniu(u userInfo, gid int64) error { @@ -57,24 +63,12 @@ func (db *model) insertniuniu(u userInfo, gid int64) error { func (db *model) deleteniuniu(gid, uid int64) error { db.Lock() defer db.Unlock() - return db.sql.Del(strconv.FormatInt(gid, 10), "where Uid = "+strconv.FormatInt(uid, 10)) + return db.sql.Del(strconv.FormatInt(gid, 10), "where UID = "+strconv.FormatInt(uid, 10)) } -func (db *model) readAllTable(gid int64) ([]userInfo, error) { +func (db *model) readAllTable(gid int64) ([]*userInfo, error) { db.Lock() defer db.Unlock() - a, err := sql.FindAll[userInfo](db.sql, strconv.FormatInt(gid, 10), "where Id = 1") - slice := convertSocialHostInfoPointersToSlice(a) - return slice, err -} - -// 返回一个不是指针类型的切片 -func convertSocialHostInfoPointersToSlice(pointers []*userInfo) []userInfo { - var slice []userInfo - for _, ptr := range pointers { - if ptr != nil { - slice = append(slice, *ptr) - } - } - return slice + a, err := sql.FindAll[userInfo](&db.sql, strconv.FormatInt(gid, 10), "where ID = 1") + return a, err } From b1ce0600fa634127827b912bb50aef2006d7923f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 11 Aug 2024 10:47:57 +0800 Subject: [PATCH 14/58] Update result.go --- plugin/niuniu/result.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugin/niuniu/result.go b/plugin/niuniu/result.go index 92700baae9..20114da399 100644 --- a/plugin/niuniu/result.go +++ b/plugin/niuniu/result.go @@ -5,6 +5,7 @@ import ( "github.com/shopspring/decimal" "math" "math/rand" + "time" ) // fencing 击剑对决逻辑,返回对决结果和myLength的变化值 @@ -57,6 +58,7 @@ func determineResultBySkill(myLength, oppoLength float64) (string, float64, floa // calculateWinProbability 计算胜率 func calculateWinProbability(heightA, heightB float64) float64 { + //第一个接收参数初始概率 pA := 0.9 heightRatio := math.Max(heightA, heightB) / math.Min(heightA, heightB) reductionRate := 0.1 * (heightRatio - 1) @@ -67,8 +69,7 @@ func calculateWinProbability(heightA, heightB float64) float64 { // applySkill 应用击剑技巧并生成结果 func applySkill(myLength, oppoLength float64, increaseLength1 bool) (string, float64, float64) { - reduce := fence() - + reduce := fence(oppoLength) if increaseLength1 { myLength += reduce oppoLength -= 0.8 * reduce @@ -89,13 +90,12 @@ func applySkill(myLength, oppoLength float64, increaseLength1 bool) (string, flo } // fence 简单模拟击剑技巧效果 -func fence() float64 { - return float64(rand.Intn(5)+1) + rand.Float64() -} - -// randomLong 生成一个随机的数值 -func randomLong() decimal.Decimal { - return decimal.NewFromFloat(float64(rand.Intn(9)+1) + float64(rand.Intn(100))/100) +func fence(rd float64) float64 { + rd -= float64(time.Now().UnixNano() % 10) + if rd > 1000000 { + return rd - rand.Float64()*rd + } + return float64(int(rd * rand.Float64())) } // hitGlue 调整传入的值 From 7637a527e22115cac0b22e017c91992dee35e363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 11 Aug 2024 10:59:03 +0800 Subject: [PATCH 15/58] Update main.go --- plugin/niuniu/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 07fd672980..54a91cd8e0 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -66,7 +66,7 @@ func init() { messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcom\n", i+1, ctx.CardOrNickName(user.Uid), user.Length)) } - ctx.SendChain(message.Text(messages)) + ctx.SendChain(message.Text(messages.String())) }) en.OnFullMatch("牛子深度排行", zero.OnlyGroup, getdb).SetBlock(true).Handle(func(ctx *zero.Ctx) { gid := ctx.Event.GroupID @@ -92,7 +92,7 @@ func init() { messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcom\n", i+1, ctx.CardOrNickName(user.Uid), user.Length)) } - ctx.SendChain(message.Text(messages)) + ctx.SendChain(message.Text(messages.String())) }) en.OnFullMatch("查看我的牛牛", getdb, zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) { From 32d3a1b563cf84b149c53149ed7b01158c94d824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 11 Aug 2024 12:47:18 +0800 Subject: [PATCH 16/58] Update main.go --- plugin/niuniu/main.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 54a91cd8e0..a95191e2cb 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -61,7 +61,7 @@ func init() { } var messages strings.Builder messages.WriteString("牛子长度排行\n") - userInfos := sortUsersByNegativeLong(m) + userInfos := sortUsersByLength(m) for i, user := range userInfos { messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcom\n", i+1, ctx.CardOrNickName(user.Uid), user.Length)) @@ -86,7 +86,7 @@ func init() { return } var messages strings.Builder - userInfos := sortUsersByNegativeLong(m) + userInfos := sortUsersByNegativeLength(m) messages.WriteString("牛牛深度排行榜\n") for i, user := range userInfos { messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcom\n", i+1, @@ -368,9 +368,16 @@ func randomChoice(options []string) string { } // sortUsersByNegativeLong 接收一个UserInfo切片,并按Long字段负数越大(绝对值越小)排序后返回 -func sortUsersByNegativeLong(users []userInfo) []userInfo { +func sortUsersByNegativeLength(users []userInfo) []userInfo { sort.Slice(users, func(i, j int) bool { - return int(math.Abs(users[i].Length)) > int(math.Abs(users[j].Length)) + return math.Abs(users[i].Length) > math.Abs(users[j].Length) + }) + return users +} + +func sortUsersByLength(users []userInfo) []userInfo { + sort.Slice(users, func(i, j int) bool { + return users[i].Length > users[j].Length }) return users } From a80fd77e25a5cc3c152344c3df573617020787f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Mon, 12 Aug 2024 23:19:35 +0800 Subject: [PATCH 17/58] Update main.go --- plugin/niuniu/main.go | 80 +++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 38 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index a95191e2cb..b54dc8d86f 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -1,3 +1,4 @@ +// Package niuniu 牛牛大作战 package niuniu import ( @@ -63,8 +64,8 @@ func init() { messages.WriteString("牛子长度排行\n") userInfos := sortUsersByLength(m) for i, user := range userInfos { - messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcom\n", i+1, - ctx.CardOrNickName(user.Uid), user.Length)) + messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcm\n", i+1, + ctx.CardOrNickName(user.UID), user.Length)) } ctx.SendChain(message.Text(messages.String())) }) @@ -89,8 +90,8 @@ func init() { userInfos := sortUsersByNegativeLength(m) messages.WriteString("牛牛深度排行榜\n") for i, user := range userInfos { - messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcom\n", i+1, - ctx.CardOrNickName(user.Uid), user.Length)) + messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcm\n", i+1, + ctx.CardOrNickName(user.UID), user.Length)) } ctx.SendChain(message.Text(messages.String())) }) @@ -103,68 +104,70 @@ func init() { ctx.SendChain(message.Text("你还没有牛牛呢不能查看!")) return } - var result string + var result strings.Builder sexLong := "长" sex := "♂️" if niuniu < 0 { sexLong = "深" sex = "♀️" } - result = fmt.Sprintf("\n📛%s<%s>的牛牛信息\n⭕性别:%s\n⭕%s度:%.2fcm\n⭕ ", ctx.CardOrNickName(uid), strconv.FormatInt(uid, 10), sex, sexLong, niuniu) + result.WriteString(fmt.Sprintf("\n📛%s<%s>的牛牛信息\n⭕性别:%s\n⭕%s度:%.2fcm\n⭕ ", + ctx.CardOrNickName(uid), strconv.FormatInt(uid, 10), + sex, sexLong, niuniu)) switch { case niuniu <= -100: - result += "wtf?你已经进化成魅魔了!魅魔在击剑时有20%的几率消耗自身长度吞噬对方牛牛呢。" + result.WriteString("wtf?你已经进化成魅魔了!魅魔在击剑时有20%的几率消耗自身长度吞噬对方牛牛呢。") case niuniu <= -50: - result += "嗯....好像已经穿过了身体吧..从另一面来看也可以算是凸出来的吧?" + result.WriteString("嗯....好像已经穿过了身体吧..从另一面来看也可以算是凸出来的吧?") case niuniu <= -25: - result += randomChoice([]string{ + result.WriteString(randomChoice([]string{ "这名女生,你的身体很健康哦!", "WOW,真的凹进去了好多呢!", "你已经是我们女孩子的一员啦!", - }) + })) case niuniu <= -10: - result += randomChoice([]string{ + result.WriteString(randomChoice([]string{ "你已经是一名女生了呢,", "从女生的角度来说,你发育良好(,", "你醒啦?你已经是一名女孩子啦!", "唔...可以放进去一根手指了都...", - }) + })) case niuniu <= 0: - result += randomChoice([]string{ + result.WriteString(randomChoice([]string{ "安了安了,不要伤心嘛,做女生有什么不好的啊。", "不哭不哭,摸摸头,虽然很难再长出来,但是请不要伤心啦啊!", "加油加油!我看好你哦!", "你醒啦?你现在已经是一名女孩子啦!", - }) + })) case niuniu <= 10: - result += randomChoice([]string{ + result.WriteString(randomChoice([]string{ "你行不行啊?细狗!", "虽然短,但是小小的也很可爱呢。", "像一只蚕宝宝。", "长大了。", - }) + })) case niuniu <= 25: - result += randomChoice([]string{ + result.WriteString(randomChoice([]string{ "唔...没话说", "已经很长了呢!", - }) + })) case niuniu <= 50: - result += randomChoice([]string{ + result.WriteString(randomChoice([]string{ "话说这种真的有可能吗?", "厚礼谢!", - }) + })) case niuniu <= 100: - result += randomChoice([]string{ + result.WriteString(randomChoice([]string{ "已经突破天际了嘛...", "唔...这玩意应该不会变得比我高吧?", "你这个长度会死人的...!", "你马上要进化成牛头人了!!", "你是什么怪物,不要过来啊!!", - }) + })) case niuniu > 100: - result += "惊世骇俗!你已经进化成牛头人了!牛头人在击剑时有20%的几率消耗自身长度吞噬对方牛牛呢。" + result.WriteString("惊世骇俗!你已经进化成牛头人了!牛头人在击剑时有20%的几率消耗自身长度吞噬对方牛牛呢。") } - ctx.SendChain(message.At(uid), message.Text(result)) + ctx.SendChain(message.At(uid), message.Text(result.String())) }) en.OnFullMatchGroup([]string{"dj", "打胶"}, zero.OnlyGroup, getdb).SetBlock(true).Handle(func(ctx *zero.Ctx) { // 获取群号和用户ID @@ -193,13 +196,13 @@ func init() { ctx.SendChain(message.Text(messages1[r])) lock.RUnlock() return - } else { - lock.RUnlock() - lock.Lock() - delete(dajiaoLimitMap, userLimit{gid: gid, uid: uid}) - lock.Unlock() - lock.RLock() } + lock.RUnlock() + lock.Lock() + delete(dajiaoLimitMap, userLimit{gid: gid, uid: uid}) + lock.Unlock() + lock.RLock() + } } lock.RUnlock() @@ -235,9 +238,9 @@ func init() { } } u := userInfo{ - Uid: uid, + UID: uid, Length: niuniu, - Id: 1, + ID: 1, } if err = db.insertniuniu(u, gid); err != nil { ctx.SendChain(message.Text("ERROR:", err)) @@ -258,14 +261,14 @@ func init() { //获取初始长度 long := db.randomLong().InexactFloat64() u := userInfo{ - Uid: uid, + UID: uid, Length: long, - Id: 1, + ID: 1, } //添加数据进入表 err := db.insertniuniu(u, gid) if err != nil { - err = db.createGidTable(gid) + err = db.createGIDTable(gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return @@ -327,12 +330,12 @@ func init() { return } fencingResult, f, f1 := fencing(myniuniu, adduserniuniu) - err = db.insertniuniu(userInfo{Uid: uid, Length: f}, gid) + err = db.insertniuniu(userInfo{UID: uid, Length: f}, gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return } - err = db.insertniuniu(userInfo{Uid: adduser, Length: f1}, gid) + err = db.insertniuniu(userInfo{UID: adduser, Length: f1}, gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return @@ -367,7 +370,7 @@ func randomChoice(options []string) string { return options[rand.Intn(len(options))] } -// sortUsersByNegativeLong 接收一个UserInfo切片,并按Long字段负数越大(绝对值越小)排序后返回 +// 牛子深度 func sortUsersByNegativeLength(users []userInfo) []userInfo { sort.Slice(users, func(i, j int) bool { return math.Abs(users[i].Length) > math.Abs(users[j].Length) @@ -375,6 +378,7 @@ func sortUsersByNegativeLength(users []userInfo) []userInfo { return users } +// 牛子长度 func sortUsersByLength(users []userInfo) []userInfo { sort.Slice(users, func(i, j int) bool { return users[i].Length > users[j].Length From d70820420701f3acacfcb76c528403e43aa39689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Mon, 12 Aug 2024 23:20:15 +0800 Subject: [PATCH 18/58] Update model.go --- plugin/niuniu/model.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugin/niuniu/model.go b/plugin/niuniu/model.go index 091a693318..a75f06d33d 100644 --- a/plugin/niuniu/model.go +++ b/plugin/niuniu/model.go @@ -1,3 +1,4 @@ +// Package niuniu 牛牛大作战 package niuniu import ( @@ -18,9 +19,9 @@ type model struct { } type userInfo struct { - Uid int64 + UID int64 Length float64 - Id int + ID int } var ( @@ -40,7 +41,7 @@ func (db *model) randomLong() decimal.Decimal { return decimal.NewFromFloat(float64(rand.Intn(9)+1) + float64(rand.Intn(100))/100) } -func (db *model) createGidTable(gid int64) error { +func (db *model) createGIDTable(gid int64) error { db.Lock() defer db.Unlock() return db.sql.Create(strconv.FormatInt(gid, 10), &userInfo{}) From c2290637fb034d7f977a85255f43aa75a6d0cf5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Mon, 12 Aug 2024 23:20:53 +0800 Subject: [PATCH 19/58] Update result.go --- plugin/niuniu/result.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/plugin/niuniu/result.go b/plugin/niuniu/result.go index 20114da399..4bbe8a9cc1 100644 --- a/plugin/niuniu/result.go +++ b/plugin/niuniu/result.go @@ -1,3 +1,4 @@ +// Package niuniu 牛牛大作战 package niuniu import ( @@ -48,12 +49,10 @@ func fencing(myLength, oppoLength float64) (string, float64, float64) { func determineResultBySkill(myLength, oppoLength float64) (string, float64, float64) { probability := rand.Intn(100) + 1 winProbability := calculateWinProbability(myLength, oppoLength) * 100 - if 0 < probability && float64(probability) <= winProbability { return applySkill(myLength, oppoLength, true) - } else { - return applySkill(myLength, oppoLength, false) } + return applySkill(myLength, oppoLength, false) } // calculateWinProbability 计算胜率 @@ -79,14 +78,14 @@ func applySkill(myLength, oppoLength float64, increaseLength1 bool) (string, flo } return fmt.Sprintf("你以绝对的长度让对方屈服了呢!你的长度增加%.2fcm,当前长度%.2fcm!", reduce, myLength), myLength, oppoLength - } else { - myLength -= reduce - oppoLength += 0.8 * reduce - if myLength < 0 { - return fmt.Sprintf("哦吼!?看来你的牛牛因为击剑而凹进去了呢🤣🤣🤣!凹进去了%.2fcm!", reduce), myLength, oppoLength - } - return fmt.Sprintf("对方以绝对的长度让你屈服了呢!你的长度减少%.2fcm,当前长度%.2fcm!", reduce, myLength), myLength, oppoLength } + myLength -= reduce + oppoLength += 0.8 * reduce + if myLength < 0 { + return fmt.Sprintf("哦吼!?看来你的牛牛因为击剑而凹进去了呢🤣🤣🤣!凹进去了%.2fcm!", reduce), myLength, oppoLength + } + return fmt.Sprintf("对方以绝对的长度让你屈服了呢!你的长度减少%.2fcm,当前长度%.2fcm!", reduce, myLength), myLength, oppoLength + } // fence 简单模拟击剑技巧效果 From 88e059bc7fb8015c3e679fc402abeca9833225eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sat, 17 Aug 2024 22:42:10 +0800 Subject: [PATCH 20/58] Update main.go --- plugin/niuniu/main.go | 116 +++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 76 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index b54dc8d86f..bf84159b3c 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -7,13 +7,13 @@ import ( "github.com/FloatTech/zbputils/control" "github.com/shopspring/decimal" zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/extension/rate" "github.com/wdvxdr1123/ZeroBot/message" "golang.org/x/exp/rand" "math" "sort" "strconv" "strings" - "sync" "time" ) @@ -30,18 +30,10 @@ var ( "- 牛子深度排行\n", PrivateDataFolder: "niuniu", }) + dajiaoLimiter = rate.NewManager[string](time.Second*90, 1) + jjLimiter = rate.NewManager[string](time.Second*150, 1) ) -// 设置超时 -type userLimit struct { - gid int64 - uid int64 -} - -var dajiaoLimitMap = make(map[userLimit]*time.Time) -var lock sync.RWMutex -var jjLimitMap = make(map[userLimit]*time.Time) - func init() { en.OnFullMatch("牛子长度排行", zero.OnlyGroup, getdb).SetBlock(true).Handle(func(ctx *zero.Ctx) { gid := ctx.Event.GroupID @@ -169,7 +161,23 @@ func init() { } ctx.SendChain(message.At(uid), message.Text(result.String())) }) - en.OnFullMatchGroup([]string{"dj", "打胶"}, zero.OnlyGroup, getdb).SetBlock(true).Handle(func(ctx *zero.Ctx) { + en.OnFullMatchGroup([]string{"dj", "打胶"}, zero.OnlyGroup, + getdb).SetBlock(true).Limit(func(ctx *zero.Ctx) *rate.Limiter { + lt := dajiaoLimiter.Load(fmt.Sprintf("dj%s%s", strconv.FormatInt(ctx.Event.GroupID, 10), + strconv.FormatInt(ctx.Event.UserID, 10))) + return lt + }, func(ctx *zero.Ctx) { + lt := dajiaoLimiter.Load(fmt.Sprintf("dj%s%s", strconv.FormatInt(ctx.Event.GroupID, 10), + strconv.FormatInt(ctx.Event.UserID, 10))) + timePass := lt.AcquireTime().Second() + messages1 := []string{ + fmt.Sprintf("才过去了%ds时间,你就又要打🦶了,身体受得住吗", timePass), + fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 90-timePass), + fmt.Sprintf("休息一下吧,会炸膛的!%ds后再来吧", 90-timePass), + fmt.Sprintf("打咩哟,你的牛牛会爆炸的,休息%ds再来吧", 90-timePass), + } + ctx.SendChain(message.Text(randomChoice(messages1))) + }).Handle(func(ctx *zero.Ctx) { // 获取群号和用户ID gid := ctx.Event.GroupID uid := ctx.Event.UserID @@ -180,32 +188,6 @@ func init() { } probability := rand.Intn(100 + 1) reduce := math.Abs(hitGlue(decimal.NewFromFloat(niuniu))) - var timePass int64 - lock.RLock() - if len(dajiaoLimitMap) > 0 { - if t, ok := dajiaoLimitMap[userLimit{gid: gid, uid: uid}]; ok { - timePass = int64(time.Since(t.Local()).Seconds()) - if timePass < 90 { - r := rand.Intn(4) - messages1 := []string{ - fmt.Sprintf("才过去了%ds时间,你就又要打🦶了,身体受得住吗", timePass), - fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 90-timePass), - fmt.Sprintf("休息一下吧,会炸膛的!%ds后再来吧", 90-timePass), - fmt.Sprintf("打咩哟,你的牛牛会爆炸的,休息%ds再来吧", 90-timePass), - } - ctx.SendChain(message.Text(messages1[r])) - lock.RUnlock() - return - } - lock.RUnlock() - lock.Lock() - delete(dajiaoLimitMap, userLimit{gid: gid, uid: uid}) - lock.Unlock() - lock.RLock() - - } - } - lock.RUnlock() switch { case probability <= 40: niuniu += reduce @@ -246,10 +228,6 @@ func init() { ctx.SendChain(message.Text("ERROR:", err)) return } - timer := time.Now() - lock.Lock() - dajiaoLimitMap[userLimit{gid: gid, uid: uid}] = &timer - lock.Unlock() }) en.OnFullMatch("注册牛牛", zero.OnlyGroup, getdb).SetBlock(true).Handle(func(ctx *zero.Ctx) { gid := ctx.Event.GroupID @@ -282,7 +260,25 @@ func init() { ctx.SendChain(message.Reply(ctx.Event.GroupID), message.Text("注册成功,你的牛牛现在有", u.Length, "cm")) }) - en.OnRegex(`jj\[CQ:at,qq=([0-9]+)\].*`, getdb, zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) { + en.OnRegex(`jj\[CQ:at,qq=([0-9]+)\].*`, getdb, + zero.OnlyGroup).SetBlock(true).Limit(func(ctx *zero.Ctx) *rate.Limiter { + lt := jjLimiter.Load(fmt.Sprintf("jj%s%s", strconv.FormatInt(ctx.Event.GroupID, 10), + strconv.FormatInt(ctx.Event.UserID, 10))) + return lt + }, func(ctx *zero.Ctx) { + lt := jjLimiter.Load(fmt.Sprintf("jj%s%s", strconv.FormatInt(ctx.Event.GroupID, 10), + strconv.FormatInt(ctx.Event.UserID, 10))) + timePass := lt.AcquireTime().Second() + if lt.Acquire() { + ctx.SendChain(message.Text(randomChoice([]string{ + fmt.Sprintf("才过去了%ds时间,你就又要击剑了,真是饥渴难耐啊", timePass), + fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 150-timePass), + fmt.Sprintf("你这种男同就应该被送去集中营!等待%ds再来吧", 150-timePass), + fmt.Sprintf("打咩哟!你的牛牛会炸的,休息%ds再来吧", 150-timePass), + }))) + } + }, + ).Handle(func(ctx *zero.Ctx) { adduser, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) @@ -300,31 +296,6 @@ func init() { ctx.SendChain(message.At(uid), message.Text("对方还没有牛牛呢,不能🤺")) return } - var timePass int64 - lock.RLock() - if len(jjLimitMap) > 0 { - if t, ok := jjLimitMap[userLimit{gid: gid, uid: uid}]; ok { - timePass = int64(time.Since(t.Local()).Seconds()) - if timePass < 150 { - r := rand.Intn(4) - ctx.SendChain(message.Text([]string{ - fmt.Sprintf("才过去了%ds时间,你就又要击剑了,真是饥渴难耐啊", timePass), - fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 150-timePass), - fmt.Sprintf("你这种男同就应该被送去集中营!等待%ds再来吧", 150-timePass), - fmt.Sprintf("打咩哟!你的牛牛会炸的,休息%ds再来吧", 150-timePass), - }[r])) - lock.RUnlock() - return - } else { - lock.RUnlock() - lock.Lock() - delete(jjLimitMap, userLimit{gid: gid, uid: uid}) - lock.Unlock() - lock.RLock() - } - } - } - lock.RUnlock() if myniuniu == adduserniuniu { ctx.SendChain(message.Text("你要和谁🤺?你自己吗?")) return @@ -341,15 +312,8 @@ func init() { return } ctx.SendChain(message.At(uid), message.Text(fencingResult)) - t := time.Now() - lock.Lock() - jjLimitMap[userLimit{ - gid: gid, - uid: uid, - }] = &t - lock.Unlock() }) - en.OnFullMatch("注销牛牛", getdb, zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) { + en.OnFullMatch("注销牛牛", getdb, zero.OnlyGroup).SetBlock(false).Handle(func(ctx *zero.Ctx) { uid := ctx.Event.UserID gid := ctx.Event.GroupID _, err := db.findniuniu(gid, uid) From ce5cc5c81cf600413f731fca2b1d48aa314de609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sat, 17 Aug 2024 22:43:24 +0800 Subject: [PATCH 21/58] Update result.go --- plugin/niuniu/result.go | 136 +++++++++++++++------------------------- 1 file changed, 52 insertions(+), 84 deletions(-) diff --git a/plugin/niuniu/result.go b/plugin/niuniu/result.go index 4bbe8a9cc1..a75f06d33d 100644 --- a/plugin/niuniu/result.go +++ b/plugin/niuniu/result.go @@ -2,106 +2,74 @@ package niuniu import ( - "fmt" + fcext "github.com/FloatTech/floatbox/ctxext" + sql "github.com/FloatTech/sqlite" "github.com/shopspring/decimal" - "math" + zero "github.com/wdvxdr1123/ZeroBot" + "github.com/wdvxdr1123/ZeroBot/message" "math/rand" + "strconv" + "sync" "time" ) -// fencing 击剑对决逻辑,返回对决结果和myLength的变化值 -func fencing(myLength, oppoLength float64) (string, float64, float64) { - lossLimit := 0.25 - devourLimit := 0.27 - - probability := rand.Intn(100) + 1 - - switch { - case oppoLength <= -100 && myLength > 0 && 10 < probability && probability <= 20: - oppoLength *= 0.85 - change := -math.Min(math.Abs(lossLimit*myLength), math.Abs(1.5*myLength)) - myLength += change - return fmt.Sprintf("对方身为魅魔诱惑了你,你同化成魅魔!当前长度%.2fcm!", myLength), myLength, oppoLength - case oppoLength >= 100 && myLength > 0 && 10 < probability && probability <= 20: - oppoLength *= 0.85 - change := -math.Min(math.Abs(devourLimit*myLength), math.Abs(1.5*myLength)) - myLength += change - return fmt.Sprintf("对方以牛头人的荣誉摧毁了你的牛牛!当前长度%.2fcm!", myLength), myLength, oppoLength +type model struct { + sql sql.Sqlite + sync.RWMutex +} - case myLength <= -100 && oppoLength > 0 && 10 < probability && probability <= 20: - myLength *= 0.85 - change := math.Min(math.Abs(lossLimit*oppoLength), math.Abs(1.5*oppoLength)) - oppoLength -= change - return fmt.Sprintf("你身为魅魔诱惑了对方,吞噬了对方部分长度!当前长度%.2fcm!", myLength), myLength, oppoLength +type userInfo struct { + UID int64 + Length float64 + ID int +} - case myLength >= 100 && oppoLength > 0 && 10 < probability && probability <= 20: - myLength *= 0.85 - change := math.Min(math.Abs(devourLimit*oppoLength), math.Abs(1.5*oppoLength)) - oppoLength += change - return fmt.Sprintf("你以牛头人的荣誉摧毁了对方的牛牛!当前长度%.2fcm!", myLength), myLength, oppoLength +var ( + db = &model{} + getdb = fcext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool { + db.sql.DBPath = en.DataFolder() + "niuniu.db" + err := db.sql.Open(time.Hour * 24) + if err != nil { + ctx.SendChain(message.Text("ERROR: ", err)) + return false + } + return true + }) +) - default: - return determineResultBySkill(myLength, oppoLength) - } +func (db *model) randomLong() decimal.Decimal { + return decimal.NewFromFloat(float64(rand.Intn(9)+1) + float64(rand.Intn(100))/100) } -// determineResultBySkill 根据击剑技巧决定结果 -func determineResultBySkill(myLength, oppoLength float64) (string, float64, float64) { - probability := rand.Intn(100) + 1 - winProbability := calculateWinProbability(myLength, oppoLength) * 100 - if 0 < probability && float64(probability) <= winProbability { - return applySkill(myLength, oppoLength, true) - } - return applySkill(myLength, oppoLength, false) +func (db *model) createGIDTable(gid int64) error { + db.Lock() + defer db.Unlock() + return db.sql.Create(strconv.FormatInt(gid, 10), &userInfo{}) } -// calculateWinProbability 计算胜率 -func calculateWinProbability(heightA, heightB float64) float64 { - //第一个接收参数初始概率 - pA := 0.9 - heightRatio := math.Max(heightA, heightB) / math.Min(heightA, heightB) - reductionRate := 0.1 * (heightRatio - 1) - reduction := pA * reductionRate - adjustedPA := pA - reduction - return math.Max(adjustedPA, 0.01) +func (db *model) findniuniu(gid, uid int64) (float64, error) { + db.RLock() + defer db.RUnlock() + u := userInfo{} + err := db.sql.Find(strconv.FormatInt(gid, 10), &u, "where UID = "+strconv.FormatInt(uid, 10)) + return u.Length, err } -// applySkill 应用击剑技巧并生成结果 -func applySkill(myLength, oppoLength float64, increaseLength1 bool) (string, float64, float64) { - reduce := fence(oppoLength) - if increaseLength1 { - myLength += reduce - oppoLength -= 0.8 * reduce - - if myLength < 0 { - return fmt.Sprintf("哦吼!?你的牛牛在长大欸!长大了%.2fcm!", reduce), myLength, oppoLength - } - return fmt.Sprintf("你以绝对的长度让对方屈服了呢!你的长度增加%.2fcm,当前长度%.2fcm!", reduce, myLength), myLength, oppoLength - - } - myLength -= reduce - oppoLength += 0.8 * reduce - if myLength < 0 { - return fmt.Sprintf("哦吼!?看来你的牛牛因为击剑而凹进去了呢🤣🤣🤣!凹进去了%.2fcm!", reduce), myLength, oppoLength - } - return fmt.Sprintf("对方以绝对的长度让你屈服了呢!你的长度减少%.2fcm,当前长度%.2fcm!", reduce, myLength), myLength, oppoLength - +func (db *model) insertniuniu(u userInfo, gid int64) error { + db.Lock() + defer db.Unlock() + return db.sql.Insert(strconv.FormatInt(gid, 10), &u) } -// fence 简单模拟击剑技巧效果 -func fence(rd float64) float64 { - rd -= float64(time.Now().UnixNano() % 10) - if rd > 1000000 { - return rd - rand.Float64()*rd - } - return float64(int(rd * rand.Float64())) +func (db *model) deleteniuniu(gid, uid int64) error { + db.Lock() + defer db.Unlock() + return db.sql.Del(strconv.FormatInt(gid, 10), "where UID = "+strconv.FormatInt(uid, 10)) } -// hitGlue 调整传入的值 -func hitGlue(l decimal.Decimal) float64 { - l = l.Sub(decimal.NewFromInt(1)) - randomFactor := decimal.NewFromFloat(rand.Float64()) - adjustedValue := randomFactor.Mul(l).Div(decimal.NewFromInt(2)) - f, _ := adjustedValue.Float64() - return f +func (db *model) readAllTable(gid int64) ([]*userInfo, error) { + db.Lock() + defer db.Unlock() + a, err := sql.FindAll[userInfo](&db.sql, strconv.FormatInt(gid, 10), "where ID = 1") + return a, err } From 17cdf28c227a8048a3c619009f010b672b97967e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sat, 17 Aug 2024 23:00:26 +0800 Subject: [PATCH 22/58] Update result.go --- plugin/niuniu/result.go | 136 +++++++++++++++++++++++++--------------- 1 file changed, 84 insertions(+), 52 deletions(-) diff --git a/plugin/niuniu/result.go b/plugin/niuniu/result.go index a75f06d33d..c5504001de 100644 --- a/plugin/niuniu/result.go +++ b/plugin/niuniu/result.go @@ -2,74 +2,106 @@ package niuniu import ( - fcext "github.com/FloatTech/floatbox/ctxext" - sql "github.com/FloatTech/sqlite" + "fmt" "github.com/shopspring/decimal" - zero "github.com/wdvxdr1123/ZeroBot" - "github.com/wdvxdr1123/ZeroBot/message" + "math" "math/rand" - "strconv" - "sync" "time" ) -type model struct { - sql sql.Sqlite - sync.RWMutex -} +// fencing 击剑对决逻辑,返回对决结果和myLength的变化值 +func fencing(myLength, oppoLength float64) (string, float64, float64) { + lossLimit := 0.25 + devourLimit := 0.27 -type userInfo struct { - UID int64 - Length float64 - ID int -} + probability := rand.Intn(100) + 1 -var ( - db = &model{} - getdb = fcext.DoOnceOnSuccess(func(ctx *zero.Ctx) bool { - db.sql.DBPath = en.DataFolder() + "niuniu.db" - err := db.sql.Open(time.Hour * 24) - if err != nil { - ctx.SendChain(message.Text("ERROR: ", err)) - return false - } - return true - }) -) + switch { + case oppoLength <= -100 && myLength > 0 && 10 < probability && probability <= 20: + oppoLength *= 0.85 + change := -math.Min(math.Abs(lossLimit*myLength), math.Abs(1.5*myLength)) + myLength += change + return fmt.Sprintf("对方身为魅魔诱惑了你,你同化成魅魔!当前长度%.2fcm!", myLength), myLength, oppoLength + case oppoLength >= 100 && myLength > 0 && 10 < probability && probability <= 20: + oppoLength *= 0.85 + change := -math.Min(math.Abs(devourLimit*myLength), math.Abs(1.5*myLength)) + myLength += change + return fmt.Sprintf("对方以牛头人的荣誉摧毁了你的牛牛!当前长度%.2fcm!", myLength), myLength, oppoLength + + case myLength <= -100 && oppoLength > 0 && 10 < probability && probability <= 20: + myLength *= 0.85 + change := math.Min(math.Abs(lossLimit*oppoLength), math.Abs(1.5*oppoLength)) + oppoLength -= change + return fmt.Sprintf("你身为魅魔诱惑了对方,吞噬了对方部分长度!当前长度%.2fcm!", myLength), myLength, oppoLength -func (db *model) randomLong() decimal.Decimal { - return decimal.NewFromFloat(float64(rand.Intn(9)+1) + float64(rand.Intn(100))/100) + case myLength >= 100 && oppoLength > 0 && 10 < probability && probability <= 20: + myLength *= 0.85 + change := math.Min(math.Abs(devourLimit*oppoLength), math.Abs(1.5*oppoLength)) + oppoLength += change + return fmt.Sprintf("你以牛头人的荣誉摧毁了对方的牛牛!当前长度%.2fcm!", myLength), myLength, oppoLength + + default: + return determineResultBySkill(myLength, oppoLength) + } } -func (db *model) createGIDTable(gid int64) error { - db.Lock() - defer db.Unlock() - return db.sql.Create(strconv.FormatInt(gid, 10), &userInfo{}) +// determineResultBySkill 根据击剑技巧决定结果 +func determineResultBySkill(myLength, oppoLength float64) (string, float64, float64) { + probability := rand.Intn(100) + 1 + winProbability := calculateWinProbability(myLength, oppoLength) * 100 + if 0 < probability && float64(probability) <= winProbability { + return applySkill(myLength, oppoLength, true) + } + return applySkill(myLength, oppoLength, false) } -func (db *model) findniuniu(gid, uid int64) (float64, error) { - db.RLock() - defer db.RUnlock() - u := userInfo{} - err := db.sql.Find(strconv.FormatInt(gid, 10), &u, "where UID = "+strconv.FormatInt(uid, 10)) - return u.Length, err +// calculateWinProbability 计算胜率 +func calculateWinProbability(heightA, heightB float64) float64 { + //第一个接收参数初始概率 + pA := 0.9 + heightRatio := math.Max(heightA, heightB) / math.Min(heightA, heightB) + reductionRate := 0.1 * (heightRatio - 1) + reduction := pA * reductionRate + adjustedPA := pA - reduction + return math.Max(adjustedPA, 0.01) } -func (db *model) insertniuniu(u userInfo, gid int64) error { - db.Lock() - defer db.Unlock() - return db.sql.Insert(strconv.FormatInt(gid, 10), &u) +// applySkill 应用击剑技巧并生成结果 +func applySkill(myLength, oppoLength float64, increaseLength1 bool) (string, float64, float64) { + reduce := fence(oppoLength) + if increaseLength1 { + myLength += reduce + oppoLength -= 0.8 * reduce + + if myLength > 0 { + return fmt.Sprintf("哦吼!?你的牛牛在长大欸!长大了%.2fcm!", reduce), myLength, oppoLength + } + return fmt.Sprintf("你以绝对的长度让对方屈服了呢!你的长度增加%.2fcm,当前长度%.2fcm!", reduce, myLength), myLength, oppoLength + + } + myLength -= reduce + oppoLength += 0.8 * reduce + if myLength < 0 { + return fmt.Sprintf("哦吼!?看来你的牛牛因为击剑而凹进去了呢🤣🤣🤣!凹进去了%.2fcm!", reduce), myLength, oppoLength + } + return fmt.Sprintf("对方以绝对的长度让你屈服了呢!你的长度减少%.2fcm,当前长度%.2fcm!", reduce, myLength), myLength, oppoLength + } -func (db *model) deleteniuniu(gid, uid int64) error { - db.Lock() - defer db.Unlock() - return db.sql.Del(strconv.FormatInt(gid, 10), "where UID = "+strconv.FormatInt(uid, 10)) +// fence 简单模拟击剑技巧效果 +func fence(rd float64) float64 { + rd -= float64(time.Now().UnixNano() % 10) + if rd > 1000000 { + return rd - rand.Float64()*rd + } + return float64(int(rd * rand.Float64())) } -func (db *model) readAllTable(gid int64) ([]*userInfo, error) { - db.Lock() - defer db.Unlock() - a, err := sql.FindAll[userInfo](&db.sql, strconv.FormatInt(gid, 10), "where ID = 1") - return a, err +// hitGlue 调整传入的值 +func hitGlue(l decimal.Decimal) float64 { + l = l.Sub(decimal.NewFromInt(1)) + randomFactor := decimal.NewFromFloat(rand.Float64()) + adjustedValue := randomFactor.Mul(l).Div(decimal.NewFromInt(2)) + f, _ := adjustedValue.Float64() + return f } From b5d51f01f6affcb1cdbbae2c0ea2195eefa1af5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 18 Aug 2024 11:23:41 +0800 Subject: [PATCH 23/58] Update result.go --- plugin/niuniu/result.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/niuniu/result.go b/plugin/niuniu/result.go index c5504001de..4bbe8a9cc1 100644 --- a/plugin/niuniu/result.go +++ b/plugin/niuniu/result.go @@ -73,7 +73,7 @@ func applySkill(myLength, oppoLength float64, increaseLength1 bool) (string, flo myLength += reduce oppoLength -= 0.8 * reduce - if myLength > 0 { + if myLength < 0 { return fmt.Sprintf("哦吼!?你的牛牛在长大欸!长大了%.2fcm!", reduce), myLength, oppoLength } return fmt.Sprintf("你以绝对的长度让对方屈服了呢!你的长度增加%.2fcm,当前长度%.2fcm!", reduce, myLength), myLength, oppoLength From 2fef3b647ba45bd7b1adb66ce84d6a5e76ae8668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Mon, 19 Aug 2024 22:59:53 +0800 Subject: [PATCH 24/58] Update main.go --- plugin/niuniu/main.go | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index bf84159b3c..3aa434bd6a 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -163,13 +163,10 @@ func init() { }) en.OnFullMatchGroup([]string{"dj", "打胶"}, zero.OnlyGroup, getdb).SetBlock(true).Limit(func(ctx *zero.Ctx) *rate.Limiter { - lt := dajiaoLimiter.Load(fmt.Sprintf("dj%s%s", strconv.FormatInt(ctx.Event.GroupID, 10), - strconv.FormatInt(ctx.Event.UserID, 10))) - return lt + return dajiaoLimiter.Load(fmt.Sprintf("dj%d%d", ctx.Event.GroupID, ctx.Event.UserID)) }, func(ctx *zero.Ctx) { - lt := dajiaoLimiter.Load(fmt.Sprintf("dj%s%s", strconv.FormatInt(ctx.Event.GroupID, 10), - strconv.FormatInt(ctx.Event.UserID, 10))) - timePass := lt.AcquireTime().Second() + lt := dajiaoLimiter.Load(fmt.Sprintf("dj%d%d", ctx.Event.GroupID, ctx.Event.UserID)) + timePass := lt.LastTouch() messages1 := []string{ fmt.Sprintf("才过去了%ds时间,你就又要打🦶了,身体受得住吗", timePass), fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 90-timePass), @@ -262,13 +259,10 @@ func init() { }) en.OnRegex(`jj\[CQ:at,qq=([0-9]+)\].*`, getdb, zero.OnlyGroup).SetBlock(true).Limit(func(ctx *zero.Ctx) *rate.Limiter { - lt := jjLimiter.Load(fmt.Sprintf("jj%s%s", strconv.FormatInt(ctx.Event.GroupID, 10), - strconv.FormatInt(ctx.Event.UserID, 10))) - return lt + return jjLimiter.Load(fmt.Sprintf("jj%d%d", ctx.Event.GroupID, ctx.Event.UserID)) }, func(ctx *zero.Ctx) { - lt := jjLimiter.Load(fmt.Sprintf("jj%s%s", strconv.FormatInt(ctx.Event.GroupID, 10), - strconv.FormatInt(ctx.Event.UserID, 10))) - timePass := lt.AcquireTime().Second() + lt := jjLimiter.Load(fmt.Sprintf("jj%d%d", ctx.Event.GroupID, ctx.Event.UserID)) + timePass := lt.LastTouch() if lt.Acquire() { ctx.SendChain(message.Text(randomChoice([]string{ fmt.Sprintf("才过去了%ds时间,你就又要击剑了,真是饥渴难耐啊", timePass), From f4b2da200b091ab7b277dc37f3dfc2cc3ab257c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Mon, 19 Aug 2024 23:01:56 +0800 Subject: [PATCH 25/58] Update main.go From e5da406e6c216cc578f8e8dc52c038755b091f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Tue, 20 Aug 2024 23:01:40 +0800 Subject: [PATCH 26/58] Update and rename result.go to untils.go --- plugin/niuniu/{result.go => untils.go} | 89 ++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) rename plugin/niuniu/{result.go => untils.go} (53%) diff --git a/plugin/niuniu/result.go b/plugin/niuniu/untils.go similarity index 53% rename from plugin/niuniu/result.go rename to plugin/niuniu/untils.go index 4bbe8a9cc1..47834721cd 100644 --- a/plugin/niuniu/result.go +++ b/plugin/niuniu/untils.go @@ -9,6 +9,95 @@ import ( "time" ) +func generateRandomStingTwo(niuniu float64) (string, float64) { + probability := rand.Intn(100 + 1) + reduce := math.Abs(hitGlue(decimal.NewFromFloat(niuniu))) + switch { + case probability <= 40: + niuniu += reduce + return randomChoice([]string{ + fmt.Sprintf("你嘿咻嘿咻一下,促进了牛牛发育,牛牛增加%.2fcm了呢!", reduce), + fmt.Sprintf("你打了个舒服痛快的🦶呐,牛牛增加了%.2fcm呢!", reduce), + }), niuniu + case probability <= 60: + return randomChoice([]string{ + "你打了个🦶,但是什么变化也没有,好奇怪捏~", + "你的牛牛刚开始变长了,可过了一会又回来了,什么变化也没有,好奇怪捏~", + }), niuniu + default: + niuniu -= reduce + if niuniu < 0 { + return randomChoice([]string{ + fmt.Sprintf("哦吼!?看来你的牛牛凹进去了%.2fcm呢!", reduce), + fmt.Sprintf("你突发恶疾!你的牛牛凹进去了%.2fcm!", reduce), + fmt.Sprintf("笑死,你因为打🦶过度导致牛牛凹进去了%.2fcm!🤣🤣🤣", reduce), + }), niuniu + } else { + return randomChoice([]string{ + fmt.Sprintf("阿哦,你过度打🦶,牛牛缩短%.2fcm了呢!", reduce), + fmt.Sprintf("你的牛牛变长了很多,你很激动地继续打🦶,然后牛牛缩短了%.2fcm呢!", reduce), + fmt.Sprintf("小打怡情,大打伤身,强打灰飞烟灭!你过度打🦶,牛牛缩短了%.2fcm捏!", reduce), + }), niuniu + } + } +} + +func generateRandomString(niuniu float64) string { + switch { + case niuniu <= -100: + return "wtf?你已经进化成魅魔了!魅魔在击剑时有20%的几率消耗自身长度吞噬对方牛牛呢。" + case niuniu <= -50: + return "嗯....好像已经穿过了身体吧..从另一面来看也可以算是凸出来的吧?" + case niuniu <= -25: + return randomChoice([]string{ + "这名女生,你的身体很健康哦!", + "WOW,真的凹进去了好多呢!", + "你已经是我们女孩子的一员啦!", + }) + case niuniu <= -10: + return randomChoice([]string{ + "你已经是一名女生了呢,", + "从女生的角度来说,你发育良好(,", + "你醒啦?你已经是一名女孩子啦!", + "唔...可以放进去一根手指了都...", + }) + case niuniu <= 0: + return randomChoice([]string{ + "安了安了,不要伤心嘛,做女生有什么不好的啊。", + "不哭不哭,摸摸头,虽然很难再长出来,但是请不要伤心啦啊!", + "加油加油!我看好你哦!", + "你醒啦?你现在已经是一名女孩子啦!", + }) + case niuniu <= 10: + return randomChoice([]string{ + "你行不行啊?细狗!", + "虽然短,但是小小的也很可爱呢。", + "像一只蚕宝宝。", + "长大了。", + }) + case niuniu <= 25: + return randomChoice([]string{ + "唔...没话说", + "已经很长了呢!", + }) + case niuniu <= 50: + return randomChoice([]string{ + "话说这种真的有可能吗?", + "厚礼谢!", + }) + case niuniu <= 100: + return randomChoice([]string{ + "已经突破天际了嘛...", + "唔...这玩意应该不会变得比我高吧?", + "你这个长度会死人的...!", + "你马上要进化成牛头人了!!", + "你是什么怪物,不要过来啊!!", + }) + default: + return "惊世骇俗!你已经进化成牛头人了!牛头人在击剑时有20%的几率消耗自身长度吞噬对方牛牛呢。" + } +} + // fencing 击剑对决逻辑,返回对决结果和myLength的变化值 func fencing(myLength, oppoLength float64) (string, float64, float64) { lossLimit := 0.25 From 11396a75c0a0958c572ca0ece29466ed89997733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Tue, 20 Aug 2024 23:05:35 +0800 Subject: [PATCH 27/58] Update model.go --- plugin/niuniu/model.go | 54 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/plugin/niuniu/model.go b/plugin/niuniu/model.go index a75f06d33d..8a3bacc7e1 100644 --- a/plugin/niuniu/model.go +++ b/plugin/niuniu/model.go @@ -8,6 +8,7 @@ import ( zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/message" "math/rand" + "sort" "strconv" "sync" "time" @@ -19,10 +20,11 @@ type model struct { } type userInfo struct { - UID int64 - Length float64 - ID int + UID int64 + Length float64 + UserCount int } +type users []*userInfo var ( db = &model{} @@ -37,7 +39,47 @@ var ( }) ) -func (db *model) randomLong() decimal.Decimal { +func (m users) newPositive() []userInfo { + var m1 []userInfo + for _, i2 := range m { + if i2.Length > 0 { + m1 = append(m1, *i2) + } + } + return m1 +} + +func (m users) newNegative() []userInfo { + var m1 []userInfo + for _, i2 := range m { + if i2.Length <= 0 { + m1 = append(m1, *i2) + } + } + return m1 +} + +// 牛子深度 +func (m users) sortUsersByNegativeLength() users { + sort.Slice(m, func(i, j int) bool { + return m[i].Length > m[j].Length + }) + var newUsers []*userInfo + for i := len(m); i >= 0; i-- { + newUsers = append(newUsers, m[i]) + } + return newUsers +} + +// 牛子长度 +func (m users) sortUsersByLength() users { + sort.Slice(m, func(i, j int) bool { + return m[i].Length > m[j].Length + }) + return m +} + +func (db *model) randLength() decimal.Decimal { return decimal.NewFromFloat(float64(rand.Intn(9)+1) + float64(rand.Intn(100))/100) } @@ -67,9 +109,9 @@ func (db *model) deleteniuniu(gid, uid int64) error { return db.sql.Del(strconv.FormatInt(gid, 10), "where UID = "+strconv.FormatInt(uid, 10)) } -func (db *model) readAllTable(gid int64) ([]*userInfo, error) { +func (db *model) readAllTable(gid int64) (users, error) { db.Lock() defer db.Unlock() - a, err := sql.FindAll[userInfo](&db.sql, strconv.FormatInt(gid, 10), "where ID = 1") + a, err := sql.FindAll[userInfo](&db.sql, strconv.FormatInt(gid, 10), "where UserCount = 1") return a, err } From 1110a99a2835199974f543d0ff33cf5ccfd768d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Tue, 20 Aug 2024 23:05:58 +0800 Subject: [PATCH 28/58] Update main.go --- plugin/niuniu/main.go | 177 +++++++++++------------------------------- 1 file changed, 44 insertions(+), 133 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 3aa434bd6a..e75a6645f5 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -5,13 +5,10 @@ import ( "fmt" ctrl "github.com/FloatTech/zbpctrl" "github.com/FloatTech/zbputils/control" - "github.com/shopspring/decimal" zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/extension/rate" "github.com/wdvxdr1123/ZeroBot/message" "golang.org/x/exp/rand" - "math" - "sort" "strconv" "strings" "time" @@ -42,21 +39,15 @@ func init() { ctx.SendChain(message.Text("ERROR: ", err)) return } - var m []userInfo - for _, info := range niuniuList { - if info.Length > 0 { - m = append(m, *info) - } - } + m := niuniuList.newPositive() if m == nil { ctx.SendChain(message.Text("暂时没有男孩子哦")) return } var messages strings.Builder messages.WriteString("牛子长度排行\n") - userInfos := sortUsersByLength(m) - for i, user := range userInfos { - messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcm\n", i+1, + for i, user := range niuniuList.sortUsersByLength() { + messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcm\n", i+1, ctx.CardOrNickName(user.UID), user.Length)) } ctx.SendChain(message.Text(messages.String())) @@ -79,13 +70,13 @@ func init() { return } var messages strings.Builder - userInfos := sortUsersByNegativeLength(m) messages.WriteString("牛牛深度排行榜\n") - for i, user := range userInfos { - messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcm\n", i+1, + for i, user := range niuniuList.sortUsersByNegativeLength() { + messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcm\n", i+1, ctx.CardOrNickName(user.UID), user.Length)) } - ctx.SendChain(message.Text(messages.String())) + + ctx.SendChain(message.Text(&messages)) }) en.OnFullMatch("查看我的牛牛", getdb, zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) { @@ -103,77 +94,45 @@ func init() { sexLong = "深" sex = "♀️" } - result.WriteString(fmt.Sprintf("\n📛%s<%s>的牛牛信息\n⭕性别:%s\n⭕%s度:%.2fcm\n⭕ ", - ctx.CardOrNickName(uid), strconv.FormatInt(uid, 10), - sex, sexLong, niuniu)) + niuniuList, err := db.readAllTable(gid) + if err != nil { + ctx.SendChain(message.Text("ERROR:", err)) + return + } + var ranking int switch { - case niuniu <= -100: - result.WriteString("wtf?你已经进化成魅魔了!魅魔在击剑时有20%的几率消耗自身长度吞噬对方牛牛呢。") - case niuniu <= -50: - result.WriteString("嗯....好像已经穿过了身体吧..从另一面来看也可以算是凸出来的吧?") - case niuniu <= -25: - result.WriteString(randomChoice([]string{ - "这名女生,你的身体很健康哦!", - "WOW,真的凹进去了好多呢!", - "你已经是我们女孩子的一员啦!", - })) - case niuniu <= -10: - result.WriteString(randomChoice([]string{ - "你已经是一名女生了呢,", - "从女生的角度来说,你发育良好(,", - "你醒啦?你已经是一名女孩子啦!", - "唔...可以放进去一根手指了都...", - })) + case niuniu > 0: + for i, info := range niuniuList.sortUsersByLength() { + if info.UID == uid { + ranking = i + 1 + break + } + } case niuniu <= 0: - result.WriteString(randomChoice([]string{ - "安了安了,不要伤心嘛,做女生有什么不好的啊。", - "不哭不哭,摸摸头,虽然很难再长出来,但是请不要伤心啦啊!", - "加油加油!我看好你哦!", - "你醒啦?你现在已经是一名女孩子啦!", - })) - case niuniu <= 10: - result.WriteString(randomChoice([]string{ - "你行不行啊?细狗!", - "虽然短,但是小小的也很可爱呢。", - "像一只蚕宝宝。", - "长大了。", - })) - case niuniu <= 25: - result.WriteString(randomChoice([]string{ - "唔...没话说", - "已经很长了呢!", - })) - case niuniu <= 50: - result.WriteString(randomChoice([]string{ - "话说这种真的有可能吗?", - "厚礼谢!", - })) - case niuniu <= 100: - result.WriteString(randomChoice([]string{ - "已经突破天际了嘛...", - "唔...这玩意应该不会变得比我高吧?", - "你这个长度会死人的...!", - "你马上要进化成牛头人了!!", - "你是什么怪物,不要过来啊!!", - })) - case niuniu > 100: - result.WriteString("惊世骇俗!你已经进化成牛头人了!牛头人在击剑时有20%的几率消耗自身长度吞噬对方牛牛呢。") + for i, info := range niuniuList.sortUsersByNegativeLength() { + if info.UID == uid { + ranking = i + 1 + break + } + } } - ctx.SendChain(message.At(uid), message.Text(result.String())) + result.WriteString(fmt.Sprintf("\n📛%s<%s>的牛牛信息\n⭕性别:%s\n⭕%s度:%.2fcm\n⭕排行:%d\n⭕%s ", + ctx.CardOrNickName(uid), strconv.FormatInt(uid, 10), + sex, sexLong, niuniu, ranking, generateRandomString(niuniu))) + ctx.SendChain(message.At(uid), message.Text(&result)) }) en.OnFullMatchGroup([]string{"dj", "打胶"}, zero.OnlyGroup, getdb).SetBlock(true).Limit(func(ctx *zero.Ctx) *rate.Limiter { - return dajiaoLimiter.Load(fmt.Sprintf("dj%d%d", ctx.Event.GroupID, ctx.Event.UserID)) + return dajiaoLimiter.Load(fmt.Sprintf("dj%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) }, func(ctx *zero.Ctx) { - lt := dajiaoLimiter.Load(fmt.Sprintf("dj%d%d", ctx.Event.GroupID, ctx.Event.UserID)) + lt := dajiaoLimiter.Load(fmt.Sprintf("dj%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) timePass := lt.LastTouch() - messages1 := []string{ + ctx.SendChain(message.Text(randomChoice([]string{ fmt.Sprintf("才过去了%ds时间,你就又要打🦶了,身体受得住吗", timePass), fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 90-timePass), fmt.Sprintf("休息一下吧,会炸膛的!%ds后再来吧", 90-timePass), fmt.Sprintf("打咩哟,你的牛牛会爆炸的,休息%ds再来吧", 90-timePass), - } - ctx.SendChain(message.Text(randomChoice(messages1))) + }))) }).Handle(func(ctx *zero.Ctx) { // 获取群号和用户ID gid := ctx.Event.GroupID @@ -183,44 +142,12 @@ func init() { ctx.SendChain(message.Text("请先注册牛牛!")) return } - probability := rand.Intn(100 + 1) - reduce := math.Abs(hitGlue(decimal.NewFromFloat(niuniu))) - switch { - case probability <= 40: - niuniu += reduce - r := rand.Intn(2) - ctx.SendChain(message.Text([]string{ - fmt.Sprintf("你嘿咻嘿咻一下,促进了牛牛发育,牛牛增加%.2fcm了呢!", reduce), - fmt.Sprintf("你打了个舒服痛快的🦶呐,牛牛增加了%.2fcm呢!", reduce), - }[r])) - case probability <= 60: - r := rand.Intn(2) - ctx.SendChain(message.Text([]string{ - "你打了个🦶,但是什么变化也没有,好奇怪捏~", - "你的牛牛刚开始变长了,可过了一会又回来了,什么变化也没有,好奇怪捏~", - }[r])) - default: - niuniu -= reduce - r := rand.Intn(3) - if niuniu < 0 { - ctx.SendChain(message.Text([]string{ - fmt.Sprintf("哦吼!?看来你的牛牛凹进去了%.2fcm呢!", reduce), - fmt.Sprintf("你突发恶疾!你的牛牛凹进去了%.2fcm!", reduce), - fmt.Sprintf("笑死,你因为打🦶过度导致牛牛凹进去了%.2fcm!🤣🤣🤣", reduce), - }[r])) - } else { - ctx.SendChain(message.Text([]string{ - fmt.Sprintf("阿哦,你过度打🦶,牛牛缩短%.2fcm了呢!", reduce), - fmt.Sprintf("你的牛牛变长了很多,你很激动地继续打🦶,然后牛牛缩短了%.2fcm呢!", reduce), - fmt.Sprintf("小打怡情,大打伤身,强打灰飞烟灭!你过度打🦶,牛牛缩短了%.2fcm捏!", reduce), - }[r])) - } - } + messages, f := generateRandomStingTwo(niuniu) u := userInfo{ UID: uid, - Length: niuniu, - ID: 1, + Length: f, } + ctx.SendChain(message.Text(messages)) if err = db.insertniuniu(u, gid); err != nil { ctx.SendChain(message.Text("ERROR:", err)) return @@ -234,11 +161,11 @@ func init() { return } //获取初始长度 - long := db.randomLong().InexactFloat64() + long := db.randLength().InexactFloat64() u := userInfo{ - UID: uid, - Length: long, - ID: 1, + UID: uid, + Length: long, + UserCount: 1, } //添加数据进入表 err := db.insertniuniu(u, gid) @@ -259,9 +186,9 @@ func init() { }) en.OnRegex(`jj\[CQ:at,qq=([0-9]+)\].*`, getdb, zero.OnlyGroup).SetBlock(true).Limit(func(ctx *zero.Ctx) *rate.Limiter { - return jjLimiter.Load(fmt.Sprintf("jj%d%d", ctx.Event.GroupID, ctx.Event.UserID)) + return jjLimiter.Load(fmt.Sprintf("jj%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) }, func(ctx *zero.Ctx) { - lt := jjLimiter.Load(fmt.Sprintf("jj%d%d", ctx.Event.GroupID, ctx.Event.UserID)) + lt := jjLimiter.Load(fmt.Sprintf("jj%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) timePass := lt.LastTouch() if lt.Acquire() { ctx.SendChain(message.Text(randomChoice([]string{ @@ -307,7 +234,7 @@ func init() { } ctx.SendChain(message.At(uid), message.Text(fencingResult)) }) - en.OnFullMatch("注销牛牛", getdb, zero.OnlyGroup).SetBlock(false).Handle(func(ctx *zero.Ctx) { + en.OnFullMatch("注销牛牛", getdb, zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) { uid := ctx.Event.UserID gid := ctx.Event.GroupID _, err := db.findniuniu(gid, uid) @@ -327,19 +254,3 @@ func init() { func randomChoice(options []string) string { return options[rand.Intn(len(options))] } - -// 牛子深度 -func sortUsersByNegativeLength(users []userInfo) []userInfo { - sort.Slice(users, func(i, j int) bool { - return math.Abs(users[i].Length) > math.Abs(users[j].Length) - }) - return users -} - -// 牛子长度 -func sortUsersByLength(users []userInfo) []userInfo { - sort.Slice(users, func(i, j int) bool { - return users[i].Length > users[j].Length - }) - return users -} From 79b84cbcc7c60d3c2977fcc02c927d29c2fd9a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Tue, 20 Aug 2024 23:09:08 +0800 Subject: [PATCH 29/58] Update main.go --- plugin/niuniu/main.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index e75a6645f5..5a9df368f9 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -59,12 +59,7 @@ func init() { ctx.SendChain(message.Text("ERROR: ", err)) return } - var m []userInfo - for _, info := range niuniuList { - if info.Length <= 0 { - m = append(m, *info) - } - } + m := niuniuList.newNegative() if m == nil { ctx.SendChain(message.Text("暂时没有女孩子哦")) return From 37b3f4879e6101e3e9e27b2ce63999cba4a32b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Tue, 20 Aug 2024 23:11:16 +0800 Subject: [PATCH 30/58] Update main.go --- plugin/niuniu/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 5a9df368f9..002774d8ea 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -50,7 +50,7 @@ func init() { messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcm\n", i+1, ctx.CardOrNickName(user.UID), user.Length)) } - ctx.SendChain(message.Text(messages.String())) + ctx.SendChain(message.Text(&messages)) }) en.OnFullMatch("牛子深度排行", zero.OnlyGroup, getdb).SetBlock(true).Handle(func(ctx *zero.Ctx) { gid := ctx.Event.GroupID From 804b72489e6e94beb4e43286e81db38bc6edc231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Wed, 21 Aug 2024 07:14:37 +0800 Subject: [PATCH 31/58] Update main.go --- plugin/niuniu/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 002774d8ea..a8cf40f42e 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -212,7 +212,7 @@ func init() { ctx.SendChain(message.At(uid), message.Text("对方还没有牛牛呢,不能🤺")) return } - if myniuniu == adduserniuniu { + if uid == adduser { ctx.SendChain(message.Text("你要和谁🤺?你自己吗?")) return } From 46f91318f61d3576ed8ed3112052dbc0e63edf18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Wed, 21 Aug 2024 23:26:20 +0800 Subject: [PATCH 32/58] Rename untils.go to utils.go --- plugin/niuniu/{untils.go => utils.go} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename plugin/niuniu/{untils.go => utils.go} (100%) diff --git a/plugin/niuniu/untils.go b/plugin/niuniu/utils.go similarity index 100% rename from plugin/niuniu/untils.go rename to plugin/niuniu/utils.go From b46cd4d0524f3caf37c04a9b2002c1a9db64312a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:54:43 +0800 Subject: [PATCH 33/58] Update main.go --- plugin/niuniu/main.go | 60 ++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 38 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index a8cf40f42e..2ec3968069 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -39,14 +39,14 @@ func init() { ctx.SendChain(message.Text("ERROR: ", err)) return } - m := niuniuList.newPositive() + m := niuniuList.positive() if m == nil { ctx.SendChain(message.Text("暂时没有男孩子哦")) return } var messages strings.Builder messages.WriteString("牛子长度排行\n") - for i, user := range niuniuList.sortUsersByLength() { + for i, user := range niuniuList.sort(true) { messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcm\n", i+1, ctx.CardOrNickName(user.UID), user.Length)) } @@ -59,14 +59,14 @@ func init() { ctx.SendChain(message.Text("ERROR: ", err)) return } - m := niuniuList.newNegative() + m := niuniuList.negative() if m == nil { ctx.SendChain(message.Text("暂时没有女孩子哦")) return } var messages strings.Builder messages.WriteString("牛牛深度排行榜\n") - for i, user := range niuniuList.sortUsersByNegativeLength() { + for i, user := range niuniuList.sort(false) { messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcm\n", i+1, ctx.CardOrNickName(user.UID), user.Length)) } @@ -94,34 +94,19 @@ func init() { ctx.SendChain(message.Text("ERROR:", err)) return } - var ranking int - switch { - case niuniu > 0: - for i, info := range niuniuList.sortUsersByLength() { - if info.UID == uid { - ranking = i + 1 - break - } - } - case niuniu <= 0: - for i, info := range niuniuList.sortUsersByNegativeLength() { - if info.UID == uid { - ranking = i + 1 - break - } - } - } + result.WriteString(fmt.Sprintf("\n📛%s<%s>的牛牛信息\n⭕性别:%s\n⭕%s度:%.2fcm\n⭕排行:%d\n⭕%s ", ctx.CardOrNickName(uid), strconv.FormatInt(uid, 10), - sex, sexLong, niuniu, ranking, generateRandomString(niuniu))) + sex, sexLong, niuniu, rankingResult(niuniu, niuniuList, uid), generateRandomString(niuniu))) ctx.SendChain(message.At(uid), message.Text(&result)) }) en.OnFullMatchGroup([]string{"dj", "打胶"}, zero.OnlyGroup, getdb).SetBlock(true).Limit(func(ctx *zero.Ctx) *rate.Limiter { - return dajiaoLimiter.Load(fmt.Sprintf("dj%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) + lt := dajiaoLimiter.Load(fmt.Sprintf("%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) + ctx.State["dajiao_last_touch"] = lt.LastTouch() + return lt }, func(ctx *zero.Ctx) { - lt := dajiaoLimiter.Load(fmt.Sprintf("dj%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) - timePass := lt.LastTouch() + timePass := ctx.State["dajiao_last_touch"].(int64) ctx.SendChain(message.Text(randomChoice([]string{ fmt.Sprintf("才过去了%ds时间,你就又要打🦶了,身体受得住吗", timePass), fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 90-timePass), @@ -179,20 +164,19 @@ func init() { ctx.SendChain(message.Reply(ctx.Event.GroupID), message.Text("注册成功,你的牛牛现在有", u.Length, "cm")) }) - en.OnRegex(`jj\[CQ:at,qq=([0-9]+)\].*`, getdb, + en.OnRegex(`jj\[CQ:at,(?:\S*,)?qq=(\d+)(?:,\S*)?\]`, getdb, zero.OnlyGroup).SetBlock(true).Limit(func(ctx *zero.Ctx) *rate.Limiter { - return jjLimiter.Load(fmt.Sprintf("jj%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) + lt := jjLimiter.Load(fmt.Sprintf("%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) + ctx.State["jj_last_touch"] = lt.LastTouch() + return lt }, func(ctx *zero.Ctx) { - lt := jjLimiter.Load(fmt.Sprintf("jj%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) - timePass := lt.LastTouch() - if lt.Acquire() { - ctx.SendChain(message.Text(randomChoice([]string{ - fmt.Sprintf("才过去了%ds时间,你就又要击剑了,真是饥渴难耐啊", timePass), - fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 150-timePass), - fmt.Sprintf("你这种男同就应该被送去集中营!等待%ds再来吧", 150-timePass), - fmt.Sprintf("打咩哟!你的牛牛会炸的,休息%ds再来吧", 150-timePass), - }))) - } + timePass := ctx.State["jj_last_touch"].(int64) + ctx.SendChain(message.Text(randomChoice([]string{ + fmt.Sprintf("才过去了%ds时间,你就又要击剑了,真是饥渴难耐啊", timePass), + fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 150-timePass), + fmt.Sprintf("你这种男同就应该被送去集中营!等待%ds再来吧", 150-timePass), + fmt.Sprintf("打咩哟!你的牛牛会炸的,休息%ds再来吧", 150-timePass), + }))) }, ).Handle(func(ctx *zero.Ctx) { adduser, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) @@ -212,7 +196,7 @@ func init() { ctx.SendChain(message.At(uid), message.Text("对方还没有牛牛呢,不能🤺")) return } - if uid == adduser { + if myniuniu == adduserniuniu { ctx.SendChain(message.Text("你要和谁🤺?你自己吗?")) return } From ef21807b14ac60967dc31ab93eec589508b9579d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:55:04 +0800 Subject: [PATCH 34/58] Update model.go --- plugin/niuniu/model.go | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/plugin/niuniu/model.go b/plugin/niuniu/model.go index 8a3bacc7e1..5a486d7278 100644 --- a/plugin/niuniu/model.go +++ b/plugin/niuniu/model.go @@ -39,9 +39,9 @@ var ( }) ) -func (m users) newPositive() []userInfo { +func (m *users) positive() []userInfo { var m1 []userInfo - for _, i2 := range m { + for _, i2 := range *m { if i2.Length > 0 { m1 = append(m1, *i2) } @@ -49,9 +49,9 @@ func (m users) newPositive() []userInfo { return m1 } -func (m users) newNegative() []userInfo { +func (m *users) negative() []userInfo { var m1 []userInfo - for _, i2 := range m { + for _, i2 := range *m { if i2.Length <= 0 { m1 = append(m1, *i2) } @@ -59,24 +59,15 @@ func (m users) newNegative() []userInfo { return m1 } -// 牛子深度 -func (m users) sortUsersByNegativeLength() users { - sort.Slice(m, func(i, j int) bool { - return m[i].Length > m[j].Length - }) - var newUsers []*userInfo - for i := len(m); i >= 0; i-- { - newUsers = append(newUsers, m[i]) - } - return newUsers -} - -// 牛子长度 -func (m users) sortUsersByLength() users { - sort.Slice(m, func(i, j int) bool { - return m[i].Length > m[j].Length +func (m *users) sort(isDesc bool) users { + m1 := *m + sort.Slice(m1, func(i, j int) bool { + if isDesc { + return m1[i].Length > m1[j].Length + } + return m1[i].Length < m1[j].Length }) - return m + return m1 } func (db *model) randLength() decimal.Decimal { From 4d00448b6a45a9c76cc11bc39b6ee9fc64300cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:55:26 +0800 Subject: [PATCH 35/58] Update utils.go --- plugin/niuniu/utils.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/plugin/niuniu/utils.go b/plugin/niuniu/utils.go index 47834721cd..c58091b28b 100644 --- a/plugin/niuniu/utils.go +++ b/plugin/niuniu/utils.go @@ -9,6 +9,27 @@ import ( "time" ) +func rankingResult(niuniu float64, niuniuList users, uid int64) int { + var ranking int + switch { + case niuniu > 0: + for i, info := range niuniuList.sort(true) { + if info.UID == uid { + ranking = i + 1 + break + } + } + case niuniu <= 0: + for i, info := range niuniuList.sort(false) { + if info.UID == uid { + ranking = i + 1 + break + } + } + } + return ranking +} + func generateRandomStingTwo(niuniu float64) (string, float64) { probability := rand.Intn(100 + 1) reduce := math.Abs(hitGlue(decimal.NewFromFloat(niuniu))) From 992f9a823074db3fc7e38343b3a632baaaa62360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Thu, 22 Aug 2024 22:46:04 +0800 Subject: [PATCH 36/58] Update main.go --- plugin/niuniu/main.go | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 2ec3968069..0eafbcbe67 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -97,7 +97,7 @@ func init() { result.WriteString(fmt.Sprintf("\n📛%s<%s>的牛牛信息\n⭕性别:%s\n⭕%s度:%.2fcm\n⭕排行:%d\n⭕%s ", ctx.CardOrNickName(uid), strconv.FormatInt(uid, 10), - sex, sexLong, niuniu, rankingResult(niuniu, niuniuList, uid), generateRandomString(niuniu))) + sex, sexLong, niuniu, niuniuList.ranking(niuniu, uid), generateRandomString(niuniu))) ctx.SendChain(message.At(uid), message.Text(&result)) }) en.OnFullMatchGroup([]string{"dj", "打胶"}, zero.OnlyGroup, @@ -128,7 +128,7 @@ func init() { Length: f, } ctx.SendChain(message.Text(messages)) - if err = db.insertniuniu(u, gid); err != nil { + if err = db.insertniuniu(&u, gid); err != nil { ctx.SendChain(message.Text("ERROR:", err)) return } @@ -148,14 +148,14 @@ func init() { UserCount: 1, } //添加数据进入表 - err := db.insertniuniu(u, gid) + err := db.insertniuniu(&u, gid) if err != nil { err = db.createGIDTable(gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return } - err = db.insertniuniu(u, gid) + err = db.insertniuniu(&u, gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return @@ -164,7 +164,7 @@ func init() { ctx.SendChain(message.Reply(ctx.Event.GroupID), message.Text("注册成功,你的牛牛现在有", u.Length, "cm")) }) - en.OnRegex(`jj\[CQ:at,(?:\S*,)?qq=(\d+)(?:,\S*)?\]`, getdb, + en.OnRegex(`jj\[CQ:at,(?:\S*,)?qq=(\d+)(?:,\S*)?\]|(\d+))`, getdb, zero.OnlyGroup).SetBlock(true).Limit(func(ctx *zero.Ctx) *rate.Limiter { lt := jjLimiter.Load(fmt.Sprintf("%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) ctx.State["jj_last_touch"] = lt.LastTouch() @@ -179,11 +179,8 @@ func init() { }))) }, ).Handle(func(ctx *zero.Ctx) { - adduser, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) - if err != nil { - ctx.SendChain(message.Text("ERROR:", err)) - return - } + fiancee := ctx.State["regex_matched"].([]string) + adduser, _ := strconv.ParseInt(fiancee[2]+fiancee[3], 10, 64) uid := ctx.Event.UserID gid := ctx.Event.GroupID myniuniu, err := db.findniuniu(gid, uid) @@ -196,17 +193,17 @@ func init() { ctx.SendChain(message.At(uid), message.Text("对方还没有牛牛呢,不能🤺")) return } - if myniuniu == adduserniuniu { + if uid == adduser { ctx.SendChain(message.Text("你要和谁🤺?你自己吗?")) return } fencingResult, f, f1 := fencing(myniuniu, adduserniuniu) - err = db.insertniuniu(userInfo{UID: uid, Length: f}, gid) + err = db.insertniuniu(&userInfo{UID: uid, Length: f}, gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return } - err = db.insertniuniu(userInfo{UID: adduser, Length: f1}, gid) + err = db.insertniuniu(&userInfo{UID: adduser, Length: f1}, gid) if err != nil { ctx.SendChain(message.Text("ERROR:", err)) return From d9255df7c62e2e7abde54526295bdc1f964f212a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Thu, 22 Aug 2024 22:46:27 +0800 Subject: [PATCH 37/58] Update model.go --- plugin/niuniu/model.go | 52 ++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/plugin/niuniu/model.go b/plugin/niuniu/model.go index 5a486d7278..bfacde2499 100644 --- a/plugin/niuniu/model.go +++ b/plugin/niuniu/model.go @@ -39,9 +39,9 @@ var ( }) ) -func (m *users) positive() []userInfo { +func (m users) positive() []userInfo { var m1 []userInfo - for _, i2 := range *m { + for _, i2 := range m { if i2.Length > 0 { m1 = append(m1, *i2) } @@ -49,9 +49,9 @@ func (m *users) positive() []userInfo { return m1 } -func (m *users) negative() []userInfo { +func (m users) negative() []userInfo { var m1 []userInfo - for _, i2 := range *m { + for _, i2 := range m { if i2.Length <= 0 { m1 = append(m1, *i2) } @@ -59,15 +59,39 @@ func (m *users) negative() []userInfo { return m1 } -func (m *users) sort(isDesc bool) users { - m1 := *m - sort.Slice(m1, func(i, j int) bool { - if isDesc { - return m1[i].Length > m1[j].Length +func (m users) sort(isDesc bool) users { + var t func(i, j int) bool + if isDesc { + t = func(i, j int) bool { + return m[i].Length > m[j].Length } - return m1[i].Length < m1[j].Length - }) - return m1 + } else { + t = func(i, j int) bool { + return m[i].Length < m[j].Length + } + } + sort.Slice(m, t) + return m +} +func (m users) ranking(niuniu float64, uid int64) int { + var ranking int + switch { + case niuniu > 0: + for i, info := range m.sort(true) { + if info.UID == uid { + ranking = i + 1 + break + } + } + default: + for i, info := range m.sort(false) { + if info.UID == uid { + ranking = i + 1 + break + } + } + } + return ranking } func (db *model) randLength() decimal.Decimal { @@ -88,10 +112,10 @@ func (db *model) findniuniu(gid, uid int64) (float64, error) { return u.Length, err } -func (db *model) insertniuniu(u userInfo, gid int64) error { +func (db *model) insertniuniu(u *userInfo, gid int64) error { db.Lock() defer db.Unlock() - return db.sql.Insert(strconv.FormatInt(gid, 10), &u) + return db.sql.Insert(strconv.FormatInt(gid, 10), u) } func (db *model) deleteniuniu(gid, uid int64) error { From 11ec9585f7aadc305f05e9d1a13027724f35bec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Thu, 22 Aug 2024 22:46:50 +0800 Subject: [PATCH 38/58] Update utils.go --- plugin/niuniu/utils.go | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/plugin/niuniu/utils.go b/plugin/niuniu/utils.go index c58091b28b..3bf19f0d61 100644 --- a/plugin/niuniu/utils.go +++ b/plugin/niuniu/utils.go @@ -9,27 +9,6 @@ import ( "time" ) -func rankingResult(niuniu float64, niuniuList users, uid int64) int { - var ranking int - switch { - case niuniu > 0: - for i, info := range niuniuList.sort(true) { - if info.UID == uid { - ranking = i + 1 - break - } - } - case niuniu <= 0: - for i, info := range niuniuList.sort(false) { - if info.UID == uid { - ranking = i + 1 - break - } - } - } - return ranking -} - func generateRandomStingTwo(niuniu float64) (string, float64) { probability := rand.Intn(100 + 1) reduce := math.Abs(hitGlue(decimal.NewFromFloat(niuniu))) @@ -212,6 +191,5 @@ func hitGlue(l decimal.Decimal) float64 { l = l.Sub(decimal.NewFromInt(1)) randomFactor := decimal.NewFromFloat(rand.Float64()) adjustedValue := randomFactor.Mul(l).Div(decimal.NewFromInt(2)) - f, _ := adjustedValue.Float64() - return f + return adjustedValue.InexactFloat64() } From d9299419de05398710a8d48feef19e8b10e49e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Thu, 22 Aug 2024 23:11:43 +0800 Subject: [PATCH 39/58] Update utils.go --- plugin/niuniu/utils.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugin/niuniu/utils.go b/plugin/niuniu/utils.go index 3bf19f0d61..0b5e7635bc 100644 --- a/plugin/niuniu/utils.go +++ b/plugin/niuniu/utils.go @@ -138,10 +138,7 @@ func fencing(myLength, oppoLength float64) (string, float64, float64) { func determineResultBySkill(myLength, oppoLength float64) (string, float64, float64) { probability := rand.Intn(100) + 1 winProbability := calculateWinProbability(myLength, oppoLength) * 100 - if 0 < probability && float64(probability) <= winProbability { - return applySkill(myLength, oppoLength, true) - } - return applySkill(myLength, oppoLength, false) + return applySkill(myLength, oppoLength, 0 < probability && float64(probability) <= winProbability) } // calculateWinProbability 计算胜率 From e83e2dccf4ad1b481ca8998cff7c31fceee74a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Fri, 23 Aug 2024 07:07:29 +0800 Subject: [PATCH 40/58] Update main.go --- plugin/niuniu/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 0eafbcbe67..4ee1a5c1e8 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -164,7 +164,7 @@ func init() { ctx.SendChain(message.Reply(ctx.Event.GroupID), message.Text("注册成功,你的牛牛现在有", u.Length, "cm")) }) - en.OnRegex(`jj\[CQ:at,(?:\S*,)?qq=(\d+)(?:,\S*)?\]|(\d+))`, getdb, + en.OnRegex(`jj\[CQ:at,(?:\S*,)?qq=(\d+)(?:,\S*)?\]|(\d+)`, getdb, zero.OnlyGroup).SetBlock(true).Limit(func(ctx *zero.Ctx) *rate.Limiter { lt := jjLimiter.Load(fmt.Sprintf("%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) ctx.State["jj_last_touch"] = lt.LastTouch() From 117d56ba59d7b02b4188fd0c3ea64084ccad40b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 25 Aug 2024 09:38:47 +0800 Subject: [PATCH 41/58] Update model.go --- plugin/niuniu/model.go | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/plugin/niuniu/model.go b/plugin/niuniu/model.go index bfacde2499..23ac97e550 100644 --- a/plugin/niuniu/model.go +++ b/plugin/niuniu/model.go @@ -60,38 +60,26 @@ func (m users) negative() []userInfo { } func (m users) sort(isDesc bool) users { - var t func(i, j int) bool + t := func(i, j int) bool { + return m[i].UserCount < m[j].UserCount + } if isDesc { t = func(i, j int) bool { return m[i].Length > m[j].Length } - } else { - t = func(i, j int) bool { - return m[i].Length < m[j].Length - } } sort.Slice(m, t) return m } + func (m users) ranking(niuniu float64, uid int64) int { - var ranking int - switch { - case niuniu > 0: - for i, info := range m.sort(true) { - if info.UID == uid { - ranking = i + 1 - break - } - } - default: - for i, info := range m.sort(false) { - if info.UID == uid { - ranking = i + 1 - break - } + result := niuniu > 0 + for i, user := range m.sort(result) { + if user.UID == uid { + return i + 1 } } - return ranking + return -1 } func (db *model) randLength() decimal.Decimal { From 1c3fbead7e70610204f1b177e1990354de6025b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 25 Aug 2024 09:45:02 +0800 Subject: [PATCH 42/58] Update main.go --- plugin/niuniu/main.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 4ee1a5c1e8..09a57c1286 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -5,6 +5,7 @@ import ( "fmt" ctrl "github.com/FloatTech/zbpctrl" "github.com/FloatTech/zbputils/control" + "github.com/FloatTech/zbputils/ctxext" zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/extension/rate" "github.com/wdvxdr1123/ZeroBot/message" @@ -70,10 +71,10 @@ func init() { messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcm\n", i+1, ctx.CardOrNickName(user.UID), user.Length)) } - - ctx.SendChain(message.Text(&messages)) + if id := ctx.Send(ctxext.FakeSenderForwardNode(ctx, message.Text(&messages))).ID(); id == 0 { + ctx.Send(message.Text("发送排行失败")) + } }) - en.OnFullMatch("查看我的牛牛", getdb, zero.OnlyGroup).SetBlock(true).Handle(func(ctx *zero.Ctx) { uid := ctx.Event.UserID gid := ctx.Event.GroupID @@ -94,7 +95,6 @@ func init() { ctx.SendChain(message.Text("ERROR:", err)) return } - result.WriteString(fmt.Sprintf("\n📛%s<%s>的牛牛信息\n⭕性别:%s\n⭕%s度:%.2fcm\n⭕排行:%d\n⭕%s ", ctx.CardOrNickName(uid), strconv.FormatInt(uid, 10), sex, sexLong, niuniu, niuniuList.ranking(niuniu, uid), generateRandomString(niuniu))) @@ -164,7 +164,7 @@ func init() { ctx.SendChain(message.Reply(ctx.Event.GroupID), message.Text("注册成功,你的牛牛现在有", u.Length, "cm")) }) - en.OnRegex(`jj\[CQ:at,(?:\S*,)?qq=(\d+)(?:,\S*)?\]|(\d+)`, getdb, + en.OnRegex(`jj\[CQ:at,qq=(\d+),name=[\s\S]*\]$`, getdb, zero.OnlyGroup).SetBlock(true).Limit(func(ctx *zero.Ctx) *rate.Limiter { lt := jjLimiter.Load(fmt.Sprintf("%d_%d", ctx.Event.GroupID, ctx.Event.UserID)) ctx.State["jj_last_touch"] = lt.LastTouch() @@ -179,8 +179,11 @@ func init() { }))) }, ).Handle(func(ctx *zero.Ctx) { - fiancee := ctx.State["regex_matched"].([]string) - adduser, _ := strconv.ParseInt(fiancee[2]+fiancee[3], 10, 64) + adduser, err := strconv.ParseInt(ctx.State["regex_matched"].([]string)[1], 10, 64) + if err != nil { + ctx.SendChain(message.Text("ERROR:", err)) + return + } uid := ctx.Event.UserID gid := ctx.Event.GroupID myniuniu, err := db.findniuniu(gid, uid) From 0ffe2d48dd47ef8741e553c45386cbaaf7c20338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 25 Aug 2024 11:42:04 +0800 Subject: [PATCH 43/58] Update main.go --- plugin/niuniu/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 09a57c1286..1b8c79437a 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -106,7 +106,7 @@ func init() { ctx.State["dajiao_last_touch"] = lt.LastTouch() return lt }, func(ctx *zero.Ctx) { - timePass := ctx.State["dajiao_last_touch"].(int64) + timePass := int(time.Since(time.Unix(ctx.State["dajiao_last_touch"].(int64), 0)).Seconds()) ctx.SendChain(message.Text(randomChoice([]string{ fmt.Sprintf("才过去了%ds时间,你就又要打🦶了,身体受得住吗", timePass), fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 90-timePass), @@ -170,7 +170,7 @@ func init() { ctx.State["jj_last_touch"] = lt.LastTouch() return lt }, func(ctx *zero.Ctx) { - timePass := ctx.State["jj_last_touch"].(int64) + timePass := int(time.Since(time.Unix(ctx.State["jj_last_touch"].(int64), 0)).Seconds()) ctx.SendChain(message.Text(randomChoice([]string{ fmt.Sprintf("才过去了%ds时间,你就又要击剑了,真是饥渴难耐啊", timePass), fmt.Sprintf("不行不行,你的身体会受不了的,歇%ds再来吧", 150-timePass), From a9c9234157c5d63ffbe8e9899d5661017b44a4d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 25 Aug 2024 11:43:04 +0800 Subject: [PATCH 44/58] Update main.go --- plugin/niuniu/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 1b8c79437a..39a54d6a3f 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -51,7 +51,9 @@ func init() { messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcm\n", i+1, ctx.CardOrNickName(user.UID), user.Length)) } - ctx.SendChain(message.Text(&messages)) + if id := ctx.Send(ctxext.FakeSenderForwardNode(ctx, message.Text(&messages))).ID(); id == 0 { + ctx.Send(message.Text("发送排行失败")) + } }) en.OnFullMatch("牛子深度排行", zero.OnlyGroup, getdb).SetBlock(true).Handle(func(ctx *zero.Ctx) { gid := ctx.Event.GroupID From e70f47344016b1acbe8c54609496763f96aaf038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 25 Aug 2024 11:44:33 +0800 Subject: [PATCH 45/58] Update main.go --- plugin/niuniu/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 39a54d6a3f..d73a4aa99a 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -147,7 +147,7 @@ func init() { u := userInfo{ UID: uid, Length: long, - UserCount: 1, + UserCount: 0, } //添加数据进入表 err := db.insertniuniu(&u, gid) From bbeaf04c740d67fc6e1ad5f7621ab84f66b1ba5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 25 Aug 2024 11:44:53 +0800 Subject: [PATCH 46/58] Update model.go --- plugin/niuniu/model.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/niuniu/model.go b/plugin/niuniu/model.go index 23ac97e550..b54b472864 100644 --- a/plugin/niuniu/model.go +++ b/plugin/niuniu/model.go @@ -115,6 +115,6 @@ func (db *model) deleteniuniu(gid, uid int64) error { func (db *model) readAllTable(gid int64) (users, error) { db.Lock() defer db.Unlock() - a, err := sql.FindAll[userInfo](&db.sql, strconv.FormatInt(gid, 10), "where UserCount = 1") + a, err := sql.FindAll[userInfo](&db.sql, strconv.FormatInt(gid, 10), "where UserCount = 0") return a, err } From 0344d415f6abca47d369fbf5c6a77710c40c1673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 25 Aug 2024 14:08:15 +0800 Subject: [PATCH 47/58] Update main.go --- plugin/niuniu/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index d73a4aa99a..623ad2243c 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -51,7 +51,8 @@ func init() { messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcm\n", i+1, ctx.CardOrNickName(user.UID), user.Length)) } - if id := ctx.Send(ctxext.FakeSenderForwardNode(ctx, message.Text(&messages))).ID(); id == 0 { + msg := ctxext.FakeSenderForwardNode(ctx, message.Text(&messages)) + if id := ctx.Send(message.Message{msg}).ID(); id == 0 { ctx.Send(message.Text("发送排行失败")) } }) @@ -73,7 +74,8 @@ func init() { messages.WriteString(fmt.Sprintf("第%d名 id:%s 长度:%.2fcm\n", i+1, ctx.CardOrNickName(user.UID), user.Length)) } - if id := ctx.Send(ctxext.FakeSenderForwardNode(ctx, message.Text(&messages))).ID(); id == 0 { + msg := ctxext.FakeSenderForwardNode(ctx, message.Text(&messages)) + if id := ctx.Send(message.Message{msg}).ID(); id == 0 { ctx.Send(message.Text("发送排行失败")) } }) From 35a2d11ced95a7733226349c975e1c7efba3a116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 25 Aug 2024 22:26:45 +0800 Subject: [PATCH 48/58] Update README.md --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 05828a3393..01489bde01 100644 --- a/README.md +++ b/README.md @@ -593,6 +593,19 @@ print("run[CQ:image,file="+j["img"]+"]") - [x] 磕cp大老师 雪乃 + +
+ 牛牛大作战 + +`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/niuniu" ` + +- [x] 打胶 +- [x] jj[@xxx] +- [x] 注册牛牛 +- [x] 注销牛牛 +- [x] 牛子长度排行 +- [x] 牛子深度排行 +
今日早报 @@ -783,6 +796,7 @@ print("run[CQ:image,file="+j["img"]+"]") - [x] 系列一言
+
炉石 From a0a28a2b98101795242e65a9caa143dbf12e145b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 25 Aug 2024 22:27:59 +0800 Subject: [PATCH 49/58] Update main.go --- main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/main.go b/main.go index d21599c505..66f5d2b803 100644 --- a/main.go +++ b/main.go @@ -116,6 +116,7 @@ import ( _ "github.com/FloatTech/ZeroBot-Plugin/plugin/novel" // 铅笔小说网搜索 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nsfw" // nsfw图片识别 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nwife" // 本地老婆 + _ "github.com/FloatTech/ZeroBot-Plugin/plugin/niuniu" // 牛牛大作战 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/omikuji" // 浅草寺求签 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/poker" // 抽扑克 _ "github.com/FloatTech/ZeroBot-Plugin/plugin/qqwife" // 一群一天一夫一妻制群老婆 From df6e95df287bdf00c95a8818dc05c95bc7a9c325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Sun, 25 Aug 2024 22:32:56 +0800 Subject: [PATCH 50/58] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 01489bde01..5f510cf62b 100644 --- a/README.md +++ b/README.md @@ -605,7 +605,7 @@ print("run[CQ:image,file="+j["img"]+"]") - [x] 注销牛牛 - [x] 牛子长度排行 - [x] 牛子深度排行 - +- [x] 查看我的牛牛
今日早报 From 92721a5bbe03d7913c4f3e129d4937dd13e9d4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Mon, 26 Aug 2024 22:56:06 +0800 Subject: [PATCH 51/58] Update README.md --- README.md | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 5f510cf62b..ea17b50288 100644 --- a/README.md +++ b/README.md @@ -593,19 +593,6 @@ print("run[CQ:image,file="+j["img"]+"]") - [x] 磕cp大老师 雪乃 -
-
- 牛牛大作战 - -`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/niuniu" ` - -- [x] 打胶 -- [x] jj[@xxx] -- [x] 注册牛牛 -- [x] 注销牛牛 -- [x] 牛子长度排行 -- [x] 牛子深度排行 -- [x] 查看我的牛牛
今日早报 @@ -1081,6 +1068,26 @@ print("run[CQ:image,file="+j["img"]+"]") - [x] 当图片属于非 neutral 类别时自动发送评价(默认禁用,启用输入 /启用 nsfwauto) +
+
+ 牛牛大作战 + +`import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/niuniu" ` + +- [x] 打胶 + +- [x] jj[@xxx] + +- [x] 注册牛牛 + +- [x] 注销牛牛 + +- [x] 牛子长度排行 + +- [x] 牛子深度排行 + +- [x] 查看我的牛牛 +
浅草寺求签 From 903392cbb6a869777de7a6ca2f084fb6229b3447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Tue, 27 Aug 2024 19:20:15 +0800 Subject: [PATCH 52/58] Update README.md --- README.md | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index ea17b50288..1b36f9df17 100644 --- a/README.md +++ b/README.md @@ -783,7 +783,6 @@ print("run[CQ:image,file="+j["img"]+"]") - [x] 系列一言
-
炉石 @@ -1010,22 +1009,6 @@ print("run[CQ:image,file="+j["img"]+"]") - 注:刷新文件夹较慢,请耐心等待刷新完成,会提示“成功”。 -
-
- 抽wife - - `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nativewife"` - - - [x] 抽wife[@xxx] - - - [x] 添加wife[名字][图片] - - - [x] 删除wife[名字] - - - [x] [让 | 不让]所有人均可添加wife - - - 注:不同群添加后不会重叠 -
拼音首字母释义工具 @@ -1068,6 +1051,22 @@ print("run[CQ:image,file="+j["img"]+"]") - [x] 当图片属于非 neutral 类别时自动发送评价(默认禁用,启用输入 /启用 nsfwauto) +
+
+ 抽wife + + `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin/nwife"` + + - [x] 抽wife[@xxx] + + - [x] 添加wife[名字][图片] + + - [x] 删除wife[名字] + + - [x] [让 | 不让]所有人均可添加wife + + - 注:不同群添加后不会重叠 +
牛牛大作战 From 15a183733a7ad061ae1f01d65f4024c6598c32c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Wed, 28 Aug 2024 22:41:21 +0800 Subject: [PATCH 53/58] Update main.go --- plugin/niuniu/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index 623ad2243c..d37acb4fd5 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -124,6 +124,7 @@ func init() { niuniu, err := db.findniuniu(gid, uid) if err != nil { ctx.SendChain(message.Text("请先注册牛牛!")) + dajiaoLimiter.DeleteLimiter(fmt.Sprintf("%d_%d", gid, uid)) return } messages, f := generateRandomStingTwo(niuniu) @@ -193,15 +194,18 @@ func init() { myniuniu, err := db.findniuniu(gid, uid) if err != nil { ctx.SendChain(message.Text("你还没有牛牛快去注册一个吧!")) + jjLimiter.DeleteLimiter(fmt.Sprintf("%d_%d", gid, uid)) return } adduserniuniu, err := db.findniuniu(gid, adduser) if err != nil { ctx.SendChain(message.At(uid), message.Text("对方还没有牛牛呢,不能🤺")) + jjLimiter.DeleteLimiter(fmt.Sprintf("%d_%d", gid, uid)) return } if uid == adduser { ctx.SendChain(message.Text("你要和谁🤺?你自己吗?")) + jjLimiter.DeleteLimiter(fmt.Sprintf("%d_%d", gid, uid)) return } fencingResult, f, f1 := fencing(myniuniu, adduserniuniu) From c3f64060d8d5e6c4dace4f981dbb8453733aaffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Thu, 29 Aug 2024 19:09:57 +0800 Subject: [PATCH 54/58] Update main.go --- plugin/niuniu/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index d37acb4fd5..cc89a80296 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -194,18 +194,18 @@ func init() { myniuniu, err := db.findniuniu(gid, uid) if err != nil { ctx.SendChain(message.Text("你还没有牛牛快去注册一个吧!")) - jjLimiter.DeleteLimiter(fmt.Sprintf("%d_%d", gid, uid)) + jjLimiter.Delete(fmt.Sprintf("%d_%d", gid, uid)) return } adduserniuniu, err := db.findniuniu(gid, adduser) if err != nil { ctx.SendChain(message.At(uid), message.Text("对方还没有牛牛呢,不能🤺")) - jjLimiter.DeleteLimiter(fmt.Sprintf("%d_%d", gid, uid)) + jjLimiter.Delete(fmt.Sprintf("%d_%d", gid, uid)) return } if uid == adduser { ctx.SendChain(message.Text("你要和谁🤺?你自己吗?")) - jjLimiter.DeleteLimiter(fmt.Sprintf("%d_%d", gid, uid)) + jjLimiter.Delete(fmt.Sprintf("%d_%d", gid, uid)) return } fencingResult, f, f1 := fencing(myniuniu, adduserniuniu) From 1e96ecad49fd0626051a2710ad07903d31d2c08f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Thu, 29 Aug 2024 19:19:36 +0800 Subject: [PATCH 55/58] Update main.go --- plugin/niuniu/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index cc89a80296..a9286e681a 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -124,7 +124,7 @@ func init() { niuniu, err := db.findniuniu(gid, uid) if err != nil { ctx.SendChain(message.Text("请先注册牛牛!")) - dajiaoLimiter.DeleteLimiter(fmt.Sprintf("%d_%d", gid, uid)) + dajiaoLimiter.Delete(fmt.Sprintf("%d_%d", gid, uid)) return } messages, f := generateRandomStingTwo(niuniu) From e65f816af8220906eaf8cc44cc700eb9cda8b0e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Thu, 29 Aug 2024 23:13:29 +0800 Subject: [PATCH 56/58] Update model.go --- plugin/niuniu/model.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugin/niuniu/model.go b/plugin/niuniu/model.go index b54b472864..0f7462b1a2 100644 --- a/plugin/niuniu/model.go +++ b/plugin/niuniu/model.go @@ -4,7 +4,6 @@ package niuniu import ( fcext "github.com/FloatTech/floatbox/ctxext" sql "github.com/FloatTech/sqlite" - "github.com/shopspring/decimal" zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/message" "math/rand" @@ -82,8 +81,8 @@ func (m users) ranking(niuniu float64, uid int64) int { return -1 } -func (db *model) randLength() decimal.Decimal { - return decimal.NewFromFloat(float64(rand.Intn(9)+1) + float64(rand.Intn(100))/100) +func (db *model) randLength() float64 { + return float64(rand.Intn(9)+1) + (float64(rand.Intn(100)) / 100) } func (db *model) createGIDTable(gid int64) error { From 78669d579c41b6d5ec8363d361451ff29a9b671a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Thu, 29 Aug 2024 23:14:41 +0800 Subject: [PATCH 57/58] Update utils.go --- plugin/niuniu/utils.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/plugin/niuniu/utils.go b/plugin/niuniu/utils.go index 0b5e7635bc..77575e5fa8 100644 --- a/plugin/niuniu/utils.go +++ b/plugin/niuniu/utils.go @@ -3,7 +3,6 @@ package niuniu import ( "fmt" - "github.com/shopspring/decimal" "math" "math/rand" "time" @@ -11,7 +10,7 @@ import ( func generateRandomStingTwo(niuniu float64) (string, float64) { probability := rand.Intn(100 + 1) - reduce := math.Abs(hitGlue(decimal.NewFromFloat(niuniu))) + reduce := math.Abs(hitGlue(niuniu)) switch { case probability <= 40: niuniu += reduce @@ -138,13 +137,18 @@ func fencing(myLength, oppoLength float64) (string, float64, float64) { func determineResultBySkill(myLength, oppoLength float64) (string, float64, float64) { probability := rand.Intn(100) + 1 winProbability := calculateWinProbability(myLength, oppoLength) * 100 - return applySkill(myLength, oppoLength, 0 < probability && float64(probability) <= winProbability) + return applySkill(myLength, oppoLength, + 0 < probability && float64(probability) <= winProbability) } // calculateWinProbability 计算胜率 func calculateWinProbability(heightA, heightB float64) float64 { - //第一个接收参数初始概率 - pA := 0.9 + var pA float64 + if heightA > heightB { + pA = 0.7 + 0.2*(heightA-heightB)/heightA + } else { + pA = 0.6 - 0.2*(heightB-heightA)/heightB + } heightRatio := math.Max(heightA, heightB) / math.Min(heightA, heightB) reductionRate := 0.1 * (heightRatio - 1) reduction := pA * reductionRate @@ -158,7 +162,6 @@ func applySkill(myLength, oppoLength float64, increaseLength1 bool) (string, flo if increaseLength1 { myLength += reduce oppoLength -= 0.8 * reduce - if myLength < 0 { return fmt.Sprintf("哦吼!?你的牛牛在长大欸!长大了%.2fcm!", reduce), myLength, oppoLength } @@ -174,7 +177,7 @@ func applySkill(myLength, oppoLength float64, increaseLength1 bool) (string, flo } -// fence 简单模拟击剑技巧效果 +// fence func fence(rd float64) float64 { rd -= float64(time.Now().UnixNano() % 10) if rd > 1000000 { @@ -183,10 +186,7 @@ func fence(rd float64) float64 { return float64(int(rd * rand.Float64())) } -// hitGlue 调整传入的值 -func hitGlue(l decimal.Decimal) float64 { - l = l.Sub(decimal.NewFromInt(1)) - randomFactor := decimal.NewFromFloat(rand.Float64()) - adjustedValue := randomFactor.Mul(l).Div(decimal.NewFromInt(2)) - return adjustedValue.InexactFloat64() +func hitGlue(l float64) float64 { + return rand.Float64() * math.Log2(l) / 2 } + From f1982711000047320dd410370143f9f6c16c1513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=AE=87=E5=AE=87?= <158024940+xyy0411@users.noreply.github.com> Date: Thu, 29 Aug 2024 23:15:13 +0800 Subject: [PATCH 58/58] Update main.go --- plugin/niuniu/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin/niuniu/main.go b/plugin/niuniu/main.go index a9286e681a..5d04b218a1 100644 --- a/plugin/niuniu/main.go +++ b/plugin/niuniu/main.go @@ -9,7 +9,7 @@ import ( zero "github.com/wdvxdr1123/ZeroBot" "github.com/wdvxdr1123/ZeroBot/extension/rate" "github.com/wdvxdr1123/ZeroBot/message" - "golang.org/x/exp/rand" + "math/rand" "strconv" "strings" "time" @@ -146,7 +146,7 @@ func init() { return } //获取初始长度 - long := db.randLength().InexactFloat64() + long := db.randLength() u := userInfo{ UID: uid, Length: long, @@ -241,3 +241,4 @@ func init() { func randomChoice(options []string) string { return options[rand.Intn(len(options))] } +