             getBusSchedule("minakusa",value,url[index],robot)
             console.log "#{value}:#{urlKusatsu[index]}"
             getBusSchedule("kusatsu",value,urlKusatsu[index],robot)
+
+    #コマンドから祝日のデータ更新
+    robot.respond /holiday update/i, (msg) ->
+        updatePublicHoliday(new Date)
+
+#祝日更新関数
+updatePublicHoliday = (now) ->
+    year = now.getFullYear()
+    key = "publicHoliday_#{year}"
+    robot.brain.data[key] = []
+    brainPublicHoliday(year,robot)
 
 #曜日の要素取得
 getDayOfWeek = (now,robot) ->

            hour = 5
        count = 0
        busHour = hour
        #str = "@#{msg.message.user.name} \n"
        str = "\n"
        str += "#{toName}行き \n"
        flag = 0

        loop
            nextBus = []
            console.log key = "#{to}_#{allDay[dayIndex]}_time#{busHour}"
            while robot.brain.data[key] is null
                busHour++
                if busHour > 24
                    flag = 1
                    break

            if flag is 1
               console.log "last bus"
               str += "最後のバスです"
               break
            for value, index in robot.brain.data[key]
                tmpTime = parseInt(value.match(/\d{2}/))
                #シャトルバスの場合の判定
                if not tmpBus = value.match(/\D/)
                    tmpBus = viaS[0]
                if busHour > hour and ///#{bus}///.test(tmpBus)
                    nextBus.push(value)
                    count++
                else if tmpTime > min and ///#{bus}///.test(tmpBus)
                    nextBus.push(value)
                    count++
                if count is 5
                    break
            str += busHour
            str += "時："
            str += nextBus.join()
            if count is 5 or hour+2 < busHour
                break
            busHour++
            str += "\n"
        msg.reply str

    #コマンドから全てのバスの時刻表を取得
    robot.respond /get data/i, (msg) ->
        console.log "get data now"
        now = new Date
        brainPublicHoliday(now.getFullYear(),robot)

module.exports = (robot) ->
    #毎年1/1の1時に祝日データの更新
    new cron('0 1 1 1 *', () ->
        updatePublickHoliday(new Date)
    ).start()

    #毎日午前3時にその曜日の時刻表を取得し，データを更新する(エラー処理などはそのうち追加
    # TO DO : cronで叩くとなぜかエラーが出るのなんとかする
    # まあ最悪自分にリプライ投げるみたいな雑な対策で
    new cron('0 3 * * *', () ->
        now = new Date
        console.log "午前3時:#{now}"
        #dayIndex = getDayOfWeek(now,robot)
        #getBusSchedule(allDay[dayIndex],url[dayIndex],robot)
    ).start()

    #次のバスを表示（デフォルトでは10分後）
    robot.respond /bus(.*)/i, (msg) ->
