import std.array, std.format, std.json; // ツイート string tweet(Twitter tw, string msg) { return tw.callAPI!"statuses.update"(["status" : msg]); } // 画像も一緒にツイート string tweetWithMedia(Twitter tw, string msg, string[] imgFilePaths) { return tw.callAPI!"statuses.update"([ "status" : msg, "media_ids" : format("%(%s,%)", imgFilePaths.map!(a => parseJSON(tw.callAPI!"media.upload"(a))["media_id_string"].str)) ]); }
ツイートします。