-
-
Notifications
You must be signed in to change notification settings - Fork 718
增加监听wechatpadpro消息平台的事件 #1998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
增加监听wechatpadpro消息平台的事件 #1998
Conversation
增加监听wechatpadpro消息平台的事件
## 审查者指南
此 PR 引入了对 WechatPadPro 消息平台的支持,通过扩展 PlatformAdapterType 枚举及其名称映射,并且更新了依赖安装提示以引用正确的 pilk 包。
#### 更新后的 PlatformAdapterType 枚举和适配器映射的类图
```mermaid
classDiagram
class PlatformAdapterType {
<<enum.Flag>>
AIOCQHTTP
QQOFFICIAL
VCHAT
GEWECHAT
TELEGRAM
WECOM
LARK
WECHATPADPRO
ALL
}
class ADAPTER_NAME_2_TYPE {
"aiocqhttp": PlatformAdapterType.AIOCQHTTP
"qqofficial": PlatformAdapterType.QQOFFICIAL
"vchat": PlatformAdapterType.VCHAT
"gewechat": PlatformAdapterType.GEWECHAT
"telegram": PlatformAdapterType.TELEGRAM
"wecom": PlatformAdapterType.WECOM
"lark": PlatformAdapterType.LARK
"wechatpadpro": PlatformAdapterType.WECHATPADPRO
} 更新后的 audio_to_tencent_silk_base64 异常处理的类图classDiagram
class audio_to_tencent_silk_base64 {
+async audio_to_tencent_silk_base64(audio_path: str) -> tuple[str, float]
}
class Exception {
}
audio_to_tencent_silk_base64 ..> Exception : raises
文件级别变更
可能相关的问题
提示和命令与 Sourcery 互动
自定义您的体验访问您的 仪表板 以:
获取帮助Original review guide in EnglishReviewer's GuideThis PR introduces support for the WechatPadPro message platform by extending the PlatformAdapterType enum and its name mapping, and also updates the dependency installation prompt to reference the correct pilk package. Class diagram for updated PlatformAdapterType enum and adapter mappingclassDiagram
class PlatformAdapterType {
<<enum.Flag>>
AIOCQHTTP
QQOFFICIAL
VCHAT
GEWECHAT
TELEGRAM
WECOM
LARK
WECHATPADPRO
ALL
}
class ADAPTER_NAME_2_TYPE {
"aiocqhttp": PlatformAdapterType.AIOCQHTTP
"qqofficial": PlatformAdapterType.QQOFFICIAL
"vchat": PlatformAdapterType.VCHAT
"gewechat": PlatformAdapterType.GEWECHAT
"telegram": PlatformAdapterType.TELEGRAM
"wecom": PlatformAdapterType.WECOM
"lark": PlatformAdapterType.LARK
"wechatpadpro": PlatformAdapterType.WECHATPADPRO
}
Class diagram for updated audio_to_tencent_silk_base64 exception handlingclassDiagram
class audio_to_tencent_silk_base64 {
+async audio_to_tencent_silk_base64(audio_path: str) -> tuple[str, float]
}
class Exception {
}
audio_to_tencent_silk_base64 ..> Exception : raises
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -117,7 +117,7 @@ async def audio_to_tencent_silk_base64(audio_path: str) -> tuple[str, float]: | |||
try: | |||
import pilk | |||
except ImportError as e: | |||
raise Exception("未安装 pysilk,请执行: pip install pysilk") from e | |||
raise Exception("未安装 pilk: pip install pilk") from e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (code-quality): 提出一个特定的错误,而不是通用的 Exception
或 BaseException
(raise-specific-error
)
解释
如果一段代码引发一个特定的异常类型, 而不是通用的 [`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException) 或 [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception), 调用代码可以:- 获取更多关于错误类型的信息
- 为其定义特定的异常处理
这样,代码的调用者可以适当地处理错误。
您如何解决这个问题?
因此,与其让代码引发 Exception
或 BaseException
,例如
if incorrect_input(value):
raise Exception("输入不正确")
您可以让代码引发一个特定的错误,例如
if incorrect_input(value):
raise ValueError("输入不正确")
或者
class IncorrectInputError(Exception):
pass
if incorrect_input(value):
raise IncorrectInputError("输入不正确")
Original comment in English
issue (code-quality): Raise a specific error instead of the general Exception
or BaseException
(raise-specific-error
)
Explanation
If a piece of code raises a specific exception type rather than the generic [`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException) or [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception), the calling code can:- get more information about what type of error it is
- define specific exception handling for it
This way, callers of the code can handle the error appropriately.
How can you solve this?
- Use one of the built-in exceptions of the standard library.
- Define your own error class that subclasses
Exception
.
So instead of having code raising Exception
or BaseException
like
if incorrect_input(value):
raise Exception("The input is incorrect")
you can have code raising a specific error like
if incorrect_input(value):
raise ValueError("The input is incorrect")
or
class IncorrectInputError(Exception):
pass
if incorrect_input(value):
raise IncorrectInputError("The input is incorrect")
修正pilk依赖提示文案
增加监听wechatpadpro消息平台的事件
好的,这是翻译成中文的 pull request 总结:
Sourcery 总结
添加对监听 wechatpadpro 平台事件的支持并更正 pilk 依赖错误消息
新特性:
Bug 修复:
Original summary in English
Summary by Sourcery
Add support for listening to wechatpadpro platform events and correct the pilk dependency error message
New Features:
Bug Fixes: