<commit_before>/**
 * Usage:
 * - 消息功能
 * Author:
 * - hopesfish at 163.com
 */
require('date-utils');
var ejs = require('ejs');
var utils = require("../utils");
var conf = require('../../conf');
var UserServices = require("../../services/UserServices");

function add_leave_start(info, next) {
    if (info.session.parent) {
        var text = ["请回复数字选择【开始日期】或者直接回复【开始日期】，如6月1日则回复0601："];
        var date = Date.today();
        info.session.parent.addleave = {dates: []};
        while (text.length < 6) {
            if (!utils.is_holiday(date)) {
                text.push('【' + text.length + '】 ' + date.toYMD());
                info.session.parent.addleave.dates.push(date.toYMD());
            }
            date = date.clone();
            date.addDays(1);
        }
        info.wait("add leave parent date input");
        next(null, text.join("\n"));
    } else if (info.session.teacher) {
        next(null, '抱歉！该功能尚未为教师开放。');
    } else {
        return next(null, "抱歉，您不是认证用户，不能使用该功能。");
    }
};

module.exports = function(webot) {
    // 消息提示语
    webot.set('add leave start by text', {
        domain: "gateway",
        pattern: /^(请假|事假|病假|(add )?leave)/i,
        handler: add_leave_start
    });<commit_msg>add leave module<commit_after>/**
 * Usage:
 * - 消息功能
 * Author:
 * - hopesfish at 163.com
 */
require('date-utils');
var ejs = require('ejs');
var utils = require("../utils");
var conf = require('../../conf');
var UserServices = require("../../services/UserServices");

function add_leave_start(info, next) {
    if (info.session.parent) {
        var text = ["请回复数字选择【开始日期】或者直接回复【开始日期】，如6月1日则回复四位数字0601："];
        var date = Date.today();
        info.session.parent.addleave = {dates: []};
        while (text.length < 6) {
            if (!utils.is_holiday(date)) {
                text.push('【' + text.length + '】 ' + date.toYMD());
                info.session.parent.addleave.dates.push(date.toYMD());
            }
            date = date.clone();
            date.addDays(1);
        }
        info.wait("add leave parent date input");
        next(null, text.join("\n"));
    } else if (info.session.teacher) {
        next(null, '抱歉！该功能尚未为教师开放。');
    } else {
        return next(null, "抱歉，您不是认证用户，不能使用该功能。");
    }
};

module.exports = function(webot) {
    // 消息提示语
    webot.set('add leave start by text', {
        domain: "gateway",
        pattern: /^(请假|事假|病假|(add )?leave)/i,
        handler: add_leave_start
    });
{'fraction_non_alphanumeric': 0.1848398865018241, 'fraction_numerical': 0.008917713822456425, 'mean_word_length': 2.260237780713342, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6785124', 'n_tokens_mistral': 939, 'n_tokens_neox': 965, 'n_words': 156}