diff --git a/src/plugins/DataBase/__pycache__/__init__.cpython-313.pyc b/src/plugins/DataBase/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000..4578379 Binary files /dev/null and b/src/plugins/DataBase/__pycache__/__init__.cpython-313.pyc differ diff --git a/src/plugins/DataBase/__pycache__/dataBase.cpython-313.pyc b/src/plugins/DataBase/__pycache__/dataBase.cpython-313.pyc new file mode 100644 index 0000000..8b89802 Binary files /dev/null and b/src/plugins/DataBase/__pycache__/dataBase.cpython-313.pyc differ diff --git a/src/plugins/DataBase/connect_database.py b/src/plugins/DataBase/connect_database.py deleted file mode 100644 index 27e4997..0000000 --- a/src/plugins/DataBase/connect_database.py +++ /dev/null @@ -1,27 +0,0 @@ -import os - -from sqlmodel import Field, SQLModel, create_engine -from dotenv import load_dotenv -from pathlib import Path - -load_dotenv("../../.env") - - -class ConnectDatabase(SQLModel, table=True): - __tablename__ = 'BasicInformation' - - id: int | None = Field(primary_key=True) - fileName: str | None - includedText: str | None - - -def confirm_database_exists(): - database_path = Path(os.getenv("DATABASE_PATH")) / "DataBase" / "data.db" - - if not database_path.exists(): - engine = create_engine(f"sqlite:///{database_path}") - SQLModel.metadata.create_all(engine) - - -if __name__ == "connect_database": - confirm_database_exists() diff --git a/src/plugins/GetFile/__pycache__/__init__.cpython-313.pyc b/src/plugins/GetFile/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000..434a3f6 Binary files /dev/null and b/src/plugins/GetFile/__pycache__/__init__.cpython-313.pyc differ diff --git a/src/plugins/GetFile/__pycache__/get_file.cpython-313.pyc b/src/plugins/GetFile/__pycache__/get_file.cpython-313.pyc new file mode 100644 index 0000000..47996b9 Binary files /dev/null and b/src/plugins/GetFile/__pycache__/get_file.cpython-313.pyc differ diff --git a/src/plugins/Memigo/.gitignore b/src/plugins/Memigo/.gitignore new file mode 100644 index 0000000..a62ce64 --- /dev/null +++ b/src/plugins/Memigo/.gitignore @@ -0,0 +1,35 @@ +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# Virtual Environment +venv/ +ENV/ + +# IDE +.idea/ +.vscode/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db diff --git a/src/plugins/Memigo/README.md b/src/plugins/Memigo/README.md new file mode 100644 index 0000000..7c8a41a --- /dev/null +++ b/src/plugins/Memigo/README.md @@ -0,0 +1,33 @@ +# Memigo 插件 + +## 简介 + +这是一个 NcatBot 插件模板。 + +## 功能 + +- 群消息事件处理 +- 好友消息事件处理 +- 测试功能 (/test) + +## 使用方法 + +1. 在群聊中发送 "测试" 消息 +2. 在私聊中发送 "测试" 消息 +3. 使用 `/test` 命令测试功能 + +## 配置项 + +- `greeting`: 问候语,默认值为 "你好",可选值: ["你好", "Hello", "Hi"] + +## 依赖 + +- NcatBot + +## 作者 + +Your Name + +## 许可证 + +MIT diff --git a/src/plugins/Memigo/__init__.py b/src/plugins/Memigo/__init__.py new file mode 100644 index 0000000..19a43b8 --- /dev/null +++ b/src/plugins/Memigo/__init__.py @@ -0,0 +1,3 @@ +from .main import Memigo + +__all__ = ["Memigo"] diff --git a/src/plugins/Memigo/connect_database.py b/src/plugins/Memigo/connect_database.py new file mode 100644 index 0000000..c1bc922 --- /dev/null +++ b/src/plugins/Memigo/connect_database.py @@ -0,0 +1,28 @@ +import os + +from sqlmodel import Field, SQLModel, create_engine +from dotenv import load_dotenv +from pathlib import Path + +load_dotenv("../../.env") + + +class ConnectDatabase(SQLModel, table=True): + __tablename__ = 'BasicInformation' + + id: int | None = Field(primary_key=True) + fileName: str | None + includedText: str | None + imageContent: str | None + memeKind: str | None + +database_path = Path(os.getenv("DATA_PATH")) / "DataBase" / "data.db" +# if not database_path.exists(): +# engine = create_engine(f"sqlite:///{database_path}") +# +# else: +# engine = create_engine(f"sqlite:///{database_path}") +# SQLModel.metadata.create_all(engine) + +engine = create_engine(f"sqlite:///{database_path}") +SQLModel.metadata.create_all(engine) \ No newline at end of file diff --git a/src/plugins/Memigo/main.py b/src/plugins/Memigo/main.py new file mode 100644 index 0000000..6215b80 --- /dev/null +++ b/src/plugins/Memigo/main.py @@ -0,0 +1,18 @@ +import os + +from ncatbot.plugin import BasePlugin, CompatibleEnrollment +from ncatbot.core import GroupMessage, PrivateMessage, BaseMessage +from ncatbot.utils import get_log + +bot = CompatibleEnrollment # 兼容回调函数注册器 +_log = get_log() + +class Memigo(BasePlugin): + name = "Memigo" # 插件名称 + version = "0.0.1" # 插件版本 + author = "pythagodzilla" # 插件作者 + info = "你的meme分类好伙伴" # 插件描述 + + @bot.startup_event() + async def startup(self): + _log.info("Plugin Memigo has started up! ") diff --git a/src/plugins/Memigo/requirements.txt b/src/plugins/Memigo/requirements.txt new file mode 100644 index 0000000..ebd323d --- /dev/null +++ b/src/plugins/Memigo/requirements.txt @@ -0,0 +1,7 @@ +# 插件依赖项 +# 例如: requests==2.28.1 + +ncatbot~=3.8.8.post7 +sqlmodel~=0.0.24 +dotenv~=0.9.9 +python-dotenv~=1.1.1 \ No newline at end of file diff --git a/src/plugins/Test/.gitignore b/src/plugins/Test/.gitignore new file mode 100644 index 0000000..a62ce64 --- /dev/null +++ b/src/plugins/Test/.gitignore @@ -0,0 +1,35 @@ +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# Virtual Environment +venv/ +ENV/ + +# IDE +.idea/ +.vscode/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db diff --git a/src/plugins/Test/README.md b/src/plugins/Test/README.md new file mode 100644 index 0000000..c919a1b --- /dev/null +++ b/src/plugins/Test/README.md @@ -0,0 +1,33 @@ +# Test 插件 + +## 简介 + +这是一个 NcatBot 插件模板。 + +## 功能 + +- 群消息事件处理 +- 好友消息事件处理 +- 测试功能 (/test) + +## 使用方法 + +1. 在群聊中发送 "测试" 消息 +2. 在私聊中发送 "测试" 消息 +3. 使用 `/test` 命令测试功能 + +## 配置项 + +- `greeting`: 问候语,默认值为 "你好",可选值: ["你好", "Hello", "Hi"] + +## 依赖 + +- NcatBot + +## 作者 + +Your Name + +## 许可证 + +MIT diff --git a/src/plugins/Test/__init__.py b/src/plugins/Test/__init__.py new file mode 100644 index 0000000..d7089ac --- /dev/null +++ b/src/plugins/Test/__init__.py @@ -0,0 +1,3 @@ +from .main import Test + +__all__ = ["Test"] diff --git a/src/plugins/Test/main.py b/src/plugins/Test/main.py new file mode 100644 index 0000000..e132a21 --- /dev/null +++ b/src/plugins/Test/main.py @@ -0,0 +1,23 @@ +from ncatbot.core import PrivateMessage +from ncatbot.plugin import BasePlugin, CompatibleEnrollment +from ncatbot.utils import get_log + +bot = CompatibleEnrollment # 兼容回调函数注册器 +_log = get_log() + +class Test(BasePlugin): + name = "Test" # 插件名称 + version = "0.0.1" # 插件版本 + author = "Your Name" # 插件作者 + info = "这是一个示例插件,用于演示插件系统的基本功能" # 插件描述 + dependencies = {} # 插件依赖,格式: {"插件名": "版本要求"} + + # @bot.private_event() + # async def test_unzip(self, msg: PrivateMessage): + # _log.info(f"{msg.message[0]["type"]}") + + @bot.private_event() + async def on_receive_images_private_event(self, msg: PrivateMessage): + if msg.message[0]["type"] == "image": + file_name = msg.message[0]["data"]["file"] + _log.warning(f"{file_name}") \ No newline at end of file diff --git a/src/plugins/Test/requirements.txt b/src/plugins/Test/requirements.txt new file mode 100644 index 0000000..a84c066 --- /dev/null +++ b/src/plugins/Test/requirements.txt @@ -0,0 +1,2 @@ +# 插件依赖项 +# 例如: requests==2.28.1