 amazonSearch = new AmazonSearch(process.env.AWS_ASSOCIATE_ID, process.env.AWS_ID, process.env.AWS_SECRET)
 
 newReleaseSearch = (msg,query,isKindle) ->
-  monthBeforeLast = moment().add(-2,'M').format('MM-YYYY')
   # 検索の実行
-  amazonSearch.search(query, isKindle ,monthBeforeLast, 1,
+  amazonSearch.search(query, isKindle, 1,
     ((item) -> msg.send "#{item.title}が見つかったよー。¥n発売日は #{item.releaseDate}だよー¥n#{item.url}"),
-    (() -> msg.send "#{query}は最近リリースされてないよー"))
+    (() -> msg.send "#{query}は最近リリースされてないよー")
+  )
+
+nexWeekSearch = (msg, query , isKindle) ->
+  nextWeek = moment().add(+1,'w').format('YYYY-MM-DD')
+  futureTimeSearch(msg,query,isKindle, nextWeek)
+
+tomorrowSearch = (msg, query , isKindle) ->
+  nextDay = moment().add(+1,'d').format('YYYY-MM-DD')
+  futureTimeSearch(msg,query,isKindle, nextDay)
+
+futureTimeSearch = (msg, query, isKindle, time) ->
+  amazonSearch.search(query, isKindle , 1,
+    ((item) -> msg.send "#{item.title}が発売されるよ。¥n発売日は #{item.releaseDate}だよー¥n#{item.url}" if item.releaseDate is time)
+  )
+
 
 module.exports = (robot) ->
 

        }

      if page < totalPages and page < 10
        setTimeout(this.search, 5000, query,isKindle,month, page + 1,callback, nothingCallBack)

    ).catch((err) ->
      console.log("error:", err)

moment = require 'moment'
_ = require 'lodash'

class AmazonSearch
  comicNode = "2278488051"
  @operationHelper
