diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index ad5510b0..4dbe5b27 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -5,11 +5,12 @@ jobs: name: lint_golangci-lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v2 - name: golangci-lint - uses: golangci/golangci-lint-action@v2.5.2 + uses: golangci/golangci-lint-action@v2 with: version: latest + args: --issues-exit-code=0 - name: Commit back continue-on-error: true run: | diff --git a/README.md b/README.md index 579c2c73..a7800ebf 100644 --- a/README.md +++ b/README.md @@ -45,33 +45,35 @@ - [x] 退出群聊[群号] - [x] *入群欢迎 - [x] *退群通知 - - [x] 在[月份]月[日期]日的[小时]点[分钟]分时(用[url])提醒大家[消息] - - [x] 在[月份]月[每周or周几]的[小时]点[分钟]分时(用[url])提醒大家[消息] - - [x] 取消在[月份]月[日期]日的[小时]点[分钟]分的提醒 - - [x] 取消在[月份]月[每周or周几]的[小时]点[分钟]分的提醒 + - [x] 设置欢迎语[欢迎~] + - [x] 在MM月dd日的hh点mm分时(用http://url)提醒大家xxx + - [x] 在MM月[每周|周几]的hh点mm分时(用http://url)提醒大家xxx + - [x] 取消在MM月dd日的hh点mm分的提醒 + - [x] 取消在MM月[每周|周几]的hh点mm分的提醒 - [x] 列出所有提醒 - [x] 翻牌 + - [x] [开启|关闭]入群验证 - [ ] 同意入群请求 - [ ] 同意好友请求 - [ ] 撤回[@xxx] [xxx] - [ ] 警告[@xxx] - [x] run[xxx] - **GitHub仓库搜索** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_github"` - - [x] >github [xxx] - - [x] >github -p [xxx] + - [x] >github [xxx] + - [x] >github -p [xxx] - **在线代码运行** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_runcode"` - [x] >runcode help - [x] >runcode [on/off] - - [x] >runcode [language] [code block] + - [x] >runcode [language] [code block] - **点歌** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_music"` - [x] 点歌[xxx] - [x] 网易点歌[xxx] - [x] 酷我点歌[xxx] - [x] 酷狗点歌[xxx] - **shindan** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_shindan"` - - [x] 今天是什么少女[@xxx] - - [x] 异世界转生[@xxx] - - [x] 卖萌[@xxx] + - [x] 今天是什么少女[@xxx] + - [x] 异世界转生[@xxx] + - [x] 卖萌[@xxx] - **涩图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_setutime"` - [x] 来份[涩图/二次元/风景/车万] - [x] 添加[涩图/二次元/风景/车万][P站图片ID] @@ -82,7 +84,7 @@ - **搜图** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_saucenao"` - [x] 以图搜图|搜索图片|以图识图[图片] - [x] 搜图[P站图片ID] -- **随机图片与AI点评** `github.com/FloatTech/ZeroBot-ACGImage` +- **随机图片与AI点评** `github.com/FloatTech/ZeroBot-Plugin/plugin_acgimage` - [x] 随机图片(评级大于6的图将私发) - [x] 直接随机(无r18检测,务必小心,仅管理可用) - [x] 设置随机图片网址[url] @@ -94,7 +96,7 @@ - [x] @BOT 小作文 - [x] @BOT 发大病 - [x] @BOT 教你一篇小作文[作文] -- **AIfalse** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_AIfalse"` +- **AIfalse** `import _ "github.com/FloatTech/ZeroBot-Plugin/plugin_ai_false"` - [x] 查询计算机当前活跃度 [身体检查] - [ ] 简易语音 - [ ] 爬图合成 [@xxx] @@ -114,11 +116,12 @@ | [yyuueexxiinngg/cqhttp-mirai](https://github.com/yyuueexxiinngg/cqhttp-mirai) | [Mirai](https://github.com/mamoe/mirai) | yyuueexxiinngg | | | [takayama-lily/onebot](https://github.com/takayama-lily/onebot) | [OICQ](https://github.com/takayama-lily/oicq) | takayama | | -### 使用稳定版 -可以前往[Release](https://github.com/FloatTech/ZeroBot-Plugin/releases)页面下载对应系统的稳定版,默认开启全部插件。 +### 使用稳定版/测试版 +> 需要将`data`目录放置到与编译好的可执行文件相同目录下才可正常执行。 +可以前往[Release](https://github.com/FloatTech/ZeroBot-Plugin/releases)页面下载对应系统版本可执行文件,编译时开启了全部插件。 ### 本地运行 -1. 下载安装 [Go](https://studygolang.com/dl/golang/go1.16.2.windows-amd64.msi) 环境 +1. 下载安装 [Go](https://studygolang.com/dl) 环境 2. 下载本项目[压缩包](https://github.com/Yiwen-Chan/ZeroBot-Plugin/archive/master.zip),本地解压 3. 编辑 main.go 文件,内容按需修改 4. 双击 build.bat 文件 或 直接双击 run.bat 文件 @@ -136,7 +139,7 @@ 6. 啾咪~ #### 本地编译/交叉编译 -1. 下载安装 [Go](https://studygolang.com/dl/golang/go1.16.2.windows-amd64.msi) 环境 +1. 下载安装 [Go](https://studygolang.com/dl) 环境 2. clone 并进入本项目,下载所需包 ```bash git clone --depth=1 https://github.com/FloatTech/ZeroBot-Plugin.git @@ -150,11 +153,11 @@ go mod tidy 4. 按照平台输入命令编译,下面举了两个不太常见的例子 ```bash # 本机平台 -go build -ldflags "-s -w -extldflags '-static-libgo'" -o zerobot +go build -ldflags "-s -w" -o zerobot # armv6 Linux 平台 如树莓派 zero W -GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=0 go build -ldflags "-s -w -extldflags '-static-libgo'" -o zerobot +GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=0 go build -ldflags "-s -w" -o zerobot # mips Linux 平台 如 路由器 wndr4300 -GOOS=linux GOARCH=mips GOMIPS=softfloat CGO_ENABLED=0 go build -ldflags "-s -w -extldflags '-static-libgo'" -o zerobot +GOOS=linux GOARCH=mips GOMIPS=softfloat CGO_ENABLED=0 go build -ldflags "-s -w" -o zerobot ``` 5. 运行 OneBot 框架,并同时运行本插件 diff --git a/go.mod b/go.mod index b30d36dc..5a9c1a07 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/FloatTech/ZeroBot-Plugin go 1.16 require ( - github.com/FloatTech/AnimeAPI v1.1.3 - github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.2 + github.com/FloatTech/AnimeAPI v1.1.5 + github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 github.com/StackExchange/wmi v1.2.1 // indirect github.com/golang/protobuf v1.5.2 github.com/robfig/cron v1.2.0 @@ -12,11 +12,7 @@ require ( github.com/sirupsen/logrus v1.8.1 github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 github.com/tidwall/gjson v1.8.1 - github.com/tidwall/pretty v1.2.0 // indirect github.com/tklauser/go-sysconf v0.3.7 // indirect github.com/wdvxdr1123/ZeroBot v1.2.2 - golang.org/x/text v0.3.6 // indirect - golang.org/x/tools v0.1.5 // indirect - google.golang.org/protobuf v1.27.1 // indirect modernc.org/sqlite v1.12.0 ) diff --git a/go.sum b/go.sum index 0dc14146..5dabd42e 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ -github.com/FloatTech/AnimeAPI v1.1.3 h1:VZA0XDEKOGAtmm0PU6/8ty6wI2n0Xg21QmngQVvUMhw= -github.com/FloatTech/AnimeAPI v1.1.3/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI= -github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.2 h1:w/JerL8DwdyoxZYB4HRMaHANRV2j+r5XxaQhVB0sjBw= -github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.2/go.mod h1:MVOQQ4e6AVGFm993blXXU4Sd6bAsLY2+Zb+/HMrEeEc= +github.com/FloatTech/AnimeAPI v1.1.5 h1:iZzmqEuzNG7i88cxqDYKpnarTVbAB//a/lIiTcZ1kB4= +github.com/FloatTech/AnimeAPI v1.1.5/go.mod h1:CC+vF30UGBlcIUxwFOcXIEHoJ4r7c5x2iLQsnUCVdDI= +github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3 h1:jn/dH+OwPSRozkmeCeQQPrAGJRBudcm3OK5tXhGItRk= +github.com/FloatTech/ZeroBot-Plugin-Timer v1.4.3/go.mod h1:MVOQQ4e6AVGFm993blXXU4Sd6bAsLY2+Zb+/HMrEeEc= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/antchfx/htmlquery v1.2.3 h1:sP3NFDneHx2stfNXCKbhHFo8XgNjCACnU/4AO5gWz6M= @@ -72,9 +72,8 @@ github.com/tidwall/gjson v1.8.1 h1:8j5EE9Hrh3l9Od1OIEDAb7IpezNA20UdRngNAj5N0WU= github.com/tidwall/gjson v1.8.1/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.1.0 h1:K3hMW5epkdAVwibsQEfR/7Zj0Qgt4DxtNumTq/VloO8= github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -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.7 h1:HT7h4+536gjqeq1ZIJPgOl1rg1XFatQGVZWp7Py53eg= github.com/tklauser/go-sysconf v0.3.7/go.mod h1:JZIdXh4RmBvZDBZ41ld2bGxRV3n4daiiqA3skYhAoQ4= github.com/tklauser/numcpus v0.2.3 h1:nQ0QYpiritP6ViFhrKYsiv6VVxOpum2Gks5GhnJbS/8= @@ -82,24 +81,20 @@ github.com/tklauser/numcpus v0.2.3/go.mod h1:vpEPS/JC+oZGGQ/My/vJnNsvMDQL6PwOqt8 github.com/wdvxdr1123/ZeroBot v1.2.2 h1:BKEy3l80BMrQWpFWaII0AfFMyf9bqrB0TxfWhTdoV58= github.com/wdvxdr1123/ZeroBot v1.2.2/go.mod h1:83nHtG8V5TAxPwH/LCDxLpZk4khIgs29dkr5TBWf7fc= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/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-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -109,32 +104,25 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 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.0.0-20201124115921-2c860bdd6e78 h1:M8tBwCtWD/cZV9DZpFYRUgaymAYAr+aIUTWzDaM3uPs= golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= diff --git a/main.go b/main.go index 6903eabe..841d2146 100644 --- a/main.go +++ b/main.go @@ -60,7 +60,7 @@ func init() { func main() { fmt.Print( - "======================[ZeroBot-Plugin]======================", + "\n======================[ZeroBot-Plugin]======================", "\n", banner, "\n", "============================================================\n", ) // 启动打印 diff --git a/plugin_acgimage/classify.go b/plugin_acgimage/classify.go index 886aa6d7..f4671cc8 100644 --- a/plugin_acgimage/classify.go +++ b/plugin_acgimage/classify.go @@ -14,7 +14,7 @@ import ( ) const ( - lolipxy = "http://sayuri.fumiama.top:62002/dice?class=0&loli=true&r18=true" + lolipxy = "http://sayuri.fumiama.top:8080/dice?class=0&loli=true&r18=true" apihead = "http://sayuri.fumiama.top:8080/img?path=" ) diff --git a/plugin_manager/manager.go b/plugin_manager/manager.go index 20abae21..10bf988d 100644 --- a/plugin_manager/manager.go +++ b/plugin_manager/manager.go @@ -3,7 +3,9 @@ package manager import ( "fmt" + "io" "math/rand" + "os" "strconv" "strings" "time" @@ -14,27 +16,44 @@ import ( timer "github.com/FloatTech/ZeroBot-Plugin-Timer" ) +const ( + datapath = "data/manager/" + confile = datapath + "config.pb" + hint = "====群管====\n" + + "- 禁言@QQ 1分钟\n" + + "- 解除禁言 @QQ\n" + + "- 我要自闭 1分钟\n" + + "- 开启全员禁言\n" + + "- 解除全员禁言\n" + + "- 升为管理@QQ\n" + + "- 取消管理@QQ\n" + + "- 修改名片@QQ XXX\n" + + "- 修改头衔@QQ XXX\n" + + "- 申请头衔 XXX\n" + + "- 踢出群聊@QQ\n" + + "- 退出群聊 1234\n" + + "- 群聊转发 1234 XXX\n" + + "- 私聊转发 0000 XXX\n" + + "- 在MM月dd日的hh点mm分时(用http://url)提醒大家XXX\n" + + "- 在MM月[每周|周几]的hh点mm分时(用http://url)提醒大家XXX\n" + + "- 取消在MM月dd日的hh点mm分的提醒\n" + + "- 取消在MM月[每周|周几]的hh点mm分的提醒\n" + + "- 列出所有提醒\n" + + "- 翻牌\n" + + "- 设置欢迎语XXX\n" + + "- [开启|关闭]入群验证" +) + +var ( + config Config +) + func init() { // 插件主体 + loadConfig() // 菜单 zero.OnFullMatch("群管系统", zero.AdminPermission).SetBlock(true).FirstPriority(). Handle(func(ctx *zero.Ctx) { - ctx.SendChain(message.Text( - "====群管====", "\n", - "- 禁言@QQ 1分钟", "\n", - "- 解除禁言 @QQ", "\n", - "- 我要自闭 1分钟", "\n", - "- 开启全员禁言", "\n", - "- 解除全员禁言", "\n", - "- 升为管理@QQ", "\n", - "- 取消管理@QQ", "\n", - "- 修改名片@QQ XXX", "\n", - "- 修改头衔@QQ XXX", "\n", - "- 申请头衔 XXX", "\n", - "- 踢出群聊@QQ", "\n", - "- 退出群聊 1234", "\n", - "- 群聊转发 1234 XXX", "\n", - "- 私聊转发 0000 XXX", - )) + ctx.Send(hint) }) // 升为管理 zero.OnRegex(`^升为管理.*?(\d+)`, zero.OnlyGroup, zero.SuperUserPermission).SetBlock(true).SetPriority(40). @@ -222,7 +241,7 @@ func init() { // 插件主体 ctx.SendChain(message.Text("📧 --> " + ctx.State["regex_matched"].([]string)[1])) }) // 定时提醒 - zero.OnRegex(`^在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分时(用.+)?提醒大家(.*)`, zero.SuperUserPermission).SetBlock(true).SetPriority(40). + zero.OnRegex(`^在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分时(用.+)?提醒大家(.*)`, zero.AdminPermission).SetBlock(true).SetPriority(40). Handle(func(ctx *zero.Ctx) { if ctx.Event.GroupID > 0 { dateStrs := ctx.State["regex_matched"].([]string) @@ -237,7 +256,7 @@ func init() { // 插件主体 } }) // 取消定时 - zero.OnRegex(`^取消在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分的提醒`, zero.SuperUserPermission).SetBlock(true).SetPriority(40). + zero.OnRegex(`^取消在(.{1,2})月(.{1,3}日|每?周.?)的(.{1,3})点(.{1,3})分的提醒`, zero.AdminPermission).SetBlock(true).SetPriority(40). Handle(func(ctx *zero.Ctx) { if ctx.Event.GroupID > 0 { dateStrs := ctx.State["regex_matched"].([]string) @@ -256,7 +275,7 @@ func init() { // 插件主体 } }) // 列出本群所有定时 - zero.OnFullMatch("列出所有提醒", zero.SuperUserPermission).SetBlock(true).SetPriority(40). + zero.OnFullMatch("列出所有提醒", zero.AdminPermission).SetBlock(true).SetPriority(40). Handle(func(ctx *zero.Ctx) { if ctx.Event.GroupID > 0 { ctx.Send(fmt.Sprint(timer.ListTimers(uint64(ctx.Event.GroupID)))) @@ -277,10 +296,51 @@ func init() { // 插件主体 } }) // 入群欢迎 - zero.OnNotice().SetBlock(false).SetPriority(40). + zero.OnNotice().SetBlock(false).FirstPriority(). Handle(func(ctx *zero.Ctx) { if ctx.Event.NoticeType == "group_increase" { - ctx.SendChain(message.Text("欢迎~")) + word, ok := config.Welcome[uint64(ctx.Event.GroupID)] + if ok { + ctx.Send(word) + } else { + ctx.Send("欢迎~") + } + enable, ok1 := config.Checkin[uint64(ctx.Event.GroupID)] + if ok1 && enable { + uid := ctx.Event.UserID + a := rand.Intn(100) + b := rand.Intn(100) + r := a + b + ctx.SendChain(message.At(uid), message.Text(fmt.Sprintf("考你一道题:%d+%d=?\n如果60秒之内答不上来,%s就要把你踢出去了哦~", a, b, zero.BotConfig.NickName[0]))) + // 匹配发送者进行验证 + rule := func(ctx *zero.Ctx) bool { + for _, elem := range ctx.Event.Message { + if elem.Type == "text" { + text := strings.ReplaceAll(elem.Data["text"], " ", "") + ans, err := strconv.Atoi(text) + if err == nil { + if ans != r { + ctx.Send("答案不对哦,再想想吧~") + return false + } + return true + } + } + } + return false + } + next := zero.NewFutureEvent("message", 999, false, zero.CheckUser(ctx.Event.UserID), rule) + recv, cancel := next.Repeat() + select { + case <-time.After(time.Minute): + ctx.Send("拜拜啦~") + ctx.SetGroupKick(ctx.Event.GroupID, uid, false) + cancel() + case <-recv: + cancel() + ctx.Send("答对啦~") + } + } } }) // 退群提醒 @@ -290,6 +350,34 @@ func init() { // 插件主体 ctx.SendChain(message.Text("有人跑路了~")) } }) + // 设置欢迎语 + zero.OnRegex(`^设置欢迎语([\s\S]*)$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40). + Handle(func(ctx *zero.Ctx) { + config.Welcome[uint64(ctx.Event.GroupID)] = ctx.State["regex_matched"].([]string)[1] + if saveConfig() == nil { + ctx.Send("记住啦!") + } else { + ctx.Send("出错啦!") + } + }) + // 入群验证开关 + zero.OnRegex(`^(.*)入群验证$`, zero.OnlyGroup, zero.AdminPermission).SetBlock(true).SetPriority(40). + Handle(func(ctx *zero.Ctx) { + option := ctx.State["regex_matched"].([]string)[1] + switch option { + case "开启": + config.Checkin[uint64(ctx.Event.GroupID)] = true + case "关闭": + config.Checkin[uint64(ctx.Event.GroupID)] = false + default: + return + } + if saveConfig() == nil { + ctx.Send("已" + option) + } else { + ctx.Send("出错啦!") + } + }) // 运行 CQ 码 zero.OnRegex(`^run(.*)$`, zero.SuperUserPermission).SetBlock(true).SetPriority(0). Handle(func(ctx *zero.Ctx) { @@ -304,3 +392,44 @@ func strToInt(str string) int64 { val, _ := strconv.ParseInt(str, 10, 64) return val } + +// loadConfig 加载设置,没有则手动初始化 +func loadConfig() { + mkdirerr := os.MkdirAll(datapath, 0755) + if mkdirerr == nil { + if _, err := os.Stat(confile); err == nil || os.IsExist(err) { + f, err := os.Open(confile) + if err == nil { + data, err1 := io.ReadAll(f) + if err1 == nil { + if len(data) > 0 { + if config.Unmarshal(data) == nil { + return + } + } + } + } + } + config.Checkin = make(map[uint64]bool) + config.Welcome = make(map[uint64]string) + } else { + panic(mkdirerr) + } +} + +// saveConfig 保存设置,无此文件则新建 +func saveConfig() error { + data, err := config.Marshal() + if err != nil { + return err + } else if _, err := os.Stat(datapath); err == nil || os.IsExist(err) { + f, err1 := os.OpenFile(confile, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644) + if err1 != nil { + return err1 + } + defer f.Close() + _, err2 := f.Write(data) + return err2 + } + return nil +} diff --git a/plugin_manager/manager.pb.go b/plugin_manager/manager.pb.go new file mode 100644 index 00000000..a0ac3fcc --- /dev/null +++ b/plugin_manager/manager.pb.go @@ -0,0 +1,561 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: manager.proto + +package manager + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type Config struct { + Checkin map[uint64]bool `protobuf:"bytes,1,rep,name=checkin,proto3" json:"checkin,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + Welcome map[uint64]string `protobuf:"bytes,2,rep,name=welcome,proto3" json:"welcome,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Config) Reset() { *m = Config{} } +func (m *Config) String() string { return proto.CompactTextString(m) } +func (*Config) ProtoMessage() {} +func (*Config) Descriptor() ([]byte, []int) { + return fileDescriptor_cde9ec64f0d2c859, []int{0} +} +func (m *Config) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Config.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Config) XXX_Merge(src proto.Message) { + xxx_messageInfo_Config.Merge(m, src) +} +func (m *Config) XXX_Size() int { + return m.Size() +} +func (m *Config) XXX_DiscardUnknown() { + xxx_messageInfo_Config.DiscardUnknown(m) +} + +var xxx_messageInfo_Config proto.InternalMessageInfo + +func (m *Config) GetCheckin() map[uint64]bool { + if m != nil { + return m.Checkin + } + return nil +} + +func (m *Config) GetWelcome() map[uint64]string { + if m != nil { + return m.Welcome + } + return nil +} + +func init() { + proto.RegisterType((*Config)(nil), "manager.config") + proto.RegisterMapType((map[uint64]bool)(nil), "manager.config.CheckinEntry") + proto.RegisterMapType((map[uint64]string)(nil), "manager.config.WelcomeEntry") +} + +func init() { proto.RegisterFile("manager.proto", fileDescriptor_cde9ec64f0d2c859) } + +var fileDescriptor_cde9ec64f0d2c859 = []byte{ + // 186 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcd, 0x4d, 0xcc, 0x4b, + 0x4c, 0x4f, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x72, 0x95, 0x3e, 0x30, + 0x72, 0xb1, 0x25, 0xe7, 0xe7, 0xa5, 0x65, 0xa6, 0x0b, 0x99, 0x71, 0xb1, 0x27, 0x67, 0xa4, 0x26, + 0x67, 0x67, 0xe6, 0x49, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x1b, 0xc9, 0xe8, 0xc1, 0x34, 0x41, 0x54, + 0xe8, 0x39, 0x43, 0xa4, 0x5d, 0xf3, 0x4a, 0x8a, 0x2a, 0x83, 0x60, 0x8a, 0x41, 0xfa, 0xca, 0x53, + 0x73, 0x92, 0xf3, 0x73, 0x53, 0x25, 0x98, 0xb0, 0xeb, 0x0b, 0x87, 0x48, 0x43, 0xf5, 0x41, 0x15, + 0x4b, 0x59, 0x71, 0xf1, 0x20, 0x1b, 0x28, 0x24, 0xc0, 0xc5, 0x9c, 0x9d, 0x5a, 0x29, 0xc1, 0xa8, + 0xc0, 0xa8, 0xc1, 0x12, 0x04, 0x62, 0x0a, 0x89, 0x70, 0xb1, 0x96, 0x25, 0xe6, 0x94, 0x82, 0xcc, + 0x65, 0xd4, 0xe0, 0x08, 0x82, 0x70, 0xac, 0x98, 0x2c, 0x18, 0x41, 0x7a, 0x91, 0x0d, 0x25, 0xa4, + 0x97, 0x13, 0x49, 0xaf, 0x93, 0xc0, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, + 0x24, 0xc7, 0x38, 0xe3, 0xb1, 0x1c, 0x43, 0x12, 0x1b, 0x38, 0x50, 0x8c, 0x01, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x2a, 0xe6, 0x90, 0x6e, 0x25, 0x01, 0x00, 0x00, +} + +func (m *Config) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Welcome) > 0 { + for k := range m.Welcome { + v := m.Welcome[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintManager(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i = encodeVarintManager(dAtA, i, uint64(k)) + i-- + dAtA[i] = 0x8 + i = encodeVarintManager(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Checkin) > 0 { + for k := range m.Checkin { + v := m.Checkin[k] + baseI := i + i-- + if v { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + i = encodeVarintManager(dAtA, i, uint64(k)) + i-- + dAtA[i] = 0x8 + i = encodeVarintManager(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintManager(dAtA []byte, offset int, v uint64) int { + offset -= sovManager(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Config) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Checkin) > 0 { + for k, v := range m.Checkin { + _ = k + _ = v + mapEntrySize := 1 + sovManager(uint64(k)) + 1 + 1 + n += mapEntrySize + 1 + sovManager(uint64(mapEntrySize)) + } + } + if len(m.Welcome) > 0 { + for k, v := range m.Welcome { + _ = k + _ = v + mapEntrySize := 1 + sovManager(uint64(k)) + 1 + len(v) + sovManager(uint64(len(v))) + n += mapEntrySize + 1 + sovManager(uint64(mapEntrySize)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovManager(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozManager(x uint64) (n int) { + return sovManager(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Config) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Checkin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthManager + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthManager + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Checkin == nil { + m.Checkin = make(map[uint64]bool) + } + var mapkey uint64 + var mapvalue bool + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + var mapvaluetemp int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvaluetemp |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + mapvalue = bool(mapvaluetemp != 0) + } else { + iNdEx = entryPreIndex + skippy, err := skipManager(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthManager + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Checkin[mapkey] = mapvalue + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Welcome", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthManager + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthManager + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Welcome == nil { + m.Welcome = make(map[uint64]string) + } + var mapkey uint64 + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowManager + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthManager + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthManager + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipManager(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthManager + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Welcome[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipManager(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthManager + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipManager(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowManager + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowManager + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowManager + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthManager + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupManager + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthManager + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthManager = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowManager = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupManager = fmt.Errorf("proto: unexpected end of group") +) diff --git a/plugin_manager/manager.proto b/plugin_manager/manager.proto new file mode 100644 index 00000000..cd53bf10 --- /dev/null +++ b/plugin_manager/manager.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; +package manager; + +message config { + map checkin = 1; + map welcome = 2; +}