コード例 #1
0
ファイル: BaseFunction.py プロジェクト: Moyulingjiu/QQbot
 def throw(self, qq, text):
     date = getNow.toString()
     self.bottle['message'].append({'text': text, 'qq': qq, 'date': date})
     dataManage.save_obj(self.bottle, 'data/Function/Bottle/bottle')
     logManage.member_log(getNow.toString(), qq, '扔出漂流瓶:' + text)
     return '成功扔出一个漂流瓶,当前有' + str(len(
         self.bottle['message'])) + '个漂流瓶' + '\n漂流瓶不是法外之地,每条漂流瓶都有日志记录'
コード例 #2
0
def read_weather():
    filePath = 'data/Function/Weather/weather.txt'
    weather = {}
    if not os.path.exists(filePath):
        logManage.log(getNow.toString(), '天气文件缺失!')
        return weather

    with open(filePath, 'r', encoding='utf-8') as f:
        lines = f.readlines()
        for line in lines:
            line = line.strip()
            if len(line) == 0:
                continue
            if line[0] == '#':
                continue
            datas = line.split('#')
            if len(datas) < 1:
                continue
            pair = datas[0].split('=')
            if len(pair) != 2:
                continue
            pair[0] = pair[0].strip()
            pair[1] = pair[1].strip()
            weather[pair[0]] = pair[1]
    return weather
コード例 #3
0
async def new_day(bot):
    today = str(datetime.date.today())
    reply = '已经重置打卡日期到' + today

    logManage.log(getNow.toString(), '已重置打卡日期到:' + today)

    print('开始重置统计信息')
    statistics = dataManage.read_statistics()  # 读取统计信息
    reply += '\n统计信息如下:'
    reply += '\n被踢出群数:' + str(statistics['kick'])
    reply += '\n退群数:' + str(statistics['quit'])
    reply += '\n禁言次数:' + str(statistics['mute'])
    reply += '\n解除禁言次数:' + str(statistics['unmute'])
    reply += '\n唤醒次数:' + str(statistics['awaken'])
    reply += '\n帮助文档获取次数:' + str(statistics['help'])
    reply += '\n基础功能调用次数:' + str(statistics['base_function'])
    reply += '\ntalk模块调用次数:' + str(statistics['talk'])
    reply += '\nclock_activity模块调用次数:' + str(statistics['clock_activity'])
    reply += '\nimage_search模块调用次数:' + str(statistics['image_search'])
    reply += '\ncommand模块调用次数:' + str(statistics['command'])
    reply += '\noperate模块调用次数:' + str(statistics['operate'])
    reply += '\ngame模块调用次数:' + str(statistics['game'])
    reply += '\n自动加一次数:' + str(statistics['auto_repeat'])
    reply += '\n自主回复次数:' + str(statistics['auto_reply'])
    reply += '\n部落冲突调用次数:' + str(statistics['clash'])
    reply += '\n新好友:' + str(statistics['new_friend'])
    reply += '\n新群:' + str(statistics['new_group'])
    reply += '\n戳一戳:' + str(statistics['nudge'])
    reply += '\n发送消息:' + str(statistics['message'])

    statistics['kick'] = 0
    statistics['quit'] = 0
    statistics['mute'] = 0
    statistics['unmute'] = 0
    statistics['new_friend'] = 0
    statistics['new_group'] = 0

    statistics['awaken'] = 0
    statistics['help'] = 0
    statistics['base_function'] = 0
    statistics['talk'] = 0
    statistics['clock_activity'] = 0
    statistics['image_search'] = 0
    statistics['command'] = 0
    statistics['operate'] = 0
    statistics['game'] = 0
    statistics['auto_repeat'] = 0
    statistics['auto_reply'] = 0
    statistics['clash'] = 0
    statistics['nudge'] = 0
    statistics['message'] = 0
    dataManage.save_statistics(statistics)

    config = dataManage.read_config()
    for group_id in config['test_group']:
        await bot.send_group_message(group_id, reply)

    return
コード例 #4
0
def read_screen_word():
    filePath = 'data/screenWords.txt'
    screen = []
    if not os.path.exists(filePath):
        with open(filePath, 'w', encoding='utf-8') as f:
            f.write('\n')
        logManage.log(getNow.toString(), '屏蔽词文件缺失')
        return screen
    with open(filePath, 'r', encoding='utf-8') as f:
        lines = f.readlines()
        for line in lines:
            line = line.strip()
            if len(line) > 0:
                screen.append(line)
    return screen
コード例 #5
0
ファイル: weather.py プロジェクト: Moyulingjiu/QQbot
def getWeather(cityName):
    # url="http://www.weather.com.cn/weather/101190401.shtml"
    city = dataManage.read_weather()

    if cityName[-1] == '市':
        cityName = cityName[:-1]
    if cityName in city:
        city_num = city[cityName]
        url = "http://www.weather.com.cn/weather/%s.shtml" % city_num

        html = get_html(url)
        result = get_data(html)
        ans = cityName + '的天气如下:\n'
        for i in result:
            ans += str(i[0]) + ',' + str(i[1]) + ',最低气温为:' + \
                str(i[3]) + '℃,最高气温为:' + str(i[2]) + '℃\n'
        return ans[:-1].replace('None', '(获取失败)')
    else:
        logManage.log(getNow.toString(), '查询城市:' + cityName + ',未找到该城市!')
        return '未能查询到该城市,请联系管理员将该城市加入字典'
コード例 #6
0
def read_user(qq):
    global key_allow
    filePath = 'data/__USER__/' + str(qq)
    user = {
        'config': {
            'ai': True,
            'reputation': 5,
            'clash_user_tag': [],  # 玩家标签
            'main_clash_user_tag': 0,  # 默认玩家标签
            'clash_tag': [],  # 部落标签
            'main_clash_tag': 0,  # 默认部落标签
            'key': []
        },
        'buffer': {
            'id': 0,
            'buffer': None,
            'time': 'xx-xx-xx'
        },
        'statistics': {
            'reply': [],
            'RPG': [],
            'card': []
        },
        'date': getNow.toString()
    }

    if not os.path.exists(filePath + '.config'):
        with open(filePath + '.config', 'w', encoding='utf-8') as f:
            f.write('ai=false\n')
            f.write('reputation=5\n')
            f.write('clashUserTag=\n')
            f.write('mainClashUserTag=0\n')
            f.write('clashTag=\n')
            f.write('mainClashTag=0\n')
            f.write('key=*=.=。\n')
            f.write('date=' + user['date'] + '\n')
        if not os.path.exists(filePath + '.data'):
            config = {
                'buffer': user['buffer'],
                'statistics': user['statistics']
            }
            save_obj(config, filePath)
        return user
    if not os.path.exists(filePath + '.data'):
        config = {'buffer': user['buffer'], 'statistics': user['statistics']}
        save_obj(config, filePath)

    config = load_obj(filePath)
    user['buffer'] = config['buffer']
    user['statistics'] = config['statistics']

    with open(filePath + '.config', 'r', encoding='utf-8') as f:
        lines = f.readlines()
        for line in lines:
            line = line.strip()
            if len(line) == 0:
                continue
            if line[0] == '#':
                continue
            datas = line.split('#')
            if len(datas) < 1:
                continue
            pair = datas[0].split('=')
            if len(pair) < 2:
                continue
            pair[0] = pair[0].strip()
            pair[1] = pair[1].strip().lower()

            if pair[0] == 'date':
                user['date'] = pair[1]
            elif pair[0] == 'clashUserTag':
                for i in range(1, len(pair)):
                    if len(pair[i]) > 0:
                        user['config']['clash_user_tag'].append(
                            pair[i].upper())
            elif pair[0] == 'mainClashUserTag' and pair[1].isdigit():
                user['config']['main_clash_user_tag'] = int(pair[1])
            elif pair[0] == 'clashTag':
                for i in range(1, len(pair)):
                    if len(pair[i]) > 0:
                        user['config']['clash_tag'].append(pair[i].upper())
            elif pair[0] == 'mainClashTag' and pair[1].isdigit():
                user['config']['main_clash_tag'] = int(pair[1])
            elif pair[0] == 'ai':
                if pair[1] == 'true':
                    user['config']['ai'] = True
                else:
                    user['config']['ai'] = False
            elif pair[0] == 'key':
                for i in pair:
                    if i in key_allow and i not in user['config']['key']:
                        user['config']['key'].append(i)
    return user
コード例 #7
0
def read_group(group_id):
    global key_allow
    filePath = 'data/__GROUP__/' + str(group_id)
    group = {
        'config': {
            'mute': False,  # 是否禁言
            'limit': False,  # 是否限制
            'nudge': True,  # 是否开启戳一戳
            'RPG': True,  # 是否开启RPG
            'limit_RPG': False,  # 是否开启RPG限制
            'curse': True,  # 是否开启脏话
            'image': False,  # 是否开启图片搜索
            'ai': False,  # 是否开启ai
            'autonomous_reply': True,  # 是否开启自动回复(群内自定义的)
            'repeat': True,  # 是否开启自动加一
            'TRPG': True,  # 是否开启头骰娘
            'clash': False,  # 是否开启部落冲突查询
            'clash_tag': '',  # 部落标签
            'key': ['.', '。', '*'],  # 触发词
            'reply_limit': 0,  # 回复限制次数
            'welcome': False,  # 是否开启欢迎
            'right_train': [],  # 谁可以训练小柒
            'right_activity': [],  # 谁可以发起活动
            'right_mute': [],  # 谁可以禁言
            'right_RPG': [],  # 谁可以开关游戏
            # =============================
            'flash': False,  # 解除闪照
            'member_wather': False,  # 群成员监控
            'revoke': False,  # 防止撤回
            'automatic': False,  # 自动审核
            'pass': ''  # 加群暗号
        },
        'key_reply': {
            'key_at': {},
            'key': {},
            'question': {},
            'question_at': {}
        },  # 关键词回复
        'welcome': None,  # 欢迎语
        'prohibited_word': [],
        'statistics': {
            'reply': [],
            'RPG': [],
            'card': []
        },
        'group': {},  # 分组信息
        'date': getNow.toString()
    }
    if not os.path.exists(filePath + '.config'):
        with open(filePath + '.config', 'w', encoding='utf-8') as f:
            f.write('date=' + group['date'] + '\n')
            f.write('mute=' + str(group['config']['mute']) + '\n')
            f.write('limit=' + str(group['config']['limit']) + '\n')
            f.write('nudge=' + str(group['config']['nudge']) + '\n')
            f.write('TRPG=' + str(group['config']['TRPG']) + '\n')
            f.write('RPG=' + str(group['config']['RPG']) + '\n')
            f.write('RPGlimit=' + str(group['config']['limit_RPG']) + '\n')
            f.write('curse=' + str(group['config']['curse']) + '\n')
            f.write('image=' + str(group['config']['image']) + '\n')
            f.write('ai=' + str(group['config']['ai']) + '\n')
            f.write('autoReply=' + str(group['config']['autonomous_reply']) +
                    '\n')
            f.write('repeat=' + str(group['config']['repeat']) + '\n')
            f.write('clash=' + str(group['config']['clash']) + '\n')
            f.write('clashTag=' + str(group['config']['clash_tag']) + '\n')
            f.write('welcome=' + str(group['config']['welcome']) + '\n')
            f.write('key')
            for i in group['config']['key']:
                f.write('=' + i)
            f.write('\n')
            f.write('replyTimes=' + str(group['config']['reply_limit']) + '\n')
            f.write('trainRight=' +
                    list_string(group['config']['right_train']) + '\n')
            f.write('activityRight=' +
                    list_string(group['config']['right_activity']) + '\n')
            f.write('muteRight=' + list_string(group['config']['right_mute']) +
                    '\n')
            f.write('gameRight=' + list_string(group['config']['right_RPG']) +
                    '\n')
            f.write('flash=' + str(group['config']['flash']) + '\n')
            f.write('memberWather=' + str(group['config']['member_wather']) +
                    '\n')
            f.write('revoke=' + str(group['config']['revoke']) + '\n')
            f.write('automatic=' + str(group['config']['automatic']) + '\n')
            f.write('pass='******'config']['pass']) + '\n')
        data = {
            'key_reply': group['key_reply'],
            'welcome': group['welcome'],
            'prohibited_word': group['prohibited_word'],
            'statistics': group['statistics'],
            'group': group['group']
        }
        if not os.path.exists(filePath + '.data'):
            save_obj(group, filePath)
        else:
            group = load_obj(filePath)
        return group
    if not os.path.exists(filePath + '.data'):
        data = {
            'key_reply': group['key_reply'],
            'welcome': group['welcome'],
            'prohibited_word': group['prohibited_word'],
            'statistics': group['statistics'],
            'group': group['group']
        }
        save_obj(group, filePath)

    data = load_obj(filePath)
    group['key_reply'] = data['key_reply']
    group['welcome'] = data['welcome']
    group['prohibited_word'] = data['prohibited_word']
    group['statistics'] = data['statistics']
    group['group'] = data['group']

    with open(filePath + '.config', 'r', encoding='utf-8') as f:
        lines = f.readlines()
        group['config']['key'] = []
        for line in lines:
            line = line.strip()
            if len(line) == 0:
                continue
            if line[0] == '#':
                continue
            datas = line.split('#')
            if len(datas) < 1:
                continue
            pair = datas[0].split('=')
            if len(pair) < 2:
                continue
            pair[0] = pair[0].strip()
            pair[1] = pair[1].strip().lower()

            if pair[0] == 'date':
                group['date'] = pair[1]
            elif pair[0] == 'mute':
                if pair[1] == 'true':
                    group['config']['mute'] = True
                else:
                    group['config']['mute'] = False
            elif pair[0] == 'limit':
                if pair[1] == 'true':
                    group['config']['limit'] = True
                else:
                    group['config']['limit'] = False
            elif pair[0] == 'nudge':
                if pair[1] == 'true':
                    group['config']['nudge'] = True
                else:
                    group['config']['nudge'] = False
            elif pair[0] == 'TRPG':
                if pair[1] == 'true':
                    group['config']['TRPG'] = True
                else:
                    group['config']['TRPG'] = False
            elif pair[0] == 'RPG':
                if pair[1] == 'true':
                    group['config']['RPG'] = True
                else:
                    group['config']['RPG'] = False
            elif pair[0] == 'RPGlimit':
                if pair[1] == 'true':
                    group['config']['limit_RPG'] = True
                else:
                    group['config']['limit_RPG'] = False
            elif pair[0] == 'curse':
                if pair[1] == 'true':
                    group['config']['curse'] = True
                else:
                    group['config']['curse'] = False
            elif pair[0] == 'image':
                if pair[1] == 'true':
                    group['config']['image'] = True
                else:
                    group['config']['image'] = False
            elif pair[0] == 'ai':
                if pair[1] == 'true':
                    group['config']['ai'] = True
                else:
                    group['config']['ai'] = False
            elif pair[0] == 'autoReply':
                if pair[1] == 'true':
                    group['config']['autonomous_reply'] = True
                else:
                    group['config']['autonomous_reply'] = False
            elif pair[0] == 'repeat':
                if pair[1] == 'true':
                    group['config']['repeat'] = True
                else:
                    group['config']['repeat'] = False
            elif pair[0] == 'clash':
                if pair[1] == 'true':
                    group['config']['clash'] = True
                else:
                    group['config']['clash'] = False
            elif pair[0] == 'clashTag':
                group['config']['clash_tag'] = pair[1].upper()
            elif pair[0] == 'welcome':
                if pair[1] == 'true':
                    group['config']['welcome'] = True
                else:
                    group['config']['welcome'] = False

            elif pair[0] == 'replyTimes':
                if pair[1].isdigit():
                    group['config']['reply_limit'] = int(pair[1])
            elif pair[0] == 'key':
                for i in pair:
                    if i in key_allow and i not in group['config']['key']:
                        group['config']['key'].append(i)

            elif pair[0] == 'trainRight':
                qq_list = pair[1].split(',')
                for i in qq_list:
                    if i.isdigit():
                        group['config']['right_train'].append(int(i))
            elif pair[0] == 'activityRight':
                qq_list = pair[1].split(',')
                for i in qq_list:
                    if i.isdigit():
                        group['config']['right_activity'].append(int(i))
            elif pair[0] == 'muteRight':
                qq_list = pair[1].split(',')
                for i in qq_list:
                    if i.isdigit():
                        group['config']['right_mute'].append(int(i))
            elif pair[0] == 'gameRight':
                qq_list = pair[1].split(',')
                for i in qq_list:
                    if i.isdigit():
                        group['config']['right_RPG'].append(int(i))

            elif pair[0] == 'flash':
                if pair[1] == 'true':
                    group['config']['flash'] = True
                else:
                    group['config']['flash'] = False
            elif pair[0] == 'memberWather':
                if pair[1] == 'true':
                    group['config']['member_wather'] = True
                else:
                    group['config']['member_wather'] = False
            elif pair[0] == 'revoke':
                if pair[1] == 'true':
                    group['config']['revoke'] = True
                else:
                    group['config']['revoke'] = False
            elif pair[0] == 'automatic':
                if pair[1] == 'true':
                    group['config']['automatic'] = True
                else:
                    group['config']['automatic'] = False
            elif pair[0] == 'pass':
                pair = datas[0].split('=')
                pair[1] = pair[1].strip()
                group['config']['pass'] = pair[1]
    return group
コード例 #8
0
        await message_processing.kick_group(bot, event)

    # 群名片修改
    @bot.on(MemberCardChangeEvent)
    async def member_change(event: MemberCardChangeEvent):
        await message_processing.member_change(bot, event)

    # 群消息撤回
    @bot.on(GroupRecallEvent)
    async def member_change(event: GroupRecallEvent):
        await message_processing.group_recall_message(bot, event)

    # ==========================================================
    # 启动机器人
    if not init:
        logManage.log(getNow.toString(),
                      '——————————————————————————\n启动失败!!!\n')
        print('文件缺失!')
        exit(0)

    thread = threading.Thread(target=watcher_bot)
    thread.start()
    qq = bot.qq
    name = message_processing.get_name()
    logManage.log(getNow.toString(), name + '(' + str(qq) + ')初始化成功,开始运行!')

    try:
        bot.run()  # 机器人启动
    except websocket.exceptions.NetworkError:
        print('网络错误')
    except SystemExit:
コード例 #9
0
ファイル: operator.py プロジェクト: Moyulingjiu/QQbot
async def administrator_operation(bot, event, message, qq, name, group_id,
                                  mode, bot_config, config, statistics, right,
                                  group_right):
    bot_qq = bot_config['qq']
    bot_name = bot_config['name']
    master_qq = bot_config['master']

    message_len = len(message)
    message4 = message[:4]
    message5 = message[:5]
    message6 = message[:6]
    message7 = message[:7]
    message8 = message[:8]

    need_reply = False
    need_at = False
    reply_text = ''
    reply_image = ''

    # ===================================================================================
    # ===================================================================================
    # 主人权限
    if message == '主人帮助':
        if right < 1:
            reply_image = command.help_master()
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message == bot_name + '关机':
        if right < 1:
            logManage.log(getNow.toString(), bot_name + '关机!')
            await bot.send(event, '小柒已关机~请手动重新启动小柒')
            print('退出')
            sys.exit()
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True

    elif message == '查看机器人信息':
        if right < 1:
            reply_text = '机器人名字:' + bot_name + '\n机器人QQ:' + str(
                bot_qq) + '\n主人QQ:' + str(master_qq)
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True

    elif message4 == '删除文摘' and message_len > 4:
        if right < 1:
            tmp = message[4:].strip()
            if tmp.isdigit():
                reply_text = talk.delPoem(int(tmp))
            else:
                reply_text = '格式错误'
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message4 == '删除情话' and message_len > 4:
        if right < 1:
            tmp = message[4:].strip()
            if tmp.isdigit():
                reply_text = talk.delLoveTalk(int(tmp))
            else:
                reply_text = '格式错误'
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message4 == '删除脏话' and message_len > 4:
        if right < 1:
            tmp = message[4:].strip()
            if tmp.isdigit():
                reply_text = talk.delSwear(int(tmp))
            else:
                reply_text = '格式错误'
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True

    elif message7 == '添加黑名单 群' and message_len > 7:
        if right < 1:
            tmp = message[7:].strip().split(' ')
            if len(tmp) == 2 and tmp[0].isdigit():
                reply_text = add_blacklist_group(int(tmp[0]), tmp[1],
                                                 bot_config)
            else:
                reply_text = '格式错误'
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message7 == '添加黑名单 人' and message_len > 7:
        if right < 1:
            tmp = message[7:].strip().split(' ')
            if len(tmp) == 2 and tmp[0].isdigit():
                reply_text = add_blacklist_member(int(tmp[0]), tmp[1],
                                                  bot_config)
            else:
                reply_text = '格式错误'
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message7 == '移除黑名单 群' and message_len > 7:
        if right < 1:
            tmp = message[7:].strip()
            if tmp.isdigit():
                reply_text = remove_blacklist_group(int(tmp), bot_config)
            else:
                reply_text = '格式错误'
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message7 == '移除黑名单 人' and message_len > 7:
        if right < 1:
            tmp = message[7:].strip()
            if tmp.isdigit():
                reply_text = remove_blacklist_member(int(tmp), bot_config)
            else:
                reply_text = '格式错误'
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True

    elif message6 == '修改版本信息' and message_len > 6:
        if right < 1:
            reply_text = change_version(message[6:].strip(), bot_config)
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message7 == '修改机器人名字' and message_len > 7:
        if right < 1:
            reply_text = change_bot_name(message[7:].strip(), bot_config)
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message7 == '修改机器人QQ' and message_len > 7:
        if right < 1:
            tmp = message[7:].strip()
            if tmp.isdigit():
                reply_text = change_bot_qq(int(tmp), bot_config)
            else:
                reply_text = '格式错误'
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True

    # 屏蔽词不用strip,因为可能有一些带空格屏蔽词
    elif message8 == '添加全局屏蔽词 ' and message_len > 8:
        if right < 1:
            reply_text = add_screen_word(message[8:])
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message8 == '删除全局屏蔽词 ' and message_len > 8:
        if right < 1:
            reply_text = del_screen_word(message[8:])
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message == '查看全局屏蔽词':
        if right < 1:
            reply_text = view_screen_word()
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True

    elif message == '查看管理员':
        if right < 1:
            reply_text = str(bot_config["administrator"])
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message5 == '添加管理员' and message_len > 5:
        if right < 1:
            tmp = message[5:].strip()
            if tmp.isdigit():
                reply_text = add_administrator(int(tmp), bot_config)
            else:
                reply_text = '格式错误'
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message5 == '删除管理员' and message_len > 5:
        if right < 1:
            tmp = message[5:].strip()
            if tmp.isdigit():
                reply_text = del_administrator(int(tmp), bot_config)
            else:
                reply_text = '格式错误'
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True

    elif message4 == '开启脏话' and message_len > 4:
        if right < 1:
            tmp = message[4:].strip()
            if tmp.isdigit():
                reply_text = add_curse_plan_group(
                    dataManage.read_group(int(tmp)), int(tmp))
            else:
                reply_text = '格式错误'
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message4 == '关闭脏话' and message_len > 4:
        if right < 1:
            tmp = message[4:].strip()
            if tmp.isdigit():
                reply_text = del_curse_plan_group(
                    dataManage.read_group(int(tmp)), int(tmp))
            else:
                reply_text = '格式错误'
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True

    elif message == '清空每分钟回复条数':
        if right < 1:
            statistics['lastMinute'] = 0
            dataManage.save_statistics(statistics)
            reply_text = '清空成功!'
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True

    elif message == '开启涩图' and mode == 1:
        if right < 1:
            reply_text = add_image_search_group(config, group_id)
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True
    elif message == '关闭涩图' and mode == 1:
        if right < 1:
            reply_text = del_image_search_group(config, group_id)
        else:
            reply_text = '权限不足,请输入"我的权限"查看'
        need_reply = True

    # ===================================================================================
    # ===================================================================================
    # 管理员权限
    if not need_reply:
        if message == '管理员帮助':
            if right < 2:
                reply_image = command.help_administrator()
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True

        elif message5 == '添加贡献者' and message_len > 5:
            if right < 2:
                tmp = message[5:].strip()
                if tmp.isdigit():
                    reply_text = add_contributors(int(tmp), bot_config)
                else:
                    reply_text = '格式错误'
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message5 == '删除贡献者' and message_len > 5:
            if right < 2:
                tmp = message[5:].strip()
                if tmp.isdigit():
                    reply_text = del_contributors(int(tmp), bot_config)
                else:
                    reply_text = '格式错误'
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message == '查看贡献者':
            if right < 2:
                reply_text = str(bot_config["contributor"])
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True

        elif message == '查看黑名单 人':
            if right < 2:
                reply_text = str(bot_config["blacklist_member"])
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message == '查看黑名单 群':
            if right < 2:
                reply_text = str(bot_config["blacklist_group"])
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True

        elif message4 == '添加文摘' and message_len > 4:
            if right < 2:
                poem_list = message.split(' ')
                del poem_list[0]
                reply_text = talk.addPoem(poem_list)
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message4 == '添加情话' and message_len > 4:
            if right < 2:
                love_talk_list = message.split(' ')
                del love_talk_list[0]
                reply_text = talk.addLoveTalk(love_talk_list)
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message4 == '添加脏话' and message_len > 4:
            if right < 2:
                swear_list = message.split(' ')
                del swear_list[0]
                reply_text = talk.addSwear(swear_list)
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message == '文摘条数':
            if right < 2:
                reply_text = talk.numPoem()
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message == '情话条数':
            if right < 2:
                reply_text = talk.numLoveTalk()
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message == '脏话条数':
            if right < 2:
                reply_text = talk.numSwear()
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message == '版本信息' or message == '查看版本信息':
            if right < 2:
                reply_text = '当前版本为:' + bot_config['version']
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True

        elif (message == '开启脏话' or message == '脏话开启') and mode == 1:
            if right < 2 or group_right < 2:
                reply_text = add_curse_plan_group(config, group_id)
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif (message == '关闭脏话' or message == '脏话关闭') and mode == 1:
            if right < 2 or group_right < 2:
                reply_text = del_curse_plan_group(config, group_id)
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
    # ===================================================================================
    # ===================================================================================
    # 贡献者权限
    if not need_reply:
        if message == '贡献者帮助':
            if right < 3:
                reply_image = command.help_contributor()
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True

        elif message5 == '添加回复 ' and message_len > 5 and mode == 1:
            if right < 3:
                stringList = message.split(' ')
                if len(stringList) == 3:
                    reply_text = add_question_reply(stringList[1],
                                                    stringList[2], config,
                                                    group_id)
                elif len(stringList) == 4:
                    reply_text = add_question_reply_at(stringList[1],
                                                       stringList[2],
                                                       stringList[3], config,
                                                       group_id)
                else:
                    reply_text = '格式错误!请检查空格'
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message5 == '删除回复 ' and message_len > 5 and mode == 1:
            if right < 3:
                stringList = message.split(' ')
                if len(stringList) == 3:
                    reply_text = del_question_reply(stringList[1],
                                                    stringList[2], config,
                                                    group_id)
                elif len(stringList) == 4:
                    reply_text = del_question_reply_at(stringList[1],
                                                       stringList[2],
                                                       stringList[3], config,
                                                       group_id)
                else:
                    reply_text = '格式错误!请检查空格'
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message5 == '添加回复*' and message_len > 5 and mode == 1:
            if right < 3:
                stringList = message.split('*')
                if len(stringList) == 3:
                    reply_text = add_question_reply(stringList[1],
                                                    stringList[2], config,
                                                    group_id)
                elif len(stringList) == 4:
                    reply_text = add_question_reply_at(stringList[1],
                                                       stringList[2],
                                                       stringList[3], config,
                                                       group_id)
                else:
                    reply_text = '格式错误!请检查星号'
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message5 == '删除回复*' and message_len > 5 and mode == 1:
            if right < 3:
                stringList = message.split('*')
                if len(stringList) == 3:
                    reply_text = del_question_reply(stringList[1],
                                                    stringList[2], config,
                                                    group_id)
                elif len(stringList) == 4:
                    reply_text = del_question_reply_at(stringList[1],
                                                       stringList[2],
                                                       stringList[3], config,
                                                       group_id)
                else:
                    reply_text = '格式错误!请检查星号'
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True

        elif message6 == '添加关键词 ' and message_len > 6 and mode == 1:
            if right < 3:
                stringList = message.split(' ')
                if len(stringList) == 3:
                    reply_text = add_key_reply(stringList[1], stringList[2],
                                               config, group_id)
                elif len(stringList) == 4:
                    reply_text = add_key_reply_at(stringList[1], stringList[2],
                                                  stringList[3], config,
                                                  group_id)
                else:
                    reply_text = '格式错误!请检查空格'
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message6 == '删除关键词 ' and message_len > 6 and mode == 1:
            if right < 3:
                stringList = message.split(' ')
                if len(stringList) == 3:
                    reply_text = del_key_reply(stringList[1], stringList[2],
                                               config, group_id)
                elif len(stringList) == 4:
                    reply_text = del_key_reply_at(stringList[1], stringList[2],
                                                  stringList[3], config,
                                                  group_id)
                else:
                    reply_text = '格式错误!请检查空格'
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message6 == '添加关键词*' and message_len > 6 and mode == 1:
            if right < 3:
                stringList = message.split('*')
                if len(stringList) == 3:
                    reply_text = add_key_reply(stringList[1], stringList[2],
                                               config, group_id)
                elif len(stringList) == 4:
                    reply_text = add_key_reply_at(stringList[1], stringList[2],
                                                  stringList[3], config,
                                                  group_id)
                else:
                    reply_text = '格式错误!请检查星号'
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message6 == '删除关键词*' and message_len > 6 and mode == 1:
            if right < 3:
                stringList = message.split('*')
                if len(stringList) == 3:
                    reply_text = del_key_reply(stringList[1], stringList[2],
                                               config, group_id)
                elif len(stringList) == 4:
                    reply_text = del_key_reply_at(stringList[1], stringList[2],
                                                  stringList[3], config,
                                                  group_id)
                else:
                    reply_text = '格式错误!请检查星号'
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True

        elif message7 == '关键词回复概率' and message_len > 7 and mode == 1:
            if right < 3:
                reply_text = edit_key_probability(message[7:].strip(), config,
                                                  group_id)
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True

        elif (message == '添加复杂回复' or message == '创建复杂回复') and mode == 1:
            user = dataManage.read_user(qq)
            user['buffer']['id'] = 5
            user['buffer']['buffer'] = group_id
            dataManage.save_user(qq, user)
            reply_text = '请在小柒的指引下完成复杂回复的添加~请问你的触发该回复的触发词是什么呢?(只能包含文本和艾特消息,你可以随时输入“*取消创建*”来取消,星号不可以省略哦~)'
            need_reply = True
        elif message == '查看复杂回复' and mode == 1:
            if not config['key_reply'].__contains__('complex'):
                reply_text = '没有开放的复杂回复触发词'
            else:
                if len(config['key_reply']['complex']) != 0:
                    reply_text = '开放的复杂回复触发词如下:'
                    for key, value in config['key_reply']['complex'].items():
                        reply_text += '\n' + key
                else:
                    reply_text = '没有开放的复杂回复触发词'
            need_reply = True
        elif message7 == '删除复杂回复 ' and mode == 1:
            key = message[7:]
            if config['key_reply']['complex'].__contains__(key):
                del config['key_reply']['complex'][key]
                dataManage.save_group(group_id, config)
                reply_text = '删除成功~'
            else:
                reply_text = '没有该触发词'
            need_reply = True

        elif message == '申请权限' and mode == 1:
            if group_right == 0:
                member_list = await bot.member_list(group_id)
                if len(member_list.data) > 10:
                    reply_text = add_contributors(qq, bot_config)
                    if reply_text == '添加成功~':
                        reply_text = '申请贡献者权限成功,可以输入“贡献者帮助”获取管理指令,需要更高权限的请前往' + bot_name + '官方群(479504567)找主人要'
                    elif '正确' in reply_text:
                        reply_text = '因为未知原因申请失败,请稍后重试'
                    else:
                        reply_text = reply_text.replace('他', '你').replace(
                            '该成员', '你')
                else:
                    reply_text = '你的群需要超过10人,请去' + bot_name + '官方群(479504567)找主人要权限'
            else:
                reply_text = '你并非群主(群需要超过10人),请去' + bot_name + '官方群(479504567)找主人要权限'
            need_reply = True

        # 屏蔽词不用strip,因为可能有一些带空格屏蔽词
        elif message6 == '添加屏蔽词 ' and message_len > 6 and mode == 1:
            if group_right < 2 or right < 2:
                reply_text = add_group_screen_word(group_id, config,
                                                   message[6:])
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message6 == '删除屏蔽词 ' and message_len > 6 and mode == 1:
            if group_right < 2 or right < 2:
                reply_text = del_group_screen_word(group_id, config,
                                                   message[6:])
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message == '查看屏蔽词' and mode == 1:
            if group_right < 2 or right < 2:
                reply_text = view_group_screen_word(config)
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True
        elif message == '清空屏蔽词' and mode == 1:
            if group_right < 2 or right < 2:
                reply_text = clear_group_screen_word(qq, group_id, config)
            else:
                reply_text = '权限不足,请输入"我的权限"查看'
            need_reply = True

        elif (message5 == '创建分组 ' or message5 == '添加分组 ') and message_len > 5:
            group_name = ''
            i = 5
            while i < message_len:
                if message[i] != ' ' and message[i] != '@':
                    group_name += message[i]
                else:
                    break
                i += 1
            if len(group_name) > 0:
                member_text = message[i:]
                members = analysis_qqs(member_text)
                reply_text = add_group(group_id, config, group_name, members,
                                       qq)
            else:
                reply_text = '格式错误!'
            need_reply = True
        elif message7 == '添加分组成员 ' and message_len > 7:
            group_name = ''
            i = 7
            while i < message_len:
                if message[i] != ' ' and message[i] != '@':
                    group_name += message[i]
                else:
                    break
                i += 1
            if len(group_name) > 0:
                member_text = message[i:]
                members = analysis_qqs(member_text)
                reply_text = append_group(group_id, config, group_name,
                                          members)
            else:
                reply_text = '格式错误!'
            need_reply = True
        elif message7 == '删除分组成员 ' and message_len > 7:
            group_name = ''
            i = 7
            while i < message_len:
                if message[i] != ' ' and message[i] != '@':
                    group_name += message[i]
                else:
                    break
                i += 1
            if len(group_name) > 0:
                member_text = message[i:]
                members = analysis_qqs(member_text)
                reply_text = remove_group(group_id, config, group_name,
                                          members)
            else:
                reply_text = '格式错误!'
            need_reply = True
        elif message5 == '删除分组 ' and message_len > 5:
            group_name = message[5:].strip()
            reply_text = del_group(group_id, config, group_name)
            need_reply = True
        elif message5 == '查看分组 ' and message_len > 5:
            group_name = message[5:].strip()
            # reply_text = '暂时不能查看分组'
            reply_text = await view_group(bot, group_id, config, group_name)
            need_reply = True
        elif message == '清空分组':
            reply_text = clear_group(group_id, config, qq)
            need_reply = True
        elif message == '分组列表' or message == '查看分组列表':
            reply_text = view_all_group(config)
            need_reply = True

    if need_reply:
        if message != '贡献者帮助' and message != '管理员帮助' and message != '主人帮助':
            logManage.member_log(getNow.toString(), qq,
                                 message + "; 执行结果:" + reply_text)
        else:
            logManage.member_log(getNow.toString(), qq,
                                 message + "; 执行结果:参见command.py里的帮助内容")

    return need_reply, need_at, reply_text, reply_image