Example #1
0
 def put(self):
     data = request.get_json()
     ids = data['ids']
     name = data['name']
     users = [u for u in current_bot.friends() if u.puid in ids]
     current_bot.create_group(users, topic=name)
     return {}
Example #2
0
 def put(self):
     data = request.get_json()
     ids = data['ids']
     name = data['name']
     users = [u for u in current_bot.friends() if u.puid in ids]
     current_bot.create_group(users, topic=name)
     return {}
Example #3
0
 def put(self):
     data = request.get_json()
     ids = data['ids'].split(',')
     name = data['name']
     users = [u for u in current_bot.friends() if u.puid in ids]
     group = current_bot.create_group(users, topic=name)
     group.send_msg('创建成功')
     return {}
Example #4
0
def invite(user, pattern):
    groups = sorted(bot.groups(update=True).search(pattern),
                    key=lambda x: x.name)
    if len(groups) > 0:
        for group in groups:
            if len(group.members) == GROUP_MEMBERS_LIMIT:
                continue
            if user in group:
                content = "您已经加入了{} [微笑]".format(group.nick_name)
                user.send(content)
            else:
                group.add_members(user, use_invitation=True)
            return
        else:
            next_topic = settings.pattern_map[pattern].format(
                re.search(r'\d+', s).group() + 1)
            new_group = bot.create_group(get_creators(), topic=next_topic)
            new_group.add_members(user, use_invitation=True)
            new_group.send_msg('创建 [{}] 成功'.format(next_topic))
    else:
        next_topic = settings.pattern_map[pattern].format(1)
        new_group = bot.create_group(get_creators(), topic=next_topic)
        new_group.add_members(user, use_invitation=True)
        new_group.send_msg('创建 [{}] 成功'.format(next_topic))
Example #5
0
def invite(user):
    groups = sorted(bot.groups(update=True).search('Python'),
                    key=lambda x: x.name)
    if len(groups) > 0:
        for group in groups:
            if len(group.members) == 500:
                continue
            if user in group:
                content = "您已经加入了{} [微笑]".format(group.nick_name)
                user.send(content)
            else:
                group.add_members(user, use_invitation=True)
            return
        else:
            next_topic = group_tmpl.format(re.search(r'\d+', s).group() + 1)
            new_group = bot.create_group(get_creators(), topic=next_topic)
    else:
        print('Invite Failed')
Example #6
0
def invite(user):
    groups = sorted(bot.groups(update=True).search('Python'),
                    key=lambda x: x.name)
    if len(groups) > 0:
        for group in groups:
            if len(group.members) == 500:
                continue
            if user in group:
                content = "您已经加入了{} [微笑]".format(group.nick_name)
                user.send(content)
            else:
                group.add_members(user, use_invitation=True)
            return
        else:
            next_topic = group_tmpl.format(re.search(r'\d+', s).group() + 1)
            new_group = bot.create_group(get_creators(), topic=next_topic)
    else:
        print('Invite Failed')