summaryrefslogtreecommitdiff
path: root/ATRI/plugins/plugin_chat/__init__.py
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2020-10-07 13:03:27 +0800
committerKyomotoi <[email protected]>2020-10-07 13:03:27 +0800
commitcec804951b97bcab81551bb8c7a1a1e1c473aaa7 (patch)
tree03b7204af6ebc869e887494ab2609a6e9b7fd72c /ATRI/plugins/plugin_chat/__init__.py
parentab467e8788b7ef8382bab63fb1a91c8b6305c501 (diff)
downloadATRI-cec804951b97bcab81551bb8c7a1a1e1c473aaa7.tar.gz
ATRI-cec804951b97bcab81551bb8c7a1a1e1c473aaa7.tar.bz2
ATRI-cec804951b97bcab81551bb8c7a1a1e1c473aaa7.zip
[Update]
Diffstat (limited to 'ATRI/plugins/plugin_chat/__init__.py')
-rw-r--r--ATRI/plugins/plugin_chat/__init__.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/ATRI/plugins/plugin_chat/__init__.py b/ATRI/plugins/plugin_chat/__init__.py
new file mode 100644
index 0000000..6fd7099
--- /dev/null
+++ b/ATRI/plugins/plugin_chat/__init__.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+from nonebot.log import logger
+from nonebot.plugin import on_message
+from nonebot.adapters.cqhttp import Bot, Event
+
+from utils.utils_history import saveMessage
+
+
+MessageSave = on_message()
+
[email protected]() # type: ignore
+async def _(bot: Bot, event: Event, state: dict) -> None:
+ user = str(event.user_id)
+ group = str(event.group_id)
+ message = str(event.message)
+ message_id = str(event.id)
+
+ if group == "None":
+ saveMessage(message_id, message, user)
+ else:
+ saveMessage(message_id, message, user, group)
+
+ logger.opt(colors=True).info(f"[<yellow>{group}</yellow>]-U: (<blue>{user}</blue>) | Message: (<green>{message}</green>) Saved successfully") \ No newline at end of file