Go to the documentation of this file.00001
00009 package script;
00010
00011 import org.joda.time.DateTime;
00012 import org.joda.time.format.DateTimeFormat;
00013 import org.joda.time.format.DateTimeFormatter;
00014
00015 import com.rosalfred.core.ia.rivescript.BotReply;
00016 import com.rosalfred.core.ia.rivescript.RiveScript;
00017 import com.rosalfred.core.ia.rivescript.lang.java.RunRiver;
00018 import com.google.common.base.Joiner;
00019
00026 public class date_current implements RunRiver {
00027
00028 @Override
00029 public BotReply invoke(RiveScript rs, String user, String[] args) {
00030 DateTimeFormatter formatter;
00031
00032 if (args.length > 0) {
00033 formatter = DateTimeFormat.forPattern(Joiner.on(" ").join(args));
00034 } else {
00035 formatter = DateTimeFormat.mediumDate();
00036 }
00037
00038 return new BotReply(formatter.print(new DateTime()));
00039 }
00040
00041 }