Skip to content

Commit

Permalink
Merge pull request #32 from Elepover/pmcenter-lazer
Browse files Browse the repository at this point in the history
pmcenter 2.0 feature drop
  • Loading branch information
Elepover authored May 11, 2020
2 parents 58cf01b + dd05fa4 commit d53f072
Show file tree
Hide file tree
Showing 162 changed files with 2,337 additions and 1,515 deletions.
16 changes: 11 additions & 5 deletions FILE_STRUCTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ File structure of pmcenter's source code:
|- pmcenter - Source code main directory
|- BotCommands - Every bot command's processing logic
| |- ...
|- BotProcess - Bot's message routing logics
| |- ...
|- CallbackActions - Every inline keyboard command's processing logic
| |- ...
|- CommandLines - Every commandline's processing logic
| |- ...
|- Configurations - Configurations' processing logics
| |- ...
|- Enums - pmcenter's self-defined enums
|- EventHandlers - Global error handler and Ctrl-C handler
| |- ...
|- Interfaces - pmcenter's self-defined interfaces
| |- ...
Expand All @@ -18,15 +22,17 @@ File structure of pmcenter's source code:
| | | |- ...
| | |- Writing - For writing things to database
| | | |- ...
| |- H2Helper - http/2 helper
| | |- ...
| |- Logging - Logging module
| | |- ...
| |- NetworkTest - Testing network quality, used by some commands
| | |- ...
| |- Threads - Threads' logics
| | |- ...
| |- UpdateHelper - pmcenter updates helper
| | |- ...
| |- ...
|- BotProcess.cs - Bot's master logic
|- CommandLineRouter.cs - Commandlines' router
|- CommandLines.cs - Loading commandlines to memory
|- CommandManager.cs - Bot commands' router
|- Program.cs - Main entry of pmcenter
|- Setup.cs - Setup wizard's processing logic
|- Template.cs - As its name
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pmcenter

[![build status](https://ci.appveyor.com/api/projects/status/gmbdiackw0563980?svg=true)](https://ci.appveyor.com/project/Elepover/pmcenter) [![CodeFactor](https://www.codefactor.io/repository/github/elepover/pmcenter/badge)](https://www.codefactor.io/repository/github/elepover/pmcenter) [![telegram channel](https://img.shields.io/badge/telegram-channel-blue.svg)](https://t.me/pmcenter_devlog) ![license](https://img.shields.io/github/license/elepover/pmcenter.svg) ![language rank](https://img.shields.io/github/languages/top/elepover/pmcenter.svg?color=brightgreen) ![repo size in bytes](https://img.shields.io/github/repo-size/elepover/pmcenter.svg) ![environment](https://img.shields.io/badge/dotnet-v2.1-blue.svg) ![last commit](https://img.shields.io/github/last-commit/elepover/pmcenter.svg) ![status](https://img.shields.io/badge/status-maintaining-success.svg)
[![build status](https://ci.appveyor.com/api/projects/status/gmbdiackw0563980?svg=true)](https://ci.appveyor.com/project/Elepover/pmcenter) [![CodeFactor](https://www.codefactor.io/repository/github/elepover/pmcenter/badge)](https://www.codefactor.io/repository/github/elepover/pmcenter) [![telegram channel](https://img.shields.io/badge/telegram-channel-blue.svg)](https://t.me/pmcenter_devlog) ![license](https://img.shields.io/github/license/elepover/pmcenter.svg) ![language rank](https://img.shields.io/github/languages/top/elepover/pmcenter.svg?color=brightgreen) ![repo size in bytes](https://img.shields.io/github/repo-size/elepover/pmcenter.svg) ![environment](https://img.shields.io/badge/dotnet-v3.1-blueviolet.svg) ![last commit](https://img.shields.io/github/last-commit/elepover/pmcenter.svg) ![status](https://img.shields.io/badge/status-maintaining-success.svg)

A telegram bot helping you process private messages.

Expand Down Expand Up @@ -142,6 +142,7 @@ Or, use setup wizard:

| Key | Type | User Editable | Description |
| :---- | :---- | :---- | ----:|
| `Minify` | `Boolean`|| To minify pmcenter configurations or not. |
| `APIKey` | `String`|| Your Telegram bot's API key. |
| `OwnerID` | `Long` || The owner's Telegram user ID. |
| `EnableCc` | `Boolean` || Decides whether cc feature is enabled or not. |
Expand Down Expand Up @@ -176,7 +177,13 @@ Or, use setup wizard:
| `UpdateChannel` | `String` || Choose which update channel you prefer to. |
| `IgnoreKeyboardInterrupt` | `Boolean` || Choose whether pmcenter should ignore Ctrl-C interrupts or not. |
| `DisableNetCore3Check` | `Boolean` || Turn this on to hide .NET Core Runtime version warnings. |
| `DisableMessageLinkTip` | `Boolean` || Turn this on to hide message link tip prompts. |
| `AnalyzeStartupTime` | `Boolean` || Turn this on to show detailed analysis of startup time. |
| `SkipAPIKeyVerification` | `Boolean` || Turn this on to skip API Key verification on startup. |
| `EnableActions` | `Boolean` || Turn this on to enable message actions. |
| `CheckLangVersionMismatch` | `Boolean` || Check language version and send alert on startup. |
| `Statistics` | `Stats` || Statistics data. |
| `IgnoredLogModules` | `Array` || List of ignored log modules. Selected modules will not generate output to console. |
| `Socks5Proxies` | `Array` || List of SOCKS5 proxies. |
| `BannedKeywords` | `Array` || Storage of banned keywords. |
| `Banned` | `Array` || Storage of banned users. |
Expand All @@ -199,7 +206,8 @@ Tip: After upgrades, you can send `/saveconf` command to the bot to fix missing
- **Emojis** are supported, and were used by default.
- Currently the response of the `/info` command is unchangeable.
- Familiar with another language? Pull requests are welcome!
- Please think twice before turning on `EnableMsgLink`, it makes it possible for you to reply to messages that are forwarded anonymously or from channels, however, it will cost more and more of your storage space and memory as the storage grows and makes it slower for pmcenter to process configuration files.
- ~~Please think twice before turning on `EnableMsgLink`, it makes it possible for you to reply to messages that are forwarded anonymously or from channels, however, it will cost more and more of your storage space and memory as the storage grows and makes it slower for pmcenter to process configuration files.~~
- Now Message Links play an important role in pmcenter's basic functions. Turning it off is NOT recommended.

#### Changing File Location

Expand Down Expand Up @@ -246,6 +254,7 @@ You can write a `systemd service` to keep it running, even after the host machin
| `/backup` | Owner | Backup configurations. |
| `/editconf <CONF>` | Owner | Manually edit configurations and translations w/ JSON-formatted text. |
| `/saveconf` | Owner | Manually save configurations and translations. Useful after upgrades. |
| `/autosave [off/interval]` | Owner | Enable/Disable autosave. Intervals are in milliseconds (1/1000 of a second). |
| `/readconf` | Owner | Reload configurations without restarting bot. |
| `/resetconf` | Owner | Reset configurations. |
| `/uptime` | Owner | Get system uptime info. |
Expand Down Expand Up @@ -301,6 +310,8 @@ pmcenter is planning to move to .NET Core 3.1, see [issue #25](https://github.co

Please enable the `EnableMsgLink` option in pmcenter's configurations file. Only messages forwarded when `EnableMsgLink` option is turned on can be replied.

You can NOT reply to the messages that were forwarded when `EnableMsgLink` option was disabled since their corresponding message links were missing.

For more information, refer to the [configurations](#pmcenter-settings) part.

### Why pmcenter.json is too large?
Expand Down
15 changes: 13 additions & 2 deletions README_zh.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pmcenter

[![build status](https://ci.appveyor.com/api/projects/status/gmbdiackw0563980?svg=true)](https://ci.appveyor.com/project/Elepover/pmcenter) [![CodeFactor](https://www.codefactor.io/repository/github/elepover/pmcenter/badge)](https://www.codefactor.io/repository/github/elepover/pmcenter) [![telegram channel](https://img.shields.io/badge/telegram-channel-blue.svg)](https://t.me/pmcenter_devlog) ![license](https://img.shields.io/github/license/elepover/pmcenter.svg) ![language rank](https://img.shields.io/github/languages/top/elepover/pmcenter.svg?color=brightgreen) ![repo size in bytes](https://img.shields.io/github/repo-size/elepover/pmcenter.svg) ![environment](https://img.shields.io/badge/dotnet-v2.1-blue.svg) ![last commit](https://img.shields.io/github/last-commit/elepover/pmcenter.svg) ![status](https://img.shields.io/badge/status-maintaining-success.svg)
[![build status](https://ci.appveyor.com/api/projects/status/gmbdiackw0563980?svg=true)](https://ci.appveyor.com/project/Elepover/pmcenter) [![CodeFactor](https://www.codefactor.io/repository/github/elepover/pmcenter/badge)](https://www.codefactor.io/repository/github/elepover/pmcenter) [![telegram channel](https://img.shields.io/badge/telegram-channel-blue.svg)](https://t.me/pmcenter_devlog) ![license](https://img.shields.io/github/license/elepover/pmcenter.svg) ![language rank](https://img.shields.io/github/languages/top/elepover/pmcenter.svg?color=brightgreen) ![repo size in bytes](https://img.shields.io/github/repo-size/elepover/pmcenter.svg) ![environment](https://img.shields.io/badge/dotnet-v3.1-blueviolet.svg) ![last commit](https://img.shields.io/github/last-commit/elepover/pmcenter.svg) ![status](https://img.shields.io/badge/status-maintaining-success.svg)

一个帮你处理私人聊天消息的 Telegram 机器人。

Expand Down Expand Up @@ -144,6 +144,7 @@ docker run -d -v $(pwd)/pmcenter.json:/opt/pmcenter/pmcenter.json --restart alwa

| 项目 | 类型 | 用户可编辑 | 描述 |
| :---- | :---- | :---- | ----:|
| `Minify` | `Boolean`|| 是否精简化 pmcenter 配置 |
| `APIKey` | `String` || 你的 Telegram 机器人 API 密钥 |
| `OwnerID` | `Long` || 使用者的 Telegram ID |
| `EnableCc` | `Boolean` || 是否启用 Cc 功能 |
Expand Down Expand Up @@ -178,7 +179,13 @@ docker run -d -v $(pwd)/pmcenter.json:/opt/pmcenter/pmcenter.json --restart alwa
| `UpdateChannel` | `String` || 选择更新频道 |
| `IgnoreKeyboardInterrupt` | `Boolean` || 是否忽略 Ctrl-C 中断 |
| `DisableNetCore3Check` | `Boolean` || 启用以忽略 .NET Core 运行时版本检查 |
| `DisableMessageLinkTip` | `Boolean` || 启用以忽略消息链接提示 |
| `AnalyzeStartupTime` | `Boolean` || 启用以显示细化的启动时间分析 |
| `SkipAPIKeyVerification` | `Boolean` || 启用以跳过启动时的 API 密钥校验 |
| `EnableActions` | `Boolean` || 启动以启用消息操作面版 |
| `CheckLangVersionMismatch` | `Boolean` || 在启动时检测语言文件版本 |
| `Statistics` | `Stats` || 统计数据 |
| `IgnoredLogModules` | `Array` || 忽略的日志模块列表,这些模块将不会输出信息到控制台 |
| `Socks5Proxies` | `Array` || SOCKS5 代理列表 |
| `BannedKeywords` | `Array` || 屏蔽的关键字存储 |
| `Banned` | `Array` || 封禁用户存储 |
Expand All @@ -202,7 +209,8 @@ docker run -d -v $(pwd)/pmcenter.json:/opt/pmcenter/pmcenter.json --restart alwa
- 目前 `/info` 命令的回复尚且无法更改。
- 欢迎 Pull Requests.
- 切换中文语言包,只需发送 `/switchlang https://raw.githubusercontent.com/Elepover/pmcenter/master/locales/pmcenter_locale_zh.json`
- 在启用 `EnableMsgLink` 前请三思:虽然此功能允许您回复匿名转发消息及频道消息,但 pmcenter 的存储和内存占用将随消息量增长而增加,并将拖慢 pmcenter 操作配置文件时的速度。
- ~~在启用 `EnableMsgLink` 前请三思:虽然此功能允许您回复匿名转发消息及频道消息,但 pmcenter 的存储和内存占用将随消息量增长而增加,并将拖慢 pmcenter 操作配置文件时的速度。~~
- 现在消息链接在 pmcenter 正常功能中起着重要作用,我们不推荐将其禁用。

#### 改变文件位置

Expand Down Expand Up @@ -249,6 +257,7 @@ pmcenter_lang: pmcenter 语言文件路径。
| `/backup` | 所有者 | 备份配置文件 |
| `/editconf <CONF>` | 所有者 | 手动保存 JSON 格式的配置及翻译 |
| `/saveconf` | 所有者 | 手动保存配置及翻译,可用于更新后补齐缺少的配置项 |
| `/autosave [off/时间间隔]` | 所有者 | 启用或停用自动保存,时间间隔单位为毫秒(1/1000 秒) |
| `/readconf` | 所有者 | 在不重启机器人的情况下,重新载入配置 |
| `/resetconf` | 所有者 | 重置配置文件 |
| `/uptime` | 所有者 | 获取系统在线时间信息 |
Expand Down Expand Up @@ -304,6 +313,8 @@ pmcenter 正在准备转向 .NET Core 3.1,请参考 [issue #25](https://github

请在 pmcenter 设置文件中启用 `EnableMsgLink` 选项。只有在 `EnableMsgLink` 选项启用后的转发的消息可以被回复。

您无法回复在此选项处于禁用状态时被转发的消息,因为对应的消息链接不存在。

如需更多信息,请参见[配置](#pmcenter-设置)部分。

### 为什么 pmcenter.json 这么大?
Expand Down
22 changes: 19 additions & 3 deletions locales/pmcenter_locale_en.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"TargetVersion": "1.9.280.15",
"TargetVersion": "2.0.2.0",
"LangCode": "en.imported",
"LanguageNameInEnglish": "English",
"LanguageNameInNative": "English",
"Message_OwnerStart": "😊 *Hi!* I'm your `pmcenter` bot, and I work just for you.\nThis message means that you've set up the bot successfully.\nTo reply to any forwarded messages, just directly reply to them here.\n\nThank you for using the `pmcenter` bot!",
"Message_UserStartDefault": "📨 *Hi!* To send anything to my owner, just send it here.\n⚠ To be informed: I'll *automatically* ban flooding users.",
"Message_ReplySuccessful": "✅ Successfully replied to user $1!",
"Message_ForwardedToOwner": "✅ Your message has been forwarded to my owner!",
"Message_Help": "❓ `pmcenter` *Bot Help*\n/start - Display welcome message.\n/info - Display the message's info.\n/ban - Restrict the user from contacting you.\n/banid <ID> - Restrict a user from contacting you with his/her ID.\n/pardon - Pardon the user.\n/pardonid <ID> - Pardon a user with his/her ID.\n/ping - Test if the bot is working.\n/switchfw - Pause/Resume message forwarding.\n/switchbw - Enable/Disable keyword banning.\n/switchnf - Enable/Disable notifications.\n/switchlang <URL> - Switch language file.\n/switchlangcode [Code] - Switch language with language code.\n/detectperm - Detect permissions.\n/backup - Backup configurations.\n/editconf <CONF> - Manually edit settings w/ JSON-formatted text.\n/saveconf - Manually save all settings and translations. Especially useful after upgrades.\n/readconf - Reload configurations without restarting bot.\n/resetconf - Reset configurations.\n/uptime - Check system uptime information.\n/update - Check for updates and update bot.\n/chkupdate - Only check for updates.\n/catconf - Get your current configurations.\n/restart - Restart bot.\n/status - Get host device's status information.\n/perform - Run performance test.\n/testnetwork - Test latency to servers used by pmcenter.\n/chat - Enter Continued Conversation mode.\n/stopchat - Leave Continued Conversation mode.\n/retract - Retract a message.\n/clearmessagelinks - Clear message links.\n/getstats - Get statistics data.\n/help - Display this message.\n\nThank you for using `pmcenter`!",
"Message_Help": "❓ `pmcenter` *Bot Help*\n/start - Display welcome message.\n/info - Display the message's info.\n/ban - Restrict the user from contacting you.\n/banid <ID> - Restrict a user from contacting you with his/her ID.\n/pardon - Pardon the user.\n/pardonid <ID> - Pardon a user with his/her ID.\n/ping - Test if the bot is working.\n/switchfw - Pause/Resume message forwarding.\n/switchbw - Enable/Disable keyword banning.\n/switchnf - Enable/Disable notifications.\n/switchlang <URL> - Switch language file.\n/switchlangcode [Code] - Switch language with language code.\n/detectperm - Detect permissions.\n/backup - Backup configurations.\n/editconf <CONF> - Manually edit settings w/ JSON-formatted text.\n/saveconf - Manually save all settings and translations. Especially useful after upgrades.\n/readconf - Reload configurations without restarting bot.\n/resetconf - Reset configurations.\n/uptime - Check system uptime information.\n/update - Check for updates and update bot.\n/chkupdate - Only check for updates.\n/catconf - Get your current configurations.\n/restart - Restart bot.\n/status - Get host device's status information.\n/perform - Run performance test.\n/testnetwork - Test latency to servers used by pmcenter.\n/chat - Enter Continued Conversation mode.\n/stopchat - Leave Continued Conversation mode.\n/retract - Retract a message.\n/clearmessagelinks - Clear message links.\n/getstats - Get statistics data.\n/autosave [off/interval] - Switch autosave status.\n/help - Display this message.\n\nThank you for using `pmcenter`!",
"Message_UserBanned": "🚫 The user has been banned permanently.",
"Message_UserPardoned": "✅ You've pardoned the user.",
"Message_CommandNotReplying": "😶 Don't talk to me, spend time chatting with those who love you.",
Expand Down Expand Up @@ -70,5 +70,21 @@
"Message_Retracted": "✅ This message has been retracted.",
"Message_MsgLinksCleared": "✅ All message links have been cleared.",
"Message_AvailableLang": "ℹ *Available languages*\n\n`$1`",
"Message_NetCore31Required": "⚠ You need `.NET Core 3.1` (runtime) installed in order to receive pmcenter v2 and further updates.\n\nLatest .NET Core runtime version detected on your device: `$1`\n\nThis warning will only show once."
"Message_NetCore31Required": "⚠ You need `.NET Core 3.1` (runtime) installed in order to receive pmcenter v2 and further updates.\n\nLatest .NET Core runtime version detected on your device: `$1`\n\nThis warning will only show once.",
"Message_MsgLinkTip": "ℹ Tip: You need to set `EnableMsgLink` option to `true` in pmcenter configurations in order to reply to anonymously forwarded messages.\nThis also happens when the message link for the message couldn't be found.\nDue to Telegram API's restrictions, it's impossible now to reply to that message.\nAfter you set `EnableMsgLink` to `true`, you'll be able to reply to this kind of messages.\n\nThis tip will only prompt once.",
"Message_AutoSaveEnabled": "✅ Autosave *enabled*, interval: `$1s`.",
"Message_AutoSaveIntervalTooShort": "⚠ The current autosave interval (`$1ms`) is *too short*! It may cause high CPU and disk usage as a result. *Disable it if you didn't intend to do that!*",
"Message_AutoSaveDisabled": "✅ Autosave *disabled*.",
"Message_Action_Banned": "✅ User $1 has been banned!",
"Message_Action_Pardoned": "✅ User $1 has been pardoned!",
"Message_Action_ContChatEnabled": "✅ You're now chatting with $1!",
"Message_Action_ContChatDisabled": "✅ Continued chat disabled!",
"Message_Action_Error": "✖ Action failed. Check logs.",
"Message_Action_ErrorWithDetails": "✖ Action failed: $1",
"Message_Action_ChooseAction": "❓ *What do you want to do with this message?*",
"Message_Action_Ban": "✖ Ban the user",
"Message_Action_Pardon": "✅ Pardon the user",
"Message_Action_Chat": "💬 Enter continued conversation",
"Message_Action_StopChat": "💬 Stop continued conversation",
"Message_Action_LinkNotFound": "✖ Cannot find the corresponding message link, did you just clear the message links, or was the message links feature disabled?"
}
Loading

0 comments on commit d53f072

Please sign in to comment.