wechat-service
wechat-service copied to clipboard
无法接收纯数字的消息。
任意用户发送纯数字, 比如:1 比如:019293834 都会无法接收,显示错误 on_error:expected string or bytes-like object
任意用户发送纯数字, 比如:1 比如:019293834 都会无法接收,显示错误 on_error:expected string or bytes-like object
请问这个问题解决了吗?
In bot.py
add this line before at_match = self.AT_PATTERN.match(str(msg['content']))
:
msg['content'] = str(msg['content'])
so that part should look like this after the fix:
if '@chatroom' in msg['wxid']:
msg['roomid'] = msg['wxid'] #群id
msg['senderid'] = msg['id1'] #个人id
else:
msg['roomid'] = None
msg['senderid'] = msg['wxid'] #个人id
msg['content'] = str(msg['content'])
at_match = self.AT_PATTERN.match(str(msg['content']))
if at_match:
msg['at_nickname'] = at_match.groups()[0]
msg['content'] = at_match.groups()[1]
msg['at_bot'] = msg['at_nickname'] == self.name
@wuxin1030 @simonwanghub @ChisBread