Skip to content
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

不能发送小程序(1217) #240

Closed
Secret-zero opened this issue Aug 3, 2021 · 6 comments
Closed

不能发送小程序(1217) #240

Secret-zero opened this issue Aug 3, 2021 · 6 comments
Labels
🐛 bug Something isn't working

Comments

@Secret-zero
Copy link

Wechaty - ERROR - internal error <WechatyAccessoryBindingError('Do not instantiate class MiniProgram directly, sse with bot.MiniProgram instead. See wechaty/wechaty#1217', None, None)>

wechaty11 = Wechaty()
            mini_program1 = wechaty11.MiniProgram.create_from_json({
                'appid': 'wx',
                'description': '***',
                'iconUrl': 'http://wx.qlogo.cn/***',
                'pagePath': 'pages/home/home.html',
                'thumbKey': '***',
                'thumbMd5': '***',
                'thumbSize': '15416',
                'thumbUrl': '305b0201000454305202010002040c1dc3f502033d11fd0204b***',
                'title': '***',
                'username': 'gh_42***@app'
            })
            await msg.say(mini_program1)
@Secret-zero Secret-zero added the 🐛 bug Something isn't working label Aug 3, 2021
@wj-Mcat
Copy link
Collaborator

wj-Mcat commented Aug 3, 2021

As the error log, you can't init MiniProgram instance directly. You should create it after ready event which is the suggested way. Hope that can help you.

@Hyfred
Copy link

Hyfred commented Feb 6, 2022

Hi, I also cannot send the mini-program message whatever I crate from json or send the message back if the message is mini-programe
2022-02-06 22:57:55,129 - MiniProgram - INFO - loading the mini-program from json data <{'appid': 'wxf872ea5294e051c0', 'description': '欢乐', 'iconUrl': 'http://mmbiz.qpic.cn/mmbiz_png/SB3eCkicPyC3Ap7MJ98018RB6nJf7Zp1u9567qoE4fKlzbCgH6MYBKibyhdrfUGibgv8icfQvgfd6qlrW2aowNe1icw/640?wx_fmt=png&wxfrom=200', 'pagePath': '?fuid=188521086&shareSource=1&shareId=6&time=1644098964900', 'thumbKey': '18626dcdbbd8f465adbfb9da3fb00153', 'thumbUrl': '30580201000451304f020100020435200c5902030f5bd1020413e0cdcb020462003e78042a777875706c6f61645f777869645f6b646c346f3469767030383532325f37365f313634343138333136300204011c00030201000400', 'title': '这游戏也太虐', 'username': 'gh_c7d9baff425d@app'}> 2022-02-06 22:57:55,130 - MiniProgram - INFO - MiniProgram created 2022-02-06 22:57:55,130 - Message - INFO - Message to MiniProgram <0501500262df9bb987634b7773> 2022-02-06 22:57:55,130 - Wechaty - ERROR - internal error <WechatyOperationError('not a mini_program type message', None, None)>

@Hyfred
Copy link

Hyfred commented Feb 6, 2022

When I follow the python-wechaty/examples/ding-dong-bot-oop.py, using

if msg.type() == MessageType.MESSAGE_TYPE_MINI_PROGRAM:
      mini_program: Optional[MiniProgram] = await msg.to_mini_program() `
it also return the error:
`2022-02-06 23:12:27,754 - Wechaty - ERROR - internal error <WechatyPuppetPayloadError('can"t init mini-program payload {\'appid\': \'wxf872ea5294e051c0\', \'description\': \'欢乐球球\', \'pagePath\': \'?fuid=188521086&shareSource=1&shareId=6&time=1644098964900\', \'iconUrl\': \'http://mmbiz.qpic.cn/mmbiz_png/SB3eCkicPyC3Ap7MJ98018RB6nJf7Zp1u9567qoE4fKlzbCgH6MYBKibyhdrfUGibgv8icfQvgfd6qlrW2aowNe1icw/640?wx_fmt=png&wxfrom=200\', \'thumbUrl\': \'30580201000451304f020100020435200c5902030f5bd1020413e0cdcb020462003e78042a777875706c6f61645f777869645f6b646c346f3469767030383532325f37365f313634343138333136300204011c00030201000400\', \'title\': \'这游戏也太虐了,我为什么要手贱点进来…\', \'username\': \'gh_c7d9baff425d@app\', \'thumbKey\': \'18626dcdbbd8f465adbfb9da3fb00153\', \'thumbSize\': \'38175\', \'thumbMd5\': \'3e108ff9dedc7d0b8547a71d94f49826\'}', None, None)>`

How can I fix the error? Thanks!
The version I used as below:
wechaty 0.8.33
wechaty-grpc 0.20.19
wechaty-plugin-contrib 0.0.13
wechaty-puppet 0.4.0
wechaty-puppet-service 0.8.8

@wj-Mcat
Copy link
Collaborator

wj-Mcat commented Feb 15, 2022

@Hyfred I help you beautify the example code above. Please tell me what the token do you use ?

@Hyfred
Copy link

Hyfred commented Feb 15, 2022

@Hyfred I help you beautify the example code above. Please tell me what the token do you use ?

I use Paimon now. Thanks for your help!@wj-Mcat

@wj-Mcat
Copy link
Collaborator

wj-Mcat commented Apr 5, 2022

Closed by inactive, and it has been be fixed.

@wj-Mcat wj-Mcat closed this as completed Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants