From e5c5084b9bbc823de7bb1bd798e01d3866b3dd87 Mon Sep 17 00:00:00 2001 From: yuudi Date: Fri, 29 Jan 2021 23:39:11 +0800 Subject: [PATCH] feat: subscriber table --- .github/workflows/CI.yml | 36 ++++++++++++++++++++-- README.md | 10 ++++++ src/client/nonebot_plugin.py | 1 + src/client/public/template/help.html | 4 +++ src/client/public/template/user.html | 1 + src/client/ybplugins/clan_battle/battle.py | 27 ++++++++++++++-- 6 files changed, 75 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 33e1d397..76e1f74f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,7 +1,9 @@ name: ci on: - push + push: + paths: + - 'src/client/**' jobs: build-windows: @@ -27,7 +29,37 @@ jobs: PYTHONOPTIMIZE=0 pyinstaller main.spec - - uses: actions/upload-artifact@v2 + - name: Upload Artifact + uses: actions/upload-artifact@v2 with: name: windows-executable path: ./src/client/dist/yobot.exe + + upload: + runs-on: ubuntu-20.04 + needs: build-windows + name: upload binary + + steps: + - name: Download Artifact + uses: actions/download-artifact@v2 + with: + name: windows-executable + + - name: Cache Uploader + id: cache-uploader + uses: actions/cache@v2 + with: + path: ./uploader + key: ${{ runner.os }}-uploader-735d37236b86a5343370a5f2991f55e5062f35b5 + + - name: Setup Uploader + if: ${{ ! steps.cache-uploader.outputs.cache-hit }} + run: | + mkdir -p uploader + echo '${{ secrets.UPLOADER_AUTH }}' > uploader/auth.json + wget -q https://github.com/MoeClub/OneList/raw/735d37236b86a5343370a5f2991f55e5062f35b5/OneDriveUploader/amd64/linux/OneDriveUploader -O uploader/OneDriveUploader + chmod +x uploader/OneDriveUploader + + - name: Upload to Onedrive + run: ./uploader/OneDriveUploader -c "uploader/auth.json" -s "yobot.exe" -r "pan/yobot/test/${GITHUB_RUN_ID}" -n "yobot.exe" diff --git a/README.md b/README.md index 94861d75..591cf45e 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,13 @@ yobot 提供了群聊、web 页面两套用户交互方式,具有操作便捷 [源码](./src/client) [使用说明](https://yobot.win) + +## 开源协议 + +[本工具使用的开源软件和工具](./project/open-source.md) + +使用本工具时请遵循[GPL-3.0 协议](https://www.gnu.org/licenses/gpl-3.0.html),并在其基础上附加以下条款: + +- 如果修改本工具源码并提供服务,不允许以本项目的名义中加入任何商业广告、诱导使用、引导关注等内容。 +- 如果收费提供本工具,则必须在交易发生前,主动向客户介绍本开源工具。 +- 不得移除项目网页中“powered by yobot”的字样和超链接 diff --git a/src/client/nonebot_plugin.py b/src/client/nonebot_plugin.py index afc4a4fc..cd16ab9b 100644 --- a/src/client/nonebot_plugin.py +++ b/src/client/nonebot_plugin.py @@ -33,6 +33,7 @@ def makefile(path, content="# doing nothing"): print( "|===========================================|\n" "| yobot 插件版即将停止支持,请尽快更换为独立版 |\n" + "| 详见 https://yobot.win/install/transfer-from-plugin/ |\n" "|===========================================|\n" ) diff --git a/src/client/public/template/help.html b/src/client/public/template/help.html index cc029c21..9a872478 100644 --- a/src/client/public/template/help.html +++ b/src/client/public/template/help.html @@ -145,6 +145,10 @@

公会战类

查1 / 查树 查询预约boss的成员,查询挂树的成员 + + 预约表 + 查询所有预约boss的成员 + 取消预约1 / 取消1 取消预约 diff --git a/src/client/public/template/user.html b/src/client/public/template/user.html index cf862518..dd90100d 100644 --- a/src/client/public/template/user.html +++ b/src/client/public/template/user.html @@ -139,6 +139,7 @@

Yobot用户面板


+
欢迎,{{ user.nickname }}

上次登录:[[ from_ts({{ session.get('last_login_time') }}) ]] 在 [[ addr.join('') ]]

diff --git a/src/client/ybplugins/clan_battle/battle.py b/src/client/ybplugins/clan_battle/battle.py index 2ced1ffb..50a14cad 100644 --- a/src/client/ybplugins/clan_battle/battle.py +++ b/src/client/ybplugins/clan_battle/battle.py @@ -795,7 +795,7 @@ def add_subscribe(self, group_id: Groupid, qqid: QQid, boss_num, message=None): message=message, ) - def get_subscribe_list(self, group_id: Groupid, boss_num=None) -> List[Tuple[int, QQid, dict]]: + def get_subscribe_list(self, group_id: Groupid, boss_num=None, order_by="sid") -> List[Dict[str, Any]]: """ get the subscribe lists. @@ -812,7 +812,8 @@ def get_subscribe_list(self, group_id: Groupid, boss_num=None) -> List[Tuple[int for subscribe in Clan_subscribe.select().where( *query ).order_by( - Clan_subscribe.sid + # Clan_subscribe.sid + getattr(Clan_subscribe, order_by) ): subscribe_list.append({ 'boss': subscribe.subscribe_item, @@ -1354,6 +1355,28 @@ def execute(self, match_num, ctx): ) return '请在面板中查看:'+url elif match_num == 10: # 预约 + if cmd == '预约表': + # 查询预约表 + subscribers = self.get_subscribe_list(group_id, order_by='subscribe_item') + if not subscribers: + return '没有预约记录' + reply = "预约表:\n" + current_boss = '-1' # 尚未开始输出结果 + for sub in subscribers: + if sub['boss'] != current_boss: # boss 号变化前,显示小标题 + if sub['boss'] == 0: + reply += '====挂树====\n' + else: + reply += f"==={sub['boss']}号boss===\n" + current_boss = sub['boss'] + reply += self._get_nickname_by_qqid(sub['qqid']) # 显示昵称 + message = sub['message'] # 如果有留言则显示留言 + if message: + reply += ':' + message + reply += '\n' + reply += '============' # 结束 + return reply + # 预约 boss match = re.match(r'^预约([1-5]) *(?:[\::](.*))?$', cmd) if not match: return