Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
講師名も含んだカレンダーイベントを作成するスクリプト
function DMMEnglish() {
var criteria = "from:info@mail.dmm.com レッスン予約完了";
eachUnreadMessage(criteria, function (message) {
var body = message.getBody();
var [matched, year, month, day] = /ご予約日:(\d+)(\d\d)(\d\d)/.exec(body);
var [matched, sh, sm] = /開始時間:(\d\d)(\d\d)/.exec(body);
var [matched, teacher] = /講師名:([^\n]+)/.exec(body);
var sdate = new Date(year, month-1, day, sh, sm);
var edate = new Date(sdate.getTime() + 30 * 60000);
createEvent("DMM英会話 " + teacher + "先生", sdate, edate);
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment