-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from Cassius0924/revert-45-improve-notifier
Revert "[Improvement] 优化收到命令提醒"
- Loading branch information
Showing
7 changed files
with
42 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# 消息通知器 | ||
from wechatter.models.message import SendMessage, SendMessageType, SendTo | ||
from wechatter.sender import Sender | ||
|
||
|
||
class Notifier: | ||
"""消息通知器,用于发送非命令产生的消息""" | ||
|
||
def __init__(self): | ||
pass | ||
|
||
# TODO: 改成只在为API请求的命令时才调用 | ||
@staticmethod | ||
def notify_received(to: SendTo) -> None: | ||
"""通知收到命令请求""" | ||
msg = "收到命令请求" | ||
Sender.send_msg(to, SendMessage(SendMessageType.TEXT, msg)) | ||
|
||
# 机器人登录登出通知,若是登录(登出)则发送登录(登出)消息给所有管理员 | ||
@staticmethod | ||
def notify_logged_in() -> None: | ||
"""通知登录成功""" | ||
msg = "微信机器人启动成功" | ||
Sender.send_msg_to_admins(msg) | ||
|
||
# FIXME: 登出消息发送不出去,因为发消息时候,机器人已经退出登录了 | ||
@staticmethod | ||
def notify_logged_out() -> None: | ||
"""通知已退出登录""" | ||
msg = "微信机器人已退出" | ||
Sender.send_msg_to_admins(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
from .notifier import notify_logged_in, notify_logged_out, notify_received | ||
from .sender import Sender | ||
|
||
__all__ = ["Sender", "notify_received", "notify_logged_in", "notify_logged_out"] | ||
__all__ = ["Sender"] |
This file was deleted.
Oops, something went wrong.