Skip to content
This repository has been archived by the owner on May 22, 2022. It is now read-only.

Commit

Permalink
feat: subscriber table
Browse files Browse the repository at this point in the history
  • Loading branch information
yuudi committed Jan 29, 2021
1 parent 2aa1719 commit e5c5084
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 4 deletions.
36 changes: 34 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: ci

on:
push
push:
paths:
- 'src/client/**'

jobs:
build-windows:
Expand All @@ -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"
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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”的字样和超链接
1 change: 1 addition & 0 deletions src/client/nonebot_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def makefile(path, content="# doing nothing"):
print(
"|===========================================|\n"
"| yobot 插件版即将停止支持,请尽快更换为独立版 |\n"
"| 详见 https://yobot.win/install/transfer-from-plugin/ |\n"
"|===========================================|\n"
)

Expand Down
4 changes: 4 additions & 0 deletions src/client/public/template/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ <h2>公会战类</h2>
<td>查1 / 查树</td>
<td>查询预约boss的成员,查询挂树的成员</td>
</tr>
<tr>
<td>预约表</td>
<td>查询所有预约boss的成员</td>
</tr>
<tr>
<td>取消预约1 / 取消1</td>
<td>取消预约</td>
Expand Down
1 change: 1 addition & 0 deletions src/client/public/template/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ <h1>Yobot用户面板</h1>
</svg>
</div><br>
<div id="app">
<el-alert v-if="localStorage.yobot_free_statement!=='true'" title="yobot 软件始终免费" description="yobot 软件始终免费,任何人都可以部署在自己的服务器上。yobot 不禁止商业使用,鼓励有能力的用户自行搭建。" center effect="dark" type="info" close-text="不再提醒" @close="localStorage.yobot_free_statement='true'"></el-alert>
<div><strong>欢迎,{{ user.nickname }}</strong></div>
<p>上次登录:[[ from_ts({{ session.get('last_login_time') }}) ]] 在 [[ addr.join('') ]]
</p>
Expand Down
27 changes: 25 additions & 2 deletions src/client/ybplugins/clan_battle/battle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e5c5084

Please sign in to comment.