This commit is contained in:
yumoqing 2026-03-02 09:33:03 +08:00
parent 9ebf60699d
commit c328e91f30

View File

@ -4,7 +4,7 @@ from aiohttp import web, ClientSession, FormData, ClientTimeout
from wechatpy.crypto import WeChatCrypto from wechatpy.crypto import WeChatCrypto
from wechatpy.exceptions import InvalidSignatureException, WeChatClientException from wechatpy.exceptions import InvalidSignatureException, WeChatClientException
from wechatpy.messages import ( from wechatpy.messages import (
Message, TextMessage, ImageMessage, VoiceMessage, VideoMessage, BaseMessage, TextMessage, ImageMessage, VoiceMessage, VideoMessage,
LocationMessage, LinkMessage, EventMessage LocationMessage, LinkMessage, EventMessage
) )
from wechatpy.replies import ( from wechatpy.replies import (
@ -72,7 +72,7 @@ class WOAHandler:
url = f"https://api.weixin.qq.com/cgi-bin/media/get?access_token={access_token}&media_id={media_id}" url = f"https://api.weixin.qq.com/cgi-bin/media/get?access_token={access_token}&media_id={media_id}"
return url return url
async def messagehandler(self, request:web.Request, msg:Message): async def messagehandler(self, request:web.Request, msg:BaseMessage):
""" """
TextMessage, ImageMessage, VoiceMessage, VideoMessage, TextMessage, ImageMessage, VoiceMessage, VideoMessage,
LocationMessage, LinkMessage, EventMessage LocationMessage, LinkMessage, EventMessage
@ -121,7 +121,7 @@ class WOAHandler:
reply = ImageReply(message=msg, media_id=media_id) reply = ImageReply(message=msg, media_id=media_id)
return reply return reply
if rzt_msg.msgtype == 'voice': if rzt_msg.msgtype == 'voice':
reply = VoiceMessage(message=msg, media_id=media_id) reply = VoiceReply(message=msg, media_id=media_id)
return reply return reply
if rzt_msg.msgtype == 'video': if rzt_msg.msgtype == 'video':
reply = VideoReply(message=msg, title=rzt_msg.title, reply = VideoReply(message=msg, title=rzt_msg.title,