koishi-plugin-temporaryban 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +8 -132
  3. package/package.json +1 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 koishi-plugin-temporaryban Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,143 +1,15 @@
1
1
  # koishi-plugin-temporaryban
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/koishi-plugin-temporaryban?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-temporaryban)
4
+ [![npm downloads](https://img.shields.io/npm/dm/koishi-plugin-temporaryban?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-temporaryban)
5
+ [![License](https://img.shields.io/npm/l/koishi-plugin-temporaryban?style=flat-square)](https://github.com/koishijs/koishi-plugin-temporaryban/blob/master/LICENSE)
4
6
 
5
- [English](#english) | [中文](#chinese)
6
-
7
- <a name="english"></a>
8
- ## English
9
-
10
- A powerful Koishi forbidden words detection and temporary ban plugin. Supports database persistence for word lists, multiple detection mechanisms, automatic email reporting, and comprehensive group management commands.
11
-
12
- ### ✨ Key Features
13
-
14
- - **Multiple Detection Mechanisms**:
15
- - 🏠 **Local Dictionary (Database)**: Supports dynamic addition/deletion via database, no restart required.
16
- - ☁️ **Cloud API**: Integrated **Baidu AI**, **Aliyun Green**, and **Tencent Cloud TMS** for intelligent detection.
17
- - 🌐 **Online API**: Supports generic online API detection.
18
- - 🧠 **AI (LLM)**: Supports OpenAI-compatible APIs (SiliconFlow, DeepSeek, etc.) for advanced context-aware moderation.
19
- - **Smart Verification & Context Analysis**:
20
- - 🕵️ **Smart Verification**: Can be configured to use AI to verify violations detected by Local/API methods, reducing false positives.
21
- - 📝 **Context Awareness**: Analyzes recent chat history to understand context (e.g., distinguishing between a joke and a real threat).
22
- - **Smart Punishment System**:
23
- - 🚫 Automatically recalls violating messages.
24
- - ⏱️ Triggers automatic mute after cumulative violations.
25
- - 🛡️ **Dynamic Whitelist**: Automatically recognizes group owners and admins; supports manual user whitelist configuration.
26
- - **Email Notification & Summary**:
27
- - 📧 Supports immediate notification for each violation.
28
- - 📊 **Daily/Periodic Summary**: Supports sending summary reports every N days to avoid spam.
29
- - 🎨 Beautiful HTML email templates.
30
- - **Convenient Management Commands**:
31
- - New `temporaryban` command system for managing word lists, whitelists, and viewing statistics directly in groups.
32
-
33
- ### 📦 Installation
34
-
35
- This plugin depends on Koishi's **Database** service. Please ensure you have installed and configured a database plugin (e.g., MySQL, SQLite).
36
-
37
- ```bash
38
- # Install plugin
39
- npm install koishi-plugin-temporaryban
40
-
41
- # Install database plugin (e.g., mysql)
42
- npm install @koishijs/plugin-database-mysql
43
- ```
44
-
45
- ### ⚙️ Configuration
46
-
47
- #### 1. Basic Settings
48
-
49
- - **`debug`**: Enable debug mode for detailed logs.
50
- - **`adminList`**: Global admin list (User ID). Users in this list can use advanced management commands (e.g., manual report trigger).
51
- - **`checkAdmin`**: Whether to check bot's admin permission in group. If true, bot will skip checking if it is not an admin/owner. Default: true.
52
-
53
- #### 2. Global Default Parameters
54
-
55
- These parameters act as defaults if not configured specifically for a group:
56
-
57
- - **`defaultMuteMinutes`**: Default mute duration (minutes).
58
- - **`defaultTriggerThreshold`**: Default violation count threshold.
59
- - **`defaultAiThreshold`**: Default AI strictness (0.0 - 1.0).
60
- - **`defaultCheckProbability`**: Default check probability (0.0 - 1.0).
61
-
62
- #### 3. Cloud API Configuration
63
-
64
- Supports **Baidu AI**, **Aliyun**, and **Tencent Cloud**. Configure the respective sections (`baidu`, `aliyun`, `tencent`) with your API keys if you wish to use them.
65
-
66
- #### 3. Email Notification (SMTP)
67
-
68
- | Option | Description | Example |
69
- | --- | --- | --- |
70
- | `host` | SMTP Server Address | `smtp.qq.com` |
71
- | `port` | SMTP Port | `465` (SSL) |
72
- | `user` | Sender Account | `123456@qq.com` |
73
- | `pass` | **Authorization Code/Password** | Use Auth Code for QQ Mail |
74
- | `receivers` | List of admin emails to receive notifications | `['admin@example.com']` |
75
- | `summaryIntervalDays` | **Summary Interval (Days)** | `1` (Daily); `0` (Immediate) |
76
-
77
- #### 4. Group Monitoring (Groups)
78
-
79
- You can configure each group separately:
80
-
81
- - **`groupId`**: Target Group ID.
82
- - **`detectionMethods`**: Enabled detection methods (Multi-select: `local`, `api`, `ai`, `baidu`, `aliyun`, `tencent`).
83
- - **`smartVerification`**: Enable Smart Verification. If true, a violation detected by `local` or `api` will trigger an AI check on the context to confirm. (Requires `ai` method configuration).
84
- - **`contextMsgCount`**: Number of recent messages to include in context analysis (Default: 3).
85
- - **`aiThreshold`**: AI Strictness Threshold (0.0 - 1.0). Higher means stricter (only high confidence violations are punished). Leave empty to use global default.
86
- - **`checkProbability`**: Probability to check a message (0.0 - 1.0). 1.0 means check all. Leave empty to use global default.
87
- - **`triggerThreshold`**: Violations count to trigger mute. Leave empty to use global default.
88
- - **`triggerWindowMinutes`**: Violation counting window (Default: 5 mins).
89
- - **`muteMinutes`**: Mute duration. Leave empty to use global default.
90
- - **`detailedLog`**: Enable detailed debug logs for this group.
91
-
92
- ### 💻 Commands
93
-
94
- All commands start with `temporaryban`.
95
-
96
- #### Global Commands
97
- *Global Admins (`config.adminList`) only*
98
-
99
- - **`temporaryban.report`**
100
- - Manually trigger a violation summary report for the last 24 hours and send via email.
101
- - **`temporaryban.cleancache`**
102
- - Manually trigger cache cleanup (if applicable).
103
-
104
- #### Group Management Commands
105
- *Group Owner, Group Admin, or Global Admin only*
106
-
107
- - **`temporaryban.add <word>`**
108
- - Add a forbidden word to the current group dictionary.
109
- - **`temporaryban.remove <word>`**
110
- - Remove a forbidden word from the current group dictionary.
111
- - **`temporaryban.list`**
112
- - List all forbidden words in the current group.
113
- - **`temporaryban.whitelist.add <user>`**
114
- - Add a user to the current group whitelist.
115
- - **`temporaryban.whitelist.remove <user>`**
116
- - Remove a user from the current group whitelist.
117
- - **`temporaryban.stats`**
118
- - View violation statistics for the current period.
119
- - **`temporaryban.clean <user>`**
120
- - Clear violation records for a user (Manual pardon).
121
- - **`temporaryban.check <text>`**
122
- - Check if text contains forbidden words (Detection only, no punishment).
123
- - **`temporaryban.history <user> [limit]`**
124
- - View recent chat history of a user (Stored in DB for context verification).
125
- - **`temporaryban.info`**
126
- - View current group configuration (Enabled status, methods, thresholds, etc.).
127
-
128
- ### 🛠️ Development
129
-
130
- This project follows a modular structure:
131
-
132
- - **`src/commands/`**: Command implementations split by category.
133
- - **`src/services/`**: Core logic (Detector, Mailer).
134
- - **`src/utils/`**: Helper functions and types.
135
- - **`src/locales/`**: Internationalization files.
7
+ **[中文文档](#中文) | [English Documentation](docs/README_en.md)**
136
8
 
137
9
  ---
138
10
 
139
11
  <a name="chinese"></a>
140
- ## 中文
12
+ ## 📖 简介
141
13
 
142
14
  一个功能强大的 Koishi 违禁词检测与自动禁言插件。支持数据库持久化词库、多重检测机制、自动邮件汇报以及完善的群组管理指令。
143
15
 
@@ -272,3 +144,7 @@ npm install @koishijs/plugin-database-mysql
272
144
  ## 📝 License
273
145
 
274
146
  MIT
147
+
148
+ ## Star History
149
+
150
+ [![Star History Chart](https://api.star-history.com/svg?repos=acmuhan/koishi-plugin-temporaryban&type=date&legend=top-left)](https://www.star-history.com/#acmuhan/koishi-plugin-temporaryban&type=date&legend=top-left)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-temporaryban",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Koishi 违禁词检测与禁言插件,支持本地词库与在线API检测,违规邮件通知。",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",