Esempio n. 1
0
 def auto_accept_friends(msg):
     logger.info("enter accept")
     #new_friend = self.bot.accept_friend(msg.card)
     new_friend = msg.card.accept()
     new_friend.send('你好,欢迎加入千千结大家庭,加入更多群聊请回复:加群')
     #msg.reply('欢迎加入北京芊芊结1群,加入更多群请回复:加群')
     #new_friend = self.bot.friends().search(msg.sender.name)[0]
     group_add = self.bot.groups().search(u'北京芊芊结1群')[0]
     group_add.add_members(new_friend, use_invitation=True)
     logger.info("after accept")
Esempio n. 2
0
    def run_task(self):
        self.msg_from_friends_accept()
        self.msg_from_friends()
        self.create_group_logfile()
        #my_groups = []
        self.group_msg()

        while True:
            if not self.bot.alive:
                logger.info('not login')
                self.main()
                break
            time.sleep(10)
Esempio n. 3
0
        def auto_accept_friends(msg):
            logger.info("enter accept")
            #new_friend = self.bot.accept_friend(msg.card)
            new_friend = msg.card.accept()
            new_friend.send(
                '嗨,您好!欢迎你加入芊芊结北京单身群,为了保证群内良好的交流与互动,请进群后务必根据群要求修改群名片,并完成相应步骤,你才能更好脱单哦!!'
            )
            #msg.reply('欢迎加入北京芊芊结1群,加入更多群请回复:加群')
            #new_friend = self.bot.friends().search(msg.sender.name)[0]
            group_add = self.bot.groups().search(self.invite_group1)[0]
            group_add.add_members(new_friend, use_invitation=True)
            msg.reply_raw_msg(
                raw_type=42,
                raw_content='<msg username="******" nickname="豆豆要发芽"/>')
            new_friend.send('另外如若想进入其他北京地区单身群,需要做点小任务哦!将以下图片转发到朋友圈,并配上以下\
文字,完成后将截图发送给我即可。文字内容如下:')
            new_friend.send(u"”这个平台不错哦,群主也很靠谱,大家可以扫描加入,体验一下“")
            new_friend.send_image("material/welcome.jpg")
Esempio n. 4
0
 def create_group_logfile(self):
     group = self.bot.groups(update=True)
     logger.info(group)
     for gs in group:
         group_name = hashlib.md5(gs.name.encode('utf-8')).hexdigest()[-8:]
         logger.info(gs)
         logger.info(group_name)
         log_file = os.path.join(self.path, group_name)
         if not os.path.exists(log_file):
             os.mkdir(log_file)
Esempio n. 5
0
        def print_mp_msg(msg):
            #self.friend.send(msg)
            #self.friend.send_raw_msg( raw_content=msg.raw)
            #msg.forward(self.friend)
            """
            if msg.type == SHARING and msg.sender.name == '爱净意':
                for article in msg.articles:
                    if '第壹简报' in article.title:
                        self.friend.send(article.title)
                        self.friend.send(article.url)
                        #article_url = 'https://mp.weixin.qq.com/s/5E_SGRmaDA9O1nZgjGG0mw'
                        jb = jianbao.Get_Jianbao(article.url)
                        jb_content = jb.out_jianbao()
                        logger.info(jb_content)
                        self.friend.send(jb_content)
            if msg.type == SHARING and msg.sender.name == '硕士博士俱乐部':
                for article in msg.articles:
                    if '妹子篇' in article.title:
                        self.friend.send(article.title)
                        self.friend.send(article.url)
            if msg.type == SHARING and msg.sender.name == '硕博联谊':
                for article in msg.articles:
                    if  '妹子' in article.title and '现居北京' in article.title:
                        self.friend.send(article.title)
                        self.friend.send(article.url)
            """
            if msg.type == SHARING and msg.sender.name == '简报微刊':
                for article in msg.articles:
                    if '简报微刊' in article.title:
                        #self.friend.send(article.title)
                        #self.friend.send(article.url)
                        jb = jianbao.Get_Jianbao(article.url)
                        jb_content = jb.out_jianbao()
                        self.jb_content = jb_content
                        logger.info(jb_content)
                        #self.friend.send(jb_content)

                        for group_n in self.group_jianbao_list:
                            try:
                                my_group = self.bot.groups().search(group_n)[0]
                                my_group.send(jb_content)
                            except (IndexError, e):
                                logger.error(
                                    '%s not exists, please check it!' % val)
            if msg.type == SHARING and msg.sender.name == '第壹简报':
                for article in msg.articles:
                    if '第壹简报' in article.title:
                        #self.friend.send(article.title)
                        #self.friend.send(article.url)
                        _jb = diyi.Get_Jianbao(article.url)
                        diyi_content = _jb.out_jianbao()
                        self.diyi_content = diyi_content
                        logger.info(diyi_content)
                        #self.friend.send(jb_content)

                        for group_n in self.group_jianbao_list:
                            try:
                                my_group = self.bot.groups().search(group_n)[0]
                                my_group.send(diyi_content)
                            except (IndexError, e):
                                logger.error(
                                    '%s not exists, please check it!' % val)
Esempio n. 6
0
 def send_friend_msg(self, send_msg):
     logger.info("send message to beijing group")
     self.torla = self.bot.groups().search(u'北京交友群')[0]
     self.torla.send(send_msg)
Esempio n. 7
0
 def auto_accept_friends(msg):
     logger.info("enter accept")
     #new_friend = self.bot.accept_friend(msg.card)
     new_friend = msg.card.accept()
     new_friend.send('你好,欢迎加入北京交友群,此群用于聊天交友,不要发布支付宝红包、广告、砍价等信息哦。同意进群请回复"是"')
     logger.info("after accept")
Esempio n. 8
0
 def send_friend_msg(self,send_friend,send_msg):
     logger.info(send_friend)
     self.friend_chuxin = self.bot.friends().search(send_friend)[0]
     self.friend_chuxin.send(send_msg)