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

表情、GIF 发送失败(又称「大盆哥哥,生日快乐」) #48

Closed
gadflysu opened this issue May 2, 2019 · 9 comments
Closed

Comments

@gadflysu
Copy link

gadflysu commented May 2, 2019

Version Info

EH Forwarder Bot
Version: 2.0.0b15
Python version:
3.6.7 (default, Dec  5 2018, 15:02:05) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

Master channel:
    Telegram Master (blueset.telegram) 2.0.0b20.dev4 # Default instance

Slave channel:
    WeChat Slave (blueset.wechat) 2.0.0a18 # Default instance

Middlewares:
    No middleware is enabled.

Note that the issue can also be reproduced after I updated the packages to the latest version (showed below) from GitHub and started EFB with the same configuration but empty data in my default profile.

EH Forwarder Bot
Version: 2.0.0b16.dev1
Python version:
3.6.7 (default, Dec  5 2018, 15:02:05) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

Master channel:
    Telegram Master (blueset.telegram) 2.0.0b21.dev6 # Default instance

Slave channel:
    WeChat Slave (blueset.wechat) 2.0.0a19.dev1 # Default instance

Middlewares:
    No middleware is enabled.

Issue Description

When I send stickers (WebP) or GIFs from ETM to EWS, EWS converts them to the same strange GIF that I've never seen before. There was another report saying the same condition.

[Update#1] It is puzzling that the GIF can be seen on my WeChat mobile client, but cannot be seen by my friend in a WeChat group.

[Update#2] Sometimes EFB didn't forward stickers in some conversations other than where this issue occurred. In other words, EWS either sends the strange GIF or doesn't send stickers or GIFs received from ETM.

Steps to Reproduce

Start EFB with ETM & EWS enabled, then send stickers from Telegram.

Verbose Log

Verbose Log
2019-05-02 21:06:31,210 [DEBUG]: telegram.ext.dispatcher (dispatcher.start; dispatcher.py:227)
    Processing Update: {'update_id': 585****43, 'message': {'message_id': 6****7, 'date': 1556802391, 'chat': {'id': -222****38, 'type': 'group', 'title': 'WeChat@****', 'all_members_are_administrators': True}, 'entities': [], 'caption_entities': [], 'photo': [], 'sticker': {'file_id': 'CAADBAADcwwAAsdkLwXi0WOr_Vn4mAI', 'width': 512, 'height': 463, 'thumb': {'file_id': 'AAQEABP2q2QZAASuhtDcG89B9tAmAAIC', 'width': 128, 'height': 116, 'file_size': 4638}, 'emoji': '😏', 'file_size': 20874, 'set_name': 'MunikoSH'}, 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 55******1, 'first_name': 'sudo', 'is_bot': False, 'language_code': 'en'}}}
2019-05-02 21:06:31,210 [DEBUG]: efb_telegram_master.locale_handler (locale_handler.check_update; locale_handler.py:36)
    [585****43] Update has language en.
2019-05-02 21:06:31,210 [DEBUG]: efb_telegram_master.master_message (master_message.msg; master_message.py:89)
    Received message from Telegram: {'message_id': 6****7, 'date': 1556802391, 'chat': {'id': -222****38, 'type': 'group', 'title': 'WeChat@****', 'all_members_are_administrators': True}, 'entities': [], 'caption_entities': [], 'photo': [], 'sticker': {'file_id': 'CAADBAADcwwAAsdkLwXi0WOr_Vn4mAI', 'width': 512, 'height': 463, 'thumb': {'file_id': 'AAQEABP2q2QZAASuhtDcG89B9tAmAAIC', 'width': 128, 'height': 116, 'file_size': 4638}, 'emoji': '😏', 'file_size': 20874, 'set_name': 'MunikoSH'}, 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 55******1, 'first_name': 'sudo', 'is_bot': False, 'language_code': 'en'}}
2019-05-02 21:06:31,211 [DEBUG]: peewee (peewee.execute_sql; peewee.py:2671)
    ('SELECT "t1"."id", "t1"."master_uid", "t1"."slave_uid" FROM "chatassoc" AS "t1" WHERE ("t1"."master_uid" = ?)', ['blueset.telegram -222****38'])
2019-05-02 21:06:31,211 [DEBUG]: efb_telegram_master.master_message (master_message.process_telegram_message; master_message.py:147)
    [-222****38.6****7] Message is edited: False, None
2019-05-02 21:06:31,212 [DEBUG]: peewee (peewee.execute_sql; peewee.py:2671)
    ('SELECT "t1"."id", "t1"."master_uid", "t1"."slave_uid" FROM "chatassoc" AS "t1" WHERE ("t1"."master_uid" = ?)', ['blueset.telegram -222****38'])
2019-05-02 21:06:31,212 [DEBUG]: efb_telegram_master.master_message (master_message.process_telegram_message; master_message.py:223)
    [-222****38.6****7] Telegram received. From private chat: False; Group has multiple linked chats: False; Message replied to another message: False
2019-05-02 21:06:31,212 [DEBUG]: efb_telegram_master.master_message (master_message.process_telegram_message; master_message.py:224)
    [-222****38.6****7] Destination chat = blueset.wechat 8d*****4
2019-05-02 21:06:31,213 [DEBUG]: peewee (peewee.execute_sql; peewee.py:2671)
    ('SELECT "t1"."id", "t1"."slave_channel_id", "t1"."slave_channel_emoji", "t1"."slave_chat_uid", "t1"."slave_chat_name", "t1"."slave_chat_alias", "t1"."slave_chat_type" FROM "slavechatinfo" AS "t1" WHERE (("t1"."slave_channel_id" = ?) AND ("t1"."slave_chat_uid" = ?)) LIMIT ?', ['blueset.wechat', '8d*****4', 1])
2019-05-02 21:06:31,213 [DEBUG]: efb_telegram_master.master_message (master_message.process_telegram_message; master_message.py:266)
    [-222****38.6****7] Message type from Telegram: Sticker
2019-05-02 21:06:31,213 [DEBUG]: efb_telegram_master.master_message (master_message.process_telegram_message; master_message.py:270)
    [-222****38.6****7] EFB message type: Sticker
2019-05-02 21:06:31,640 [DEBUG]: efb_telegram_master.master_message (master_message.process_telegram_message; master_message.py:322)
    [-222****38.6****7] Trying to convert WebP sticker (/tmp/tmp2wcvdvs1.webp) to PNG.
2019-05-02 21:06:31,699 [DEBUG]: efb_telegram_master.master_message (master_message.process_telegram_message; master_message.py:327)
    [-222****38.6****7] WebP sticker is converted to PNG (/tmp/tmp_8e_brlh.png).
2019-05-02 21:06:31,727 [INFO]: plugins.blueset.wechat.WeChatChannel (__init__.send_message; __init__.py:321)
    [-222****38.6****7] Sending message to WeChat:
uid: 8d*****4
UserName: @@93************92
NickName: ****
Type: MsgType.Sticker
Text: 
2019-05-02 21:06:31,728 [DEBUG]: efb_wechat_slave.wxpy.api.chats.chat (chat.mark_as_read; chat.py:291)
    marking <Group: ****> as read
2019-05-02 21:06:32,728 [DEBUG]: plugins.blueset.wechat.WeChatChannel (__init__.send_message; __init__.py:325)
    [-222****38.6****7] Is edited: False
2019-05-02 21:06:32,729 [INFO]: plugins.blueset.wechat.WeChatChannel (__init__.send_message; __init__.py:356)
    [-222****38.6****7] Image/Sticker MsgType.Sticker
2019-05-02 21:06:32,729 [DEBUG]: PIL.PngImagePlugin (PngImagePlugin.call; PngImagePlugin.py:139)
    STREAM b'IHDR' 16 13
2019-05-02 21:06:32,729 [DEBUG]: PIL.PngImagePlugin (PngImagePlugin.call; PngImagePlugin.py:139)
    STREAM b'IDAT' 41 65536
2019-05-02 21:06:32,789 [DEBUG]: plugins.blueset.wechat.WeChatChannel (__init__.send_message; __init__.py:375)
    [-222****38.6****7] Image converted from image/png to GIF
2019-05-02 21:06:32,789 [INFO]: efb_wechat_slave.wxpy.api.chats.chat (chat.wrapped; chat.py:47)
    sending image to <Group: ****>:
/tmp/tmpqbzjpc92.gif
2019-05-02 21:06:32,790 [DEBUG]: itchat (messages.send_image; messages.py:411)
    Request to send a image(mediaId: None) to @@93************92: /tmp/tmpqbzjpc92.gif
2019-05-02 21:06:32,790 [DEBUG]: itchat (messages.upload_file; messages.py:310)
    Request to upload a file: /tmp/tmpqbzjpc92.gif
2019-05-02 21:06:34,927 [DEBUG]: plugins.blueset.wechat.WeChatChannel (__init__.send_message; __init__.py:400)
    WeChat message is assigned with unique ID: 8d*****4 15**********2 15********9
2019-05-02 21:06:34,928 [DEBUG]: peewee (peewee.execute_sql; peewee.py:2671)
    ('INSERT INTO "msglog" ("master_msg_id", "master_msg_id_alt", "slave_message_id", "text", "slave_origin_uid", "slave_origin_display_name", "slave_member_uid", "slave_member_display_name", "media_type", "mime", "file_id", "msg_type", "sent_to", "time") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', ['-222****38.6****7', None, '8d*****4 15**********2 15********9', 'Sent a MsgType.Sticker', 'blueset.wechat 8d*****4', '__chat__', None, None, 'sticker', 'image/webp', 'CAADBAADcwwAAsdkLwXi0WOr_Vn4mAI', 'MsgType.Sticker', 'slave', datetime.datetime(2019, 5, 2, 21, 6, 34, 927503)])

Of course, file_ids are different as expected when I send different stickers.

@catbaron0
Copy link
Contributor

catbaron0 commented May 16, 2019

I have never seen this strange gif, but I can't send to wechat any graphics with an alpha channel including messages of stickers type, image or file inpng or gif format.

I wrote a middleware to convert those graphics to jpeg image. It worked for my case. Hope it could help you out.

@blueset blueset changed the title EWS always sends a strange GIF 表情、GIF 发送失败(又称「大盆哥哥,生日快乐」) May 26, 2019
@blueset
Copy link
Member

blueset commented May 26, 2019

Thank you for the report.

This issue is seen from non-EWS Web WeChat users as well, as this is a server-side error, there is no way that we can completely fix this issue. I will try to include a workaround regarding this when I have time.

@blueset blueset pinned this issue May 26, 2019
blueset added a commit that referenced this issue May 31, 2019
@blueset
Copy link
Member

blueset commented May 31, 2019

Workaround released at version 2.0.0a20.

https://github.com/blueset/efb-wechat-slave/blob/71d341e4158e3f3aa276b13914d879a3b1d7144e/README.rst#L197-L203

@leelaylay
Copy link

Workaround released at version 2.0.0a20.

@blueset According to #56, version 2.0.0a20 still has some bugs.

@kettly1260
Copy link

kettly1260 commented Jun 7, 2019

Workaround released at version 2.0.0a20.

不清楚是由于之前安装过中间件的原因还是新的机制如此,a22版本的贴纸是图片形式发送的,且GIF无法正常发出,bot也不提示错误。已移除中间件,但效果仍与中间件一致 @blueset

@blueset
Copy link
Member

blueset commented Jun 8, 2019

不清楚是由于之前安装过中间件的原因还是新的机制如此,a22版本的贴纸是图片形式发送的,且GIF无法正常发出,bot也不提示错误。已移除中间件,但效果仍与中间件一致

预期行为。微信网页版中发送 GIF 的部分无法正常工作,所以该更新增加了 send_stickers_and_gif_as_jpeg 开关作为应急方案。所有贴纸和 GIF 图片均以 JPEG 形式发送,并丢弃 Alpha 通道、且仅保留第一帧。

参见说明文件中关于 send_stickers_and_gif_as_jpeg 的段落。

@blueset
Copy link
Member

blueset commented Aug 17, 2019

根据用户汇报以及实际测试,以上服务器端的问题均已恢复。将于下一版本设置 send_stickers_and_gif_as_jpeg 的默认值变更为 false

@blueset blueset closed this as completed Aug 17, 2019
@blueset blueset unpinned this issue Aug 17, 2019
@kettly1260
Copy link

根据用户汇报以及实际测试,以上服务器端的问题均已恢复。将于下一版本设置 send_stickers_and_gif_as_jpeg 的默认值变更为 false

TG里面新出的动态表情不能发送,不知能否以GIF的形式发送出去 @blueset

@blueset
Copy link
Member

blueset commented Aug 19, 2019

@kettly1260 请参照 ETM#63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants