Пример #1
0
    def action(data):

        message = data['text_digits']

        for item in re_list:
            r = re.search(re.compile(item), message)
            if r:
                length = item.count('\\d+')
                if length == 2:
                    date = ['2021', r.group(1), r.group(2)]
                else:
                    date = [r.group(1), r.group(2), r.group(3)]
                date = '-'.join(date)

                try:
                    time_array = time.strptime(date, '%Y-%m-%d')
                    time_stamp = time.mktime(time_array)
                except ValueError:
                    return Reply('博士,这个日期真的没问题吗?')
                except OverflowError:
                    return Reply('博士,阿米娅算不过来了… >.<')

                if time.time() >= time_stamp:
                    return Reply('博士,过去的只能成为了过去,我们只需要朝着我们的未来前进就好,可以的话,阿米娅会一直陪在博士身边的')

                text = calc_jade(date)
                return Reply(text)
Пример #2
0
def group_admin(data):
    permission = data['permission']
    group_id = data['group_id']
    user_id = data['user_id']
    message = data['text']

    if permission in ['OWNER', 'ADMINISTRATOR'] or user_id == admin_id:

        if word_in_sentence(message, ['休息', '下班']):
            res = database.group.get_status(group_id)
            if not res or res['active'] == 1:
                database.group.set_status(group_id, 0, int(time.time()))
                return Reply('阿米娅打卡下班啦,博士需要阿米娅的时候再让阿米娅工作吧。^_^')

        if word_in_sentence(message, ['工作', '上班']):
            res = database.group.get_status(group_id)
            if res and res['active'] == 0:
                seconds = int(time.time()) - int(res['sleep_time'])
                total = calc_time_total(seconds)
                text = '打卡上班啦~阿米娅%s休息了%s……' % ('才' if seconds < 600 else '一共', total)
                if seconds < 600:
                    text += '\n博士真是太过分了!哼~ >.<'
                else:
                    text += '\n充足的休息才能更好的工作,博士,不要忘记休息哦 ^_^'

                database.group.set_status(group_id, 1, 0)
                return Reply(text)
            else:
                return Reply('阿米娅没有偷懒哦博士,请您也不要偷懒~')
Пример #3
0
 def find_voice(name, voice):
     result = database.operator.find_operator_voice(name, voice)
     if result:
         text = '博士,为您找到干员%s的语音档案:\n\n【%s】\n%s' % (name, voice,
                                                   result['voice_text'])
         return Reply(text)
     return Reply('抱歉博士,没有找到干员%s%s相关的语音档案' % (name, voice))
Пример #4
0
def group_admin(data):
    permission = data['permission']
    group_id = data['group_id']
    user_id = data['user_id']
    message = data['text_digits']

    if permission in ['OWNER', 'ADMINISTRATOR'] or user_id == admin_id:

        if word_in_sentence(message, ['休息', '下班']):
            res = database.group.get_status(group_id)
            if not res or res['active'] == 1:
                database.group.set_status(group_id, 0, int(time.time()))
                return Reply('阿米娅打卡下班啦,博士需要阿米娅的时候再让阿米娅工作吧。^_^')

        if word_in_sentence(message, ['工作', '上班']):
            res = database.group.get_status(group_id)
            if res and res['active'] == 0:
                seconds = int(time.time()) - int(res['sleep_time'])
                total = calc_time_total(seconds)
                text = '打卡上班啦~阿米娅%s休息了%s……' % ('才' if seconds < 600 else '一共',
                                               total)
                if seconds < 600:
                    text += '\n博士真是太过分了!哼~ >.<'
                else:
                    text += '\n充足的休息才能更好的工作,博士,不要忘记休息哦 ^_^'

                database.group.set_status(group_id, 1, 0)
                return Reply(text)
            else:
                return Reply('阿米娅没有偷懒哦博士,请您也不要偷懒~')

        if '功能' in message:
            status = 0
            if word_in_sentence(message, ['关闭', '禁用']):
                status = 1
            if word_in_sentence(message, ['打开', '开启']):
                status = 2
            if status:
                for item in Function.index_reg:
                    r = re.search(re.compile(item), message)
                    if r:
                        index = int(r.group(1))
                        if 0 < index <= len(Function.function_list):
                            index -= 1
                            func = Function.function_list[index]
                            if func['id']:
                                group = Function.function_groups[func['id']]
                                database.function.set_disable_function(
                                    group_id, func['id'], status == 1)

                                text = '已在本群%s以下功能:\n\n' % ('关闭' if status == 1
                                                            else '打开')
                                text += '\n'.join([('  --  ' + n)
                                                   for n in group])

                                return Reply(text, auto_image=False)
                            else:
                                return Reply('【%s】功能不可操作' % func['title'])
Пример #5
0
def admin(data):
    message = data['text']
    user_id = data['user_id']

    if user_id == config['admin_id']:
        if '公告' in message:
            database.user.set_waiting(user_id, 'Notice')
            return Reply('正在等待您的公告...')

        if '重启' in message:
            threading.Timer(5, restart).start()
            return Reply('即将在 5 秒后重新启动~')
Пример #6
0
    def action(self, data):

        message = data['text']

        for reg in ['敌人(.*)', '敌方(.*)']:
            r = re.search(re.compile(reg), message)
            if r:
                enemy_name = r.group(1)
                result = self.find_enemy(enemy_name)
                if result:
                    return Reply(result)
                else:
                    return Reply('博士,没有找到%s的资料呢 >.<' % enemy_name)
Пример #7
0
    def requests_content(self, only_id=False, index=0):
        session = requests.session()

        cards = self.get_cards_list()

        if index >= len(cards):
            return Reply('博士,只能获取到列表内的微博哦')

        target_blog = cards[index]
        blog = target_blog['mblog']
        detail_url = target_blog['scheme']
        item_id = target_blog['itemid']

        if only_id:
            return item_id

        # 获取完整正文
        url = 'https://m.weibo.cn/statuses/extend?id=%s' % blog['id']
        result = session.get(url, headers=self.headers).json()
        html_text = result['data']['longTextContent']
        html_text = re.sub('<br />', '\n', html_text)
        html_text = remove_xml_tag(html_text)
        html_text = html_text.strip('\n')

        # 获取静态图片列表
        pics_list = []
        pics = blog['pics'] if 'pics' in blog else []
        for pic in pics:
            pic_url = pic['large']['url']
            name = pic_url.split('/')[-1]
            suffix = name.split('.')[-1]
            if suffix.lower() == 'gif':
                continue
            temp = 'resource/message/Blog'
            path = '%s/%s' % (temp, name)
            if os.path.exists(path) is False:
                if os.path.exists(temp) is False:
                    os.mkdir(temp)
                stream = requests.get(pic_url,
                                      headers=self.headers,
                                      stream=True)
                if stream.status_code == 200:
                    open(path, 'wb').write(stream.content)

            pics_list.append(Image(path))

        return [
            Reply(html_text),
            Reply(detail_url, 0, at=False, auto_image=False),
            Reply(pics_list, 0, at=False)
        ]
Пример #8
0
    def message_filter(self, data):
        if data is False:
            return False

        limit = config['message']['limit']
        close_beta = config['close_beta']

        # 封闭测试
        if 'group_id' in data and close_beta['enable']:
            if str(data['group_id']) != str(close_beta['group_id']):
                return False

        # 屏蔽官方机器人
        for item in ['Q群管家', '小冰']:
            if item in data['text']:
                return False

        # 屏蔽黑名单用户
        is_black = database.user.get_black_user(data['user_id'])
        if is_black:
            return False

        # 消息速度限制
        message_speed = database.message.check_message_speed_by_user(
            data['user_id'], limit['seconds'])
        if message_speed and message_speed >= limit['max_count']:
            self.send_reply(data, Reply('博士说话太快了,请再慢一些吧~', at=False))
            return False

        return True
Пример #9
0
def repeat(data):
    message = data['text']

    if random.random() < config.get("repeat_probability", 0):
        return Reply(message, at=False)
    else:
        return None
Пример #10
0
def waiting(data):
    message = data['text']
    user_id = data['user_id']
    user = database.user.get_user(user_id)

    if user and user['waiting']:
        wait = user['waiting']

        # 群发公告
        if wait == 'Notice':
            database.user.set_waiting(user_id, '')
            group_list = request.get_group_list()
            time_record = time.time()
            for group in group_list:
                request.send_group_message({'group_id': group['id']}, message=message, at=False)
            return Reply('公告群发完毕,共 %s 个群,耗时:%ds' % (len(group_list), time.time() - time_record))

            # 公招图像识别
        if wait == 'Recruit' and 'image' in data and data['image']:
            text = ''
            try:
                res = ORC.basic_general(data['image'])
                for item in res['words_result']:
                    text += item['words']
            except Exception as e:
                print('Recruit', e)
            finally:
                return recruit.action({
                    'text': text,
                    'user_id': user_id
                }, end=True)
Пример #11
0
    def __action(data):

        msg_words = posseg.lcut(data['text'])

        name = ''

        for item in msg_words:
            if name == '' and item.flag == 'n' and item.word in material.material_list:
                name = item.word

        if name == '':
            return Reply('抱歉博士,没有找到相关资料哦')

        result = material.check_material(name)

        return Reply(result)
Пример #12
0
    def pool_list(self):
        text = '博士,这是可更换的卡池列表:\n\n'
        pools = []
        max_len = 0
        for index, item in enumerate(self.all_pools):
            pool = '%s [ %s ]' % (('' if index + 1 >= 10 else '0') +
                                  str(index + 1), item['pool_name'])
            if index % 2 == 0 and len(pool) > max_len:
                max_len = len(pool)
            pools.append(pool)

        pools_table = ''
        curr_row = 0
        for index, item in enumerate(pools):
            if index % 2 == 0:
                pools_table += item
                curr_row = len(item)
            else:
                spaces = max_len - curr_row + 2
                pools_table += '%s%s\n' % (' ' * spaces, item)
                curr_row = 0

        if curr_row != 0:
            pools_table += '\n'

        text += pools_table
        text += '\n要切换卡池,请和阿米娅说「阿米娅切换卡池 "卡池名称" 」\n或「阿米娅切换第 N 个卡池」'
        return Reply(text)
Пример #13
0
def admin(data):
    message = data['text']
    user_id = data['user_id']

    if user_id == config['admin_id']:
        if '公告' in message:
            database.user.set_waiting(user_id, 'Notice')
            return Reply('正在等待您的公告...')
Пример #14
0
 def change_pool(self, user_id, message):
     for item in self.all_pools:
         if item['pool_name'] in message:
             database.user.set_gacha_pool(user_id, item['pool_id'])
             text = ['博士的卡池已切换为【%s】\n' % item['pool_name']]
             if item['pickup_6']:
                 text.append('[★★★★★★] %s' %
                             item['pickup_6'].replace(',', '、'))
             if item['pickup_5']:
                 text.append('[★★★★★ ] %s' %
                             item['pickup_5'].replace(',', '、'))
             if item['pickup_4']:
                 text.append('[☆☆☆☆  ] %s' %
                             item['pickup_4'].replace(',', '、'))
             text = '\n'.join(text)
             return Reply(text)
     return Reply('博士,没有找到这个卡池哦')
Пример #15
0
def emotion(data):
    message = data['text']
    user_id = data['user_id']

    mood = get_mood(user_id)

    if check_sentence_by_re(message, keyword['badWords'], amiya_name[0]):
        if mood - 5 <= 0:
            return Reply('(阿米娅没有应答...似乎已经生气了...)', -5, at=False)

        anger = int((1 - (mood - 5) / 15) * 100)

        return Reply(
            '博士为什么要说这种话,阿米娅要生气了![face67]({anger}%)'.format(anger=anger), -5)

    if check_sentence_by_re(message, keyword['goodWords'], amiya_name[0]):
        if mood < 0:
            if mood + 5 < 0:
                text = '哼!不要以为这样阿米娅就会轻易原谅博士...[face103]'
            else:
                text = '阿米娅这次就原谅博士吧,博士要好好对阿米娅哦[face21]'
            return Reply(text, 5)
        else:
            if word_in_sentence(message, ['我错了', '对不起', '抱歉']):
                if mood >= 15:
                    return Reply('博士为什么要这么说呢,嗯……博士是不是偷偷做了对不起阿米娅的事[face181]', 5)
                else:
                    return Reply('好吧,阿米娅就当博士刚刚是在开玩笑吧,博士要好好对阿米娅哦[face21]', 5)

        return Reply(random.choice(random.choice(talk_words)),
                     5,
                     auto_image=False)

    if mood < 0:
        return Reply('哼~阿米娅生气了!不理博士![face38]', 1)
Пример #16
0
def admin(data):
    message = data['text']
    user_id = data['user_id']

    if user_id == admin_id:
        if '更新干员' in message:
            res = gameData.update_operators()
            if res:
                return Reply(res)

        if '更新地图' in message:
            res = gameData.update_stage()
            if res:
                return Reply(res)

        if '公告' in message:
            database.user.set_waiting(user_id, 'Notice')
            return Reply('正在等待您的公告...')

        if '重启' in message:
            threading.Timer(3, restart).start()
            return Reply('即将重新启动...')

        if '屏蔽' in message:
            r = re.search(r'(\d+)', message)
            if r:
                mute_id = int(r.group(1))
                if mute_id == user_id:
                    return Reply('不能屏蔽您自己...')
                user = database.user.get_user(mute_id)
                if user:
                    database.user.set_black_user(mute_id)
                    return Reply('已屏蔽用户【%s】' % mute_id)
                else:
                    return Reply('没有找到用户【%s】' % mute_id)
Пример #17
0
    def action(self, data):
        if word_in_sentence(data['text_digits'], ['关闭清单', '关闭列表']):
            text = self.disable_func(data)
        else:
            text = self.func_list(data)

        if isinstance(text, Reply):
            return text

        return Reply(TextImage(text))
Пример #18
0
def greeting(data):
    message = data['text']
    nickname = data['nickname']

    for item in ['不能休息', '不能停', '不要休息', '不要停', '很多事情']:
        if item in message:
            pass

    for item in ['早上好', '早安', '中午好', '午安', '下午好', '晚上好']:
        if item in message:
            hour = talk_time()
            text = ''
            if hour:
                text += 'Dr.%s,%s好~' % (nickname, hour)
            else:
                text += 'Dr.%s,这么晚还不睡吗?要注意休息哦~' % nickname
            status = sign_in(data)

            if status['status']:
                text += '\n' + status['text']

            feeling = reward if status['status'] else 2
            coupon = reward if status['status'] else 0
            sign = 1 if status['status'] else 0

            return Reply(text, feeling, sign=sign, coupon=coupon)

    if '签到' in message and word_in_sentence(message, amiya_name[0]):
        status = sign_in(data, 1)
        if status:
            feeling = reward if status['status'] else 2
            coupon = reward if status['status'] else 0
            sign = 1 if status['status'] else 0

            return Reply(status['text'], feeling, sign=sign, coupon=coupon)

    if '晚安' in message:
        return Reply('Dr.%s,晚安~' % nickname)

    for name in amiya_name[1]:
        if message.find(name) == 0:
            return Reply('哼!Dr.%s不许叫人家%s,不然人家要生气了!' % (nickname, name), -3)
Пример #19
0
    def func_list(data):
        disable = database.function.get_disable_function(data['group_id'])
        message = data['text_digits']
        index = -1

        for item in Function.source_code_key:
            if item in message:
                return Reply(Function.source_code)

        for item in Function.index_reg:
            r = re.search(re.compile(item), message)
            if r:
                index = int(r.group(1))

        for item in Function.function_titles:
            if item in message:
                index = Function.function_titles.index(item) + 1

        if 0 < index <= len(function_list):
            index -= 1
            text = '【%s】' % function_list[index]['title']

            if function_list[index]['desc'] == 'source_code':
                return Reply(Function.source_code)

            for sub_item in function_list[index]['desc']:
                text += '\n%s' % sub_item

            return text

        text = '博士,这是阿米娅的功能清单\n\n'
        text += '温馨提醒:使用阿米娅功能的时候,请务必在句子头部带上【阿米娅的名字或昵称】!\n'
        if disable:
            text += '\n注意:本群【%s】启用了功能关闭,被关闭的功能将在下面标注\n' % data['group_id']
        for index, item in enumerate(function_list):
            text += '\n%s[%d] %s' % ('【已关闭】' if item['id'] in disable else
                                     ' ' * 5, index + 1, item['title'])

        text += '\n\n查看功能详情,请发送「阿米娅查看第 N 个功能」或「阿米娅查看【功能名】」来获取使用方法'
        text += '\n要关闭单个功能,请管理员发送「阿米娅关闭第 N 个功能」'

        return text
Пример #20
0
def face_image(data):
    message = data['text'].strip()

    only_at = message == '' and data['is_at']

    path = None
    if re.search('好耶', message):
        path = face_dir + 'haoye.jpg'
    elif (only_at or eliminate_name(message)) and images:
        path = face_dir + random.choice(images)
    if path:
        return Reply(Image(path), at=False)
Пример #21
0
    def find_skin(skin_name):
        skin = database.operator.find_operator_skin(skin_name)
        if skin:
            opt = database.operator.get_operator_by_id(skin['operator_id'])

            text = '博士,为您找到干员%s的皮肤档案:\n\n【%s - %s】\n\n' % (
                opt['operator_name'], skin['skin_group'], skin['skin_name'])
            text += skin['skin_source'] + '\n\n'
            text += skin['skin_usage'] + '\n'
            text += skin['skin_content'] + '\n\n'
            text += ' -- ' + skin['skin_desc']

            reply = [Reply(text)]

            pic = 'resource/images/picture/%s.png' % skin['skin_image']
            if os.path.exists(pic):
                reply.append(Reply(Image(pic), at=False))
            else:
                reply.append(Reply('暂时无法获取到立绘图片~', at=False))

            return reply
Пример #22
0
    def action(self, data):

        user_id = data['user_id']
        message = data['text_digits']
        message_ori = data['text']

        gacha = GaCha(user_id)

        for item in re_list:
            r = re.search(re.compile(item), message)
            if r:
                times = int(find_once(r'\d+', find_once(item, message)))

                if times <= 0:
                    return Reply('博士在捉弄阿米娅吗 >.<')
                if times > 300:
                    return Reply(
                        '博士不要着急,罗德岛的资源要好好规划使用哦,先试试 300 次以内的寻访吧 (#^.^#)')

                user = database.user.get_user(user_id)
                coupon = user['coupon'] if user else 0
                if times > coupon:
                    return Reply('博士,您的寻访凭证(%d张)不够哦~' % coupon)

                if times <= 10:
                    res = gacha.detailed_mode(times, ten_times=times == 10)
                else:
                    res = gacha.continuous_mode(times)

                return Reply(res)

        if '保底' in message:
            return Reply(gacha.check_break_even())

        if word_in_sentence(message, ['多少', '几']):
            user = database.user.get_user(user_id)
            coupon = user['coupon'] if user else 0
            text = '博士的寻访凭证还剩余 %d 张~' % coupon
            if coupon:
                text += '\n博士,快去获得您想要的干员吧 ☆_☆'
            return Reply(TextImage(text))

        if word_in_sentence(message_ori, ['切换', '更换']):
            r = re.search(r'(\d+)', message_ori)
            if r:
                idx = int(r.group(1)) - 1
                if 0 <= idx < len(self.all_pools):
                    message_ori = self.all_pools[idx]['pool_name']
            return self.change_pool(user_id, message_ori)

        if word_in_sentence(message, ['查看', '卡池', '列表']):
            return self.pool_list()

        if word_in_sentence(message, ['抽', '寻访']):
            return Reply('博士是想抽卡吗?和阿米娅说「阿米娅抽卡 N 次」或「阿米娅 N 连抽」就可以了')
Пример #23
0
    def action(data):

        message = data['text_digits']

        r = re.search(re.compile(r'第(\d+)条微博'), message)
        if r:
            index = abs(int(r.group(1)))
            try:
                return blog.requests_content(index=index - 1)
            except Exception as error:
                print('Blog', error)
                return Reply('博士…暂时无法获取微博呢…请稍后再试吧')

        return blog.get_blog_list()
Пример #24
0
    def action(data):

        message = data['text_digits']

        r = re.search(re.compile(r'第(\d+)条微博'), message)
        if r:
            index = abs(int(r.group(1)))
            result = blog.get_new_blog(message_type=data['type'],
                                       index=index - 1)
            if result:
                return result
            else:
                return Reply('博士…暂时无法获取微博呢…请稍后再试吧')

        return blog.get_blog_list()
Пример #25
0
    def action(data):
        msg_words = jieba.lcut_for_search(data['text'])

        name = ''
        rate = 0
        for item in msg_words:
            n, r = find_similar_string(item,
                                       material.material_list,
                                       return_rate=True)
            if rate < r:
                name = n
                rate = r

        if name:
            result = material.check_material(name)
            return Reply(result)
Пример #26
0
    def get_blog_list(self):

        cards = self.get_cards_list()

        text = '博士,这是【明日方舟Arknights】最近的微博列表。\n'

        for index, item in enumerate(cards):
            content = remove_xml_tag(item['mblog']['text'])
            content = content[:30].replace('\n', ' ').replace('#明日方舟#',
                                                              '').strip()

            date = item['mblog']['created_at']
            date = time.strptime(date, '%a %b %d %H:%M:%S +0800 %Y')
            date = time.strftime('%m-%d %H:%M', date)

            text += '\n【%d】%s\n --- %s…' % (index + 1, date, content)

        text += '\n\n请和我说「阿米娅查看第 N 条微博」来获取详情吧'

        return Reply(text)
Пример #27
0
    def action(self, data):
        user = database.user.get_user(data['user_id'])
        if user:
            feeling = user[
                'user_feeling'] if user['user_feeling'] <= 4000 else 4000

            gc = GaCha(data['user_id'])

            text = '博士,这是您的个人信息\n\n' \
                   '今日{sign}签到\n' \
                   '累计签到:{sign_times}\n' \
                   '累计互动:{message_num}\n' \
                   '阿米娅的信赖:{feeling}%\n' \
                   '阿米娅的心情:{mood}%\n' \
                   '\n【抽卡信息】\n' \
                   '寻访凭证剩余:{coupon}\n' \
                   '{break_even}' \
                .format(sign='已' if user['sign_in'] else '未',
                        sign_times=user['sign_times'],
                        message_num=user['message_num'],
                        feeling=int(feeling / 10),
                        mood=int(user['user_mood'] / 15 * 100),
                        coupon=user['coupon'],
                        break_even=gc.check_break_even())

            voice_list = []
            for item in touch:
                if feeling >= item['feeling']:
                    voice_list.append(item['text'])

            if voice_list:
                text += '\n\n' + random.choice(voice_list)

            return Reply(TextImage(text))
        else:
            database.user.update_user(data['user_id'], 0)
            return self.action(data)
Пример #28
0
def admin(data):
    message = data['text']
    user_id = data['user_id']

    if user_id == admin_id:
        if '更新全部' in message:
            return Reply(gameData.update())

        if '更新图片' in message:
            avatars, photo, skills, skins = gameData.save_operator_photo()
            enemies = gameData.save_enemies_photo()
            return Reply('更新了'
                         '\n -- %s 个干员头像'
                         '\n -- %s 张干员半身照'
                         '\n -- %s 个技能图标'
                         '\n -- %s 张干员皮肤'
                         '\n -- %s 张敌人图片' %
                         (avatars, photo, skills, skins, enemies))

        if '公告' in message:
            database.user.set_waiting(user_id, 'Notice')
            return Reply('正在等待您的公告...')

        if '重启' in message:
            threading.Timer(3, restart).start()
            return Reply('即将重新启动...')

        if '屏蔽' in message:
            r = re.search(r'(\d+)', message)
            if r:
                mute_id = int(r.group(1))
                if mute_id == user_id:
                    return Reply('不能屏蔽您自己...')
                user = database.user.get_user(mute_id)
                if user:
                    database.user.set_black_user(mute_id)
                    return Reply('已屏蔽用户【%s】' % mute_id)
                else:
                    return Reply('没有找到用户【%s】' % mute_id)
Пример #29
0
    def natural_language_processing(message):
        result = None
        try:
            result = NLP.emotion(message)
        except Exception as e:
            print('NLP', e)

        if result:
            item = result['items'][0]
            text = ''

            if 'replies' in item and item['replies']:
                text = random.choice(item['replies'])

            label = item['label']
            if label == 'neutral':
                pass
            elif label == 'optimistic':
                text = '虽然听不懂博士在说什么,但阿米娅能感受到博士现在高兴的心情,欸嘿嘿……'
            elif label == 'pessimistic':
                text = '博士心情不好吗?阿米娅不懂怎么安慰博士,但阿米娅会默默陪在博士身边的'

            if text:
                return Reply(text)
Пример #30
0
    def action(data):

        message = data['text_digits']

        r = re.search(re.compile(r'理智(\d+)满(\d+)'), message)
        if r:
            num1 = int(r.group(1))
            num2 = int(r.group(2))
            if num1 < 0 or num2 <= 0:
                return Reply('啊这…看来博士是真的没有理智了……回头问一下可露希尔能不能多给点理智合剂……')
            if num1 >= num2:
                return Reply('阿米娅已经帮博士记……啊这…阿米娅现在可以提醒博士了吗')
            if num2 > 135:
                return Reply('博士的理智上限有这么高吗?')
            full_time = (num2 - num1) * 6 * 60 + int(time.time())
            target_id = data['group_id'] if data['type'] == 'group' else 0
            database.remind.add_intellect_full_alarm(data['user_id'], num1,
                                                     num2, full_time,
                                                     data['type'], target_id)
            return Reply('阿米娅已经帮博士记住了,回复满的时候阿米娅会提醒博士的哦~')

        r_list = ['多少理智', '理智.*多少']
        for item in r_list:
            r = re.search(re.compile(item), message)
            if r:
                info = database.remind.check_intellect_by_user(data['user_id'])
                if info:
                    full_time = time.strftime(
                        '%Y-%m-%d %H:%M', time.localtime(info['full_time']))
                    through = int(time.time()) - info['in_time']
                    restored = int(through / 360) + info['cur_num']

                    text = '博士,根据上一次记录,您的 %d 理智会在 %s 左右回复满\n' \
                           '不计算上限的话,现在已经回复到 %d 理智了' % (info['full_num'], full_time, restored)
                    return Reply(text)
                else:
                    return Reply('阿米娅还没有帮博士记录理智提醒哦')