Skip to content
GitLab
菜单
项目
群组
代码片段
帮助
帮助
支持
社区论坛
快捷键
?
提交反馈
登录/注册
切换导航
菜单
打开侧边栏
Zhang Guoqiang
yobot
提交
4ea7f142
提交
4ea7f142
编辑于
5月 25, 2020
作者:
yuudi
浏览文件
feat: leave group command
上级
38251e97
变更
9
Hide whitespace changes
Inline
Side-by-side
docs/v3/ver.json
浏览文件 @
4ea7f142
{
"stable"
:
{
"version"
:
34
77
,
"url"
:
"http://img.yobot.xyz/yobot/yobot34
77
.zip"
"version"
:
34
82
,
"url"
:
"http://img.yobot.xyz/yobot/yobot34
82
.zip"
}
}
\ No newline at end of file
documents/.vuepress/config.yml
浏览文件 @
4ea7f142
base
:
/
dest
:
.
./d
ocs
dest
:
./d
ist
title
:
yobot
description
:
公主链接群聊机器人
head
:
...
...
documents/about.md
浏览文件 @
4ea7f142
...
...
@@ -8,11 +8,11 @@ yobot 的编写出于学习目的,很高兴此工具能为大家提供帮助
邮件:
<yobot@pcrbot.com>
QQ群:
770947581(满)
1044314369(满)
1067699252(满)
774394459
<!--
1087420601
-->
1群:
770947581(满)
2群:
1044314369(满)
4群:
1067699252(满)
5群:
774394459
6群:
1087420601
[
项目贡献者
](
./project/contributors.md
)
[
更新日志
](
./project/changelog.md
)
...
...
documents/features/web.md
浏览文件 @
4ea7f142
...
...
@@ -20,6 +20,7 @@
| 重置密码 | 随机重置一个新密码 |
| 更新 | (权)更新机器人 |
| 重启 | (权)重新启动机器人 |
| 退出此群 | (权)命令机器人退出当前群聊 |
| version | 查看机器人版本 |
| 帮助 | 查看帮助 |
...
...
documents/package.json
0 → 100644
浏览文件 @
4ea7f142
{
"scripts"
:
{
"dev"
:
"vuepress dev . --host=127.0.0.1 --open"
,
"build"
:
"vuepress build ."
},
"devDependencies"
:
{
"@vuepress/plugin-back-to-top"
:
"^1.5.0"
,
"vuepress"
:
"^1.5.0"
,
"vuepress-plugin-clean-urls"
:
"^1.1.1"
,
"vuepress-plugin-img-lazy"
:
"^1.0.3"
}
}
\ No newline at end of file
src/client/public/template/about.html
浏览文件 @
4ea7f142
...
...
@@ -26,7 +26,7 @@
联系邮箱:
<a
href=
"mailto:yobot@pcrbot.com"
>
yobot@pcrbot.com
</a>
</p>
<p>
交流群:
<br>
770947581(满)
<br>
1044314369(满)
<br>
1067699252(满)
<br>
774394459
交流群:
<br>
1群:
770947581(满)
<br>
2群:
1044314369(满)
<br>
4群:
1067699252(满)
<br>
5群:
774394459
</p>
<h2>
其他
...
...
src/client/public/template/help.html
浏览文件 @
4ea7f142
...
...
@@ -57,6 +57,10 @@
<td>
重启
</td>
<td>
(权)重新启动机器人
</td>
</tr>
<tr>
<td>
退出此群
</td>
<td>
(权:管理员)命令机器人退出当前群聊
<sup
class=
"footnote"
>
1
</sup></td>
</tr>
<tr>
<td>
version
</td>
<td>
查看机器人版本
</td>
...
...
@@ -67,6 +71,9 @@
</tr>
</tbody>
</table>
<p>
<sup
class=
"footnote"
>
1
</sup>
当管理员希望机器人离开群聊时,应该使用此条命令而不是直接踢出群聊,避免增加封号风险
</p>
<h2>
公会战类
</h2>
<p>
注:本类功能仅限群聊
</p>
<table>
...
...
src/client/ybplugins/group_leave.py
0 → 100644
浏览文件 @
4ea7f142
from
typing
import
Any
,
Dict
,
Union
from
aiocqhttp.api
import
Api
from
.web_util
import
rand_string
class
GroupLeave
:
def
__init__
(
self
,
glo_setting
:
Dict
[
str
,
Any
],
bot_api
:
Api
,
*
args
,
**
kwargs
):
self
.
setting
=
glo_setting
self
.
api
=
bot_api
self
.
verification
=
{}
async
def
execute_async
(
self
,
ctx
:
Dict
[
str
,
Any
]):
cmd
=
ctx
[
'raw_message'
]
if
cmd
.
startswith
(
'退出此群'
):
if
ctx
[
'message_type'
]
!=
'group'
:
return
'此功能仅可用于群聊'
if
ctx
[
'sender'
][
'role'
]
==
'member'
:
return
'只有群管理员可以这么做'
code
=
cmd
[
4
:]
if
code
==
self
.
verification
.
get
(
ctx
[
'group_id'
]):
await
self
.
api
.
send_group_msg
(
group_id
=
ctx
[
'group_id'
],
message
=
'正在退群'
,
)
await
self
.
api
.
set_group_leave
(
group_id
=
ctx
[
'group_id'
],
is_dismiss
=
False
,
)
else
:
code
=
rand_string
(
4
)
self
.
verification
[
ctx
[
'group_id'
]]
=
code
return
f
'警告:如果你确定要执行退群,请发送“退出此群
{
code
}
”'
src/client/yobot.py
浏览文件 @
4ea7f142
...
...
@@ -20,12 +20,12 @@ if __package__:
from
.ybplugins
import
(
boss_dmg
,
calender
,
clan_battle
,
gacha
,
homepage
,
jjc_consult
,
login
,
marionette
,
push_news
,
settings
,
switcher
,
templating
,
updater
,
web_util
,
ybdata
,
yobot_msg
,
custom
,
miner
)
yobot_msg
,
custom
,
miner
,
group_leave
)
else
:
from
ybplugins
import
(
boss_dmg
,
calender
,
clan_battle
,
gacha
,
homepage
,
jjc_consult
,
login
,
marionette
,
push_news
,
settings
,
switcher
,
templating
,
updater
,
web_util
,
ybdata
,
yobot_msg
,
custom
,
miner
)
yobot_msg
,
custom
,
miner
,
group_leave
)
# 本项目构建的框架非常粗糙,不建议各位把时间浪费本项目上
# 如果想开发自己的机器人,建议直接使用 nonebot 框架
...
...
@@ -33,8 +33,8 @@ else:
class
Yobot
:
Version
=
"[v3.6.2_beta]"
Version_id
=
1
77
Version
=
"[v3.6.2_beta
_2
]"
Version_id
=
1
82
# "git rev-list --count HEAD"
def
__init__
(
self
,
*
,
...
...
@@ -221,6 +221,7 @@ class Yobot:
# load new plugins
self
.
plug_new
=
[
miner
.
Miner
(
**
kwargs
),
group_leave
.
GroupLeave
(
**
kwargs
),
custom
.
Custom
(
**
kwargs
),
]
...
...
编辑
预览
Supports
Markdown
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录