Compare commits

...

3 Commits

Author SHA1 Message Date
lanvent 6076e2ed0a fix: voice longer than 60s cannot be sent 2023-04-02 12:29:10 +08:00
lanvent cec674cb47 update qrcode 2023-04-02 04:44:08 +08:00
Jianglang c5a90823fa Update README.md 2023-04-02 04:30:40 +08:00
3 changed files with 9 additions and 5 deletions
+4 -2
View File
@@ -72,13 +72,15 @@ def qrCallback(uuid,status,qrcode):
if status == '0':
import qrcode
url = f"https://login.weixin.qq.com/l/{uuid}"
qr_api="https://api.isoyu.com/qr/?m=1&e=L&p=20&url={}".format(url)
print("You can also scan QRCode in the website below:\n{}".format(qr_api))
qr = qrcode.QRCode(border=1)
qr.add_data(url)
qr.make(fit=True)
qr.print_ascii(invert=True)
qr_api="https://api.isoyu.com/qr/?m=1&e=L&p=20&url={}".format(url)
print("You can also scan QRCode in website below:\n{}".format(qr_api))
@singleton
class WechatChannel(ChatChannel):
def __init__(self):
+3 -1
View File
@@ -73,6 +73,9 @@ class WechatyChannel(ChatChannel):
file_path = reply.content
sil_file = os.path.splitext(file_path)[0] + '.sil'
voiceLength = int(any_to_sil(file_path, sil_file))
if voiceLength >= 60000:
voiceLength = 60000
logger.info('[WX] voice too long, length={}, set to 60s'.format(voiceLength))
# 发送语音
t = int(time.time())
msg = FileBox.from_file(sil_file, name=str(t) + '.sil')
@@ -113,7 +116,6 @@ class WechatyChannel(ChatChannel):
return
logger.debug('[WX] message:{}'.format(cmsg))
room = msg.room() # 获取消息来自的群聊. 如果消息不是来自群聊, 则返回None
isgroup = room is not None
ctype = cmsg.ctype
context = self._compose_context(ctype, cmsg.content, isgroup=isgroup, msg=cmsg)
+2 -2
View File
@@ -1,6 +1,6 @@
## 插件化初衷
之前未插件化的代码耦合程度高,如果要定制一些个性化功能(如流量控制、接入`NovelAI`画图平台等),需要了解代码主体,避免影响到其他的功能。在实现多个功能后,不但无法调整功能的优先级顺序,功能配置项也会变得非常混乱。
之前未插件化的代码耦合程度高,如果要定制一些个性化功能(如流量控制、接入`NovelAI`画图平台等),需要了解代码主体,避免影响到其他的功能。多个功能同时存在时,无法调整功能的优先级顺序,功能配置项也非常混乱。
此时插件化应声而出。
@@ -11,7 +11,7 @@
- [x] 插件化能够自由开关和调整优先级。
- [x] 每个插件可在插件文件夹内维护独立的配置文件,方便代码的测试和调试,可以在独立的仓库开发插件。
PS: 插件目前支持`itchat`
PS: 插件目前支持`itchat``wechaty`
## 插件化实现