Пример #1
0
    def send_message_back(self, message_chain: MessageChain) -> None:
        """
        原路发送消息(接收到的消息从哪里来就往哪里发)

        :param message_chain: 消息内容chain
        :return: 无
        """
        if self.is_group_message():
            Conn.send_group_message(self.sender_member.group.id, message_chain)

        if self.is_temp_message():
            Conn.send_temp_message(self.sender_member.qq,
                                   self.sender_member.group.id, message_chain)

        if self.is_friend_message():
            Conn.send_friend_message(self.sender_friend.qq, message_chain)
Пример #2
0
    def __on_click_send_group_message(self):
        """
        点击发送消息给群按钮

        :return: 无
        """

        # 获取到选中群的值列表
        value_list = self.treeview_group_list.item(self.treeview_group_list.focus(), "values")

        try:
            # 获取qq并发送消息
            qq = value_list[0]
            message_chain = MessageChain()
            text = self.text_group_send.get(1.0, END)
            if text == "\n":
                return
            message_chain.add_plain_text(text)
            Conn.send_group_message(qq, message_chain)
            self.text_group_send.delete(1.0, END)
        except:
            messagebox.showerror(message=SEND_ERROR_MSG)
            return