提交 e04c1460 编辑于 作者: yuudi's avatar yuudi
浏览文件

feat: whitelist_groups

上级 8d22f370
{
"stable": {
"version": 3495,
"url": "http://img.yobot.xyz/yobot/yobot3495.zip"
"version": 3496,
"url": "http://yopan.loli.show/yobot/yobot3496.zip"
}
}
\ No newline at end of file
......@@ -13,7 +13,7 @@ yobot 提供了群聊、web 页面两套用户交互方式,具有操作便捷
自建方法请参考[安装教程](./install/README.md)
或者加入交流群 {{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*3)] }},租用或出租机器人
或者加入交流群 {{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*4)] }},租用或出租机器人
## 功能介绍
......
......@@ -7,7 +7,7 @@ yobot 的编写出于学习目的,很高兴此工具能为大家提供帮助
邮件: <yobot@pcrbot.com>
QQ群:{{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*3)] }}
QQ群:{{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*4)] }}
[项目贡献者](./project/contributors.md)
[更新日志](./project/changelog.md)
......
......@@ -51,34 +51,26 @@ sh yobotg.sh
按下 `ctrl-a , c` 连续组合键,新建一个 screen shell
启动 mirai-console
下载 mirai-console 和 cqhttp-mirai
```shell
mkdir -p ~/qqbot/mirai
mkdir -p ~/qqbot/mirai/plugins/CQHTTPMirai
cd ~/qqbot/mirai
# 你可以在这里找到最新版本:https://github.com/mamoe/mirai-console-wrapper/releases
wget https://github.com/mamoe/mirai-console-wrapper/releases/download/1.3.0/mirai-console-wrapper-1.3.0-all.jar
java -jar mirai-console-wrapper-1.3.0-all.jar
```
在 mirai-console 里登录 QQ 并下载 CQHTTPMirai 插件
# 国内可改用 http://yopan.loli.show/mirai-console-wrapper-1.3.0-all.jar
```shell
# (mirai-console内)
# 登录 QQ
login 123456789 ppaasswwdd # 注意改成你的QQ小号的账号密码
cd plugins
# 安装 cqhttp-mirai
install CQHTTPMirai
# 你可以在这里找到最新版本:https://github.com/yyuueexxiinngg/cqhttp-mirai/releases
wget https://github.com/yyuueexxiinngg/cqhttp-mirai/releases/download/0.1.4/cqhttp-mirai-0.1.4-all.jar
# 国内可改用 http://yopan.loli.show/mirai-plugins/CQHTTPMirai/CQHTTPMirai-0.1.4.jar
```
按下 `ctrl-a , c` 连续组合键,新建一个 screen shell
修改 CQHTTPMirai 配置文件
```shell
mkdir -p ~/qqbot/mirai/plugins/CQHTTPMirai
cd ~/qqbot/mirai/plugins/CQHTTPMirai
vi setting.yml
```
......@@ -99,18 +91,15 @@ vi setting.yml
# 详细说明请参考 https://github.com/yyuueexxiinngg/cqhttp-mirai
```
保存后按下 `ctrl-a , 1` 连续组合键,回到 1 号 shell (即 mirai-console 所在的 shell)
按下 `ctrl-c` 退出 mirai 然后重新启动 mirai 并登录 QQ
<!--
重新加载插件
启动 mirai-console 并登录 QQ
```shell
cd ~/qqbot/mirai
java -jar mirai-console-wrapper-1.3.0-all.jar
# (mirai-console内)
reload
login 123456789 ppaasswwdd # 注意改成你的QQ小号的账号密码
```
-->
部署完成,现在可以按下 `ctrl-a , d` 连续组合键挂起这两个 shell
......
......@@ -10,7 +10,7 @@ yobot搭建难度约等于搭建网站的难度,请量力而行
:::
如果想租用或出租机器人,可以加群 {{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*3)] }}
如果想租用或出租机器人,可以加群 {{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*4)] }}
选择一个安装教程:
......
......@@ -5,6 +5,7 @@
- 用户首页显示所有已加入的公会
- 兼容 `utf-8 with BOM` 格式的配置文件
- 修改角色昵称表刷新规则
- 消息过滤支持白名单模式
## 3.6.2
......
......@@ -92,4 +92,4 @@ chown -R 1000:1000 .
### 这里没有我的问题
可以在QQ群({{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*3)] }})或[github issue](https://github.com/yuudi/yobot/issues)提问,提问前可以阅读[正确的提问姿势](https://github.com/tangx/Stop-Ask-Questions-The-Stupid-Ways/blob/master/README.md)
可以在QQ群({{ [770947581,1044314369,1067699252,774394459][Math.floor(Math.random()*4)] }})或[github issue](https://github.com/yuudi/yobot/issues)提问,提问前可以阅读[正确的提问姿势](https://github.com/tangx/Stop-Ask-Questions-The-Stupid-Ways/blob/master/README.md)
......@@ -8,7 +8,9 @@
"web_mode_hint": true,
"super-admin": [],
"black-list": [],
"white_list_mode": false,
"black-list-group": [],
"white-list-group": [],
"setting-restrict": 2,
"allow_bulk_private": false,
"auto_update": true,
......
......@@ -24,7 +24,7 @@ var vm = new Vue({
}
var nd = new Date();
nd.setTime(ts * 1000);
return nd.toLocaleString('chinese', { hour12: false });
return nd.toLocaleString('chinese', { hour12: false, timeZone: 'asia/shanghai' });
},
refresh: function (event) {
var thisvue = this;
......
......@@ -69,9 +69,9 @@ var vm = new Vue({
}
var nd = new Date();
nd.setTime(cha.challenge_time * 1000);
var detailstr = nd.toLocaleString('chinese', { hour12: false }) + '\n';
var detailstr = nd.toLocaleString('chinese', { hour12: false, timeZone: 'asia/shanghai' }) + '\n';
detailstr += cha.cycle + '周目' + cha.boss_num + '号boss\n';
detailstr += (cha.health_ramain + cha.damage).toLocaleString() + '' + cha.health_ramain.toLocaleString();
detailstr += (cha.health_ramain + cha.damage).toLocaleString(options = { timeZone: 'asia/shanghai' }) + '' + cha.health_ramain.toLocaleString(options = { timeZone: 'asia/shanghai' });
if (cha.message) {
detailstr += '\n留言:' + cha.message;
}
......
......@@ -363,7 +363,7 @@ var vm = new Vue({
label: {
formatter: params => {
if (params.axisDimension === "x") {
return (new Date(params.value)).toLocaleString();
return (new Date(params.value)).toLocaleString(options = { timeZone: 'asia/shanghai' });
}
if (params.axisDimension === "y") {
return params.value.toLocaleString();
......@@ -376,7 +376,7 @@ var vm = new Vue({
const series = params[0];
const [ts, value] = series.data;
const matched = temp6[1].find(f => (!f.gte || f.gte <= ts) && (!f.lt || f.lt > ts));
return `${(new Date(ts)).toLocaleString()}<br />${series.marker}${(matched && matched.label) + "<br />" || ""}血量:${value.toLocaleString()}`
return `${(new Date(ts)).toLocaleString(options = { timeZone: 'asia/shanghai' })}<br />${series.marker}${(matched && matched.label) + "<br />" || ""}血量:${value.toLocaleString()}`
}
},
toolbox: {
......
......@@ -49,9 +49,9 @@ var vm = new Vue({
}
var nd = new Date();
nd.setTime(cha.challenge_time * 1000);
var detailstr = nd.toLocaleString('chinese', { hour12: false }) + '\n';
var detailstr = nd.toLocaleString('chinese', { hour12: false, timeZone: 'asia/shanghai' }) + '\n';
detailstr += cha.cycle + '周目' + cha.boss_num + '号boss\n';
detailstr += (cha.health_ramain + cha.damage).toLocaleString() + '' + cha.health_ramain.toLocaleString();
detailstr += (cha.health_ramain + cha.damage).toLocaleString(options = { timeZone: 'asia/shanghai' }) + '' + cha.health_ramain.toLocaleString(options = { timeZone: 'asia/shanghai' });
if (cha.message) {
detailstr += '\n留言:' + cha.message;
}
......
......@@ -120,7 +120,7 @@ class Event:
return a_time
async def load_timeline_jp_async(self):
event_source = "http://tools.yobot.win/calender/jp.json"
event_source = "http://toolscdn.yobot.win/calender/jp.json"
async with aiohttp.request("GET", url=event_source) as response:
if response.status != 200:
raise ServerError(f"服务器状态错误:{response.status}")
......@@ -166,7 +166,7 @@ class Event:
return a_time
async def load_timeline_cn_async(self):
event_source = "http://tools.yobot.win/calender/cn.json"
event_source = "http://toolscdn.yobot.win/calender/cn.json"
async with aiohttp.request("GET", url=event_source) as response:
if response.status != 200:
raise ServerError(f"服务器状态错误:{response.status}")
......
......@@ -1344,9 +1344,10 @@ class ClanBattle:
return '锁定时请留言'
else:
match = re.match(r'^锁定(?:boss)? *(?:[\::](.*))?$', cmd)
if match:
appli_type = 2
extra_msg = match.group(1)
if not match:
return
appli_type = 2
extra_msg = match.group(1)
if isinstance(extra_msg, str):
extra_msg = extra_msg.strip()
if not extra_msg:
......
......@@ -27,9 +27,15 @@ class Setting:
async def yobot_setting():
if 'yobot_user' not in session:
return redirect(url_for('yobot_login', callback=request.path))
user=User.get_by_id(session['yobot_user'])
if user.authority_group >= 10:
return await render_template(
'unauthorized.html',
limit='主人',
uath=user.authority_group,
)
return await render_template(
'admin/setting.html',
user=User.get_by_id(session['yobot_user']),
)
@app.route(
......
......@@ -33,8 +33,8 @@ else:
class Yobot:
Version = "[v3.6.3-beta.4]"
Version_id = 195
Version = "[v3.6.3-rc.1]"
Version_id = 196
# "git rev-list --count HEAD"
def __init__(self, *,
......@@ -173,6 +173,11 @@ class Yobot:
self.ccs2t = OpenCC(self.glo_setting.get("zht_out_style", "s2t"))
self.cct2s = OpenCC("t2s")
# filter
self.black_list = set(self.glo_setting["black-list"])
self.black_list_group = set(self.glo_setting["black-list-group"])
self.white_list_group = set(self.glo_setting["white-list-group"])
# update runtime variables
self.glo_setting.update({
"dirname": dirname,
......@@ -234,10 +239,15 @@ class Yobot:
msg["raw_message"][len(preffix):])
# black-list
if msg["sender"]["user_id"] in self.glo_setting["black-list"]:
return None
if msg["message_type"] == "group" and (msg["group_id"] in self.glo_setting["black-list-group"]):
if msg["sender"]["user_id"] in self.black_list:
return None
if msg["message_type"] == "group":
if self.glo_setting["white_list_mode"]:
if msg["group_id"] not in self.white_list_group:
return None
else:
if msg["group_id"] in self.black_list_group:
return None
# zht-zhs convertion
if self.glo_setting.get("zht_in", False):
......
Supports Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册