Skip to content

Commit

Permalink
合并拉取请求 #1
Browse files Browse the repository at this point in the history
更新0.1.2
  • Loading branch information
Cypas authored Jul 24, 2023
2 parents d2c9331 + 2aec297 commit 0e7d84e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ _✨ QQbot断连时的通知插件 ✨_
| disconnect_notice_smtp_server || str | "" | 邮箱服务器地址,如 smtp.yeah.net |
| disconnect_notice_smtp_port || int | 465 | 邮箱端口号,ssl模式时为465 |
| disconnect_notice_notice_email || str | "" | 收件人邮箱,填写自己邮箱即可 |
| disconnect_notice_dev_mode || bool | False | 开发者模式,该模式下QQbot断开连接不会触发通知消息,避免本地测试插件时不断重载而导致的大量掉线通知 |

<details>
<summary>示例配置</summary>
Expand Down
6 changes: 4 additions & 2 deletions nonebot_plugin_disconnect_notice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ async def _(matcher: Matcher):
@driver.on_bot_disconnect
async def disconnect(bot: Union[V11Bot]):
"""bot断连触发器"""
send_notice(bot)
# 开发者模式下不生效
if not plugin_config.disconnect_notice_dev_mode:
send_notice(bot)


@driver.on_bot_connect
async def connect(bot: V11Bot):
"""插件载入时检测配置完整性"""
"""bot接入时检测配置完整性"""
if not mail_config.check_params():
# 缺少参数,私聊通知主人
super_user: str = list(global_config.superusers)[0]
Expand Down
1 change: 1 addition & 0 deletions nonebot_plugin_disconnect_notice/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Config(BaseModel):
disconnect_notice_smtp_server = ""
disconnect_notice_smtp_port = 465
disconnect_notice_notice_email = ""
disconnect_notice_dev_mode = False


driver = get_driver()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nonebot-plugin-disconnect-notice"
version = "0.1.1"
version = "0.1.2"
description = "QQbot断连时的通知插件"
authors = ["cypas <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 0e7d84e

Please sign in to comment.