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

征集添加好友、群更名、群成员变更等行为时各语言版本的提示语 #94

Open
blueset opened this issue Jan 13, 2020 · 11 comments

Comments

@blueset
Copy link
Member

blueset commented Jan 13, 2020

征集添加好友、群更名、群成员变更等「会话及会话成员增删或更新」行为时各语言版本的提示语

本内容将用于及时通知主端相关变更的内容,并及时更新主端缓存。

现在已知的提示语:

添加好友

  • You have added 好友名称 as your WeChat contact. Start chatting!
  • 你已添加了好友名称,现在可以开始聊天了。
  • 好友名称さんをWeChat連絡先として追加しました。 チャットを始めましょう!

群管理员变更

  • 群成员名称」さんがグループマネージャーになりました。

新增群成员

  • 邀请人名称さんは被邀请人名称被邀请人名称さんをグループチャットに招待しました
  • 邀请人名称 invited 群成员名称, 群成员名称, 群成员名称 to the group chat

移除群成员

  • 你将"被移除成员名称"移出了群聊

加入群

  • 邀请人名称 invited you to a group chat with 群成员名称, 群成员名称
  • あなたはQRコードを使用してグループチャットに参加しました。 グループチャットのメンバー: 群成员名称群成员名称
  • "邀请人名称"邀请你加入了群聊
  • "邀请人名称"邀请你和"群成员名称"加入了群聊
  • You've joined this group chat. Other participants are:群成员名称, 群成员名称, 群成员名称, 群成员名称
  • 邀请人名称 invited you and 群成员名称 to the group chat

群名称修改

  • 你修改群名为“新的群名称
  • You changed the group name to "新的群名称"
  • "群成员名称" changed the group name to "新的群名称"

好友名称、备注修改

  • 无提示

群成员名称、群名片修改

  • 无提示
@wolfsilver
Copy link
Contributor

wolfsilver commented Jan 14, 2020

合并消息

  • 该类型暂不支持,请在手机上查看

语音/视频通话

  • 对方曾尝试与你进行语音通话,但没有成功接通

@wolfsilver
Copy link
Contributor

可否做一个兜底的逻辑,现在抛出KeyError异常,会导致消息收不到

@blueset
Copy link
Member Author

blueset commented Jan 14, 2020

可否做一个兜底的逻辑,现在抛出KeyError异常,会导致消息收不到

image

如果你指的是这个问题的话,ETM 最近添加了一个重新缓存会话成员的逻辑(ehForwarderBot/efb-telegram-master@7d64a93 ),已发布到 ETM 2.0.0b44,可以试一下。

@wolfsilver
Copy link
Contributor

可否做一个兜底的逻辑,现在抛出KeyError异常,会导致消息收不到

image

如果你指的是这个问题的话,ETM 最近添加了一个重新缓存会话成员的逻辑(blueset/efb-telegram-master@7d64a93 ETM 2.0.0b44,可以试一下。

试过了,但是像上面的,可能会有遗漏的类型,就会抛异常,这样就收不到消息了

@blueset
Copy link
Member Author

blueset commented Jan 14, 2020

试过了,但是像上面的,可能会有遗漏的类型,就会抛异常,这样就收不到消息了

上面你发过来的这个截图还是做这个更改之前的。

    @staticmethod
    def get_or_enrol_member(cached: ETMChatType, member: ChatMember) -> ETMChatMember:
        # TODO: Add test case for this
        try:
            return cached.get_member(member.uid)
        except KeyError:
            cached_member: ETMChatMember
            if isinstance(member, SystemChatMember):
                cached_member = cached.add_system_member(name=member.name, alias=member.alias, uid=member.uid,
                                                         vendor_specific=member.vendor_specific.copy(),
                                                         description=member.description)
            elif isinstance(member, SelfChatMember):
                cached_member = cached.add_self()
            else:
                cached_member = cached.add_member(name=member.name, alias=member.alias, uid=member.uid,
                                                  vendor_specific=member.vendor_specific.copy(),
                                                  description=member.description)
            cached_member.module_id = member.module_id
            cached_member.module_name = member.module_name
            cached_member.channel_emoji = member.channel_emoji
            return cached_member

[Permalink]

我重新看了一下这部分的代码逻辑,应该是不会有遗漏某个类的情况(if 判断的最后是用 else 收尾 的)。不知道是不是还有其他地方可能有遗漏?

@wolfsilver
Copy link
Contributor

wolfsilver commented Jan 14, 2020

@blueset
Copy link
Member Author

blueset commented Jan 14, 2020

我说的是system发的消息类型:

#94 (comment)

现在的 ETM 应该是「系统类型的会话」和「系统类型的会话成员」都能够在第一次从消息内容发现时自动缓存的呃……

@blueset
Copy link
Member Author

blueset commented Jan 14, 2020

@wolfsilver
Copy link
Contributor

2020-01-14 19:34:54,622 [ERROR]: efb_telegram_master.slave_message (slave_message.send_message; slave_message.py:118)
    Error occurred while processing message from slave channel.
Message: <Message, <SystemChatMember: System (__system__) @ <PrivateChat: xxx (ebe1c137) @ 💬WeChat Slave (blueset.wechat)>>@<ETMPrivateChat: xxx (ebe1c137) @ 💬WeChat Slave (blueset.wechat)> [Text]: 对方曾尝试与你进行语音通话,但没有成功接通; Attributes: None; Delivering to: <efb_telegram_master.TelegramChannel object at 0x7f83eb1e8bb0>; Edited: False; System message: False; Substitutions: None; Target messages: None; UID: [["xxx"]]; Reactions: {}; File: None (None @ None), None; Vendor: {}>
KeyError()
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/efb_telegram_master/slave_message.py", line 89, in send_message
    msg_template, tg_dest = self.get_slave_msg_dest(msg)
  File "/usr/lib/python3.8/site-packages/efb_patch_middleware/__init__.py", line 585, in get_slave_msg_dest
    msg.author = msg.chat.get_member(msg.author.id)
  File "/usr/lib/python3.8/site-packages/efb_telegram_master/chat.py", line 249, in get_member
    return super().get_member(member_id)  # type: ignore
  File "/usr/lib/python3.8/site-packages/ehforwarderbot/chat.py", line 524, in get_member
    raise KeyError
KeyError

@blueset
Copy link
Member Author

blueset commented Jan 14, 2020

2020-01-14 19:34:54,622 [ERROR]: efb_telegram_master.slave_message (slave_message.send_message; slave_message.py:118)
    Error occurred while processing message from slave channel.
Message: <Message, <SystemChatMember: System (__system__) @ <PrivateChat: xxx (ebe1c137) @ 💬WeChat Slave (blueset.wechat)>>@<ETMPrivateChat: xxx (ebe1c137) @ 💬WeChat Slave (blueset.wechat)> [Text]: 对方曾尝试与你进行语音通话,但没有成功接通; Attributes: None; Delivering to: <efb_telegram_master.TelegramChannel object at 0x7f83eb1e8bb0>; Edited: False; System message: False; Substitutions: None; Target messages: None; UID: [["xxx"]]; Reactions: {}; File: None (None @ None), None; Vendor: {}>
KeyError()
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/efb_telegram_master/slave_message.py", line 89, in send_message
    msg_template, tg_dest = self.get_slave_msg_dest(msg)
  File "/usr/lib/python3.8/site-packages/efb_patch_middleware/__init__.py", line 585, in get_slave_msg_dest
    msg.author = msg.chat.get_member(msg.author.id)
  File "/usr/lib/python3.8/site-packages/efb_telegram_master/chat.py", line 249, in get_member
    return super().get_member(member_id)  # type: ignore
  File "/usr/lib/python3.8/site-packages/ehforwarderbot/chat.py", line 524, in get_member
    raise KeyError
KeyError

好吧,是 Patch…… 😅


efb_patch_middleware/__init__.py:585

    # efb_telegram_master/slave_message.py
    def get_slave_msg_dest(self, msg: Message) -> Tuple[str, Optional[TelegramChatID]]:
        """Get the Telegram destination of a message with its header.
        Returns:
            msg_template (str): header of the message.
            tg_dest (Optional[str]): Telegram destination chat, None if muted.
        """
        xid = msg.uid
        msg.chat = self.chat_manager.update_chat_obj(msg.chat)
        msg.author = msg.chat.get_member(msg.author.id)  # 👈👈👈
        chat_uid = utils.chat_id_to_str(chat=msg.chat)
        tg_chats = self.db.get_chat_assoc(slave_uid=chat_uid)
        tg_chat = None

efb_telegram_master/slave_message.py:232

    def get_slave_msg_dest(self, msg: Message) -> Tuple[str, Optional[TelegramChatID]]:
        """Get the Telegram destination of a message with its header.
        Returns:
            msg_template (str): header of the message.
            tg_dest (Optional[str]): Telegram destination chat, None if muted.
        """
        xid = msg.uid
        msg.chat = self.chat_manager.update_chat_obj(msg.chat)
        msg.author = self.chat_manager.get_or_enrol_member(msg.chat, msg.author)  # 👈👈👈

        chat_uid = utils.chat_id_to_str(chat=msg.chat)
        tg_chats = self.db.get_chat_assoc(slave_uid=chat_uid)
        tg_chat = None

@wolfsilver
Copy link
Contributor

sorry...
😭

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

2 participants