public async Task InsertPost(Post post) { using (var rentedConnection = await ConnectionPool.RentConnectionAsync()) { InsertQuery.Connection = rentedConnection; InsertQuery.Parameters["@post_no"].Value = post.PostNumber; InsertQuery.Parameters["@thread_no"].Value = post.ReplyPostNumber != 0 ? post.ReplyPostNumber : post.PostNumber; InsertQuery.Parameters["@is_op"].Value = post.ReplyPostNumber == 0 ? 1 : 0; InsertQuery.Parameters["@timestamp"].Value = post.UnixTimestamp; InsertQuery.Parameters["@timestamp_expired"].Value = 0; InsertQuery.Parameters["@preview_orig"].Value = post.TimestampedFilename.HasValue ? $"{post.TimestampedFilename}s.jpg" : null; InsertQuery.Parameters["@preview_w"].Value = post.ThumbnailWidth ?? 0; InsertQuery.Parameters["@preview_h"].Value = post.ThumbnailHeight ?? 0; InsertQuery.Parameters["@media_filename"].Value = post.OriginalFilenameFull; InsertQuery.Parameters["@media_w"].Value = post.ImageWidth ?? 0; InsertQuery.Parameters["@media_h"].Value = post.ImageHeight ?? 0; InsertQuery.Parameters["@media_size"].Value = post.FileSize ?? 0; InsertQuery.Parameters["@media_hash"].Value = post.FileMd5; InsertQuery.Parameters["@media_orig"].Value = post.TimestampedFilenameFull; InsertQuery.Parameters["@spoiler"].Value = post.SpoilerImage == true ? 1 : 0; InsertQuery.Parameters["@deleted"].Value = 0; InsertQuery.Parameters["@capcode"].Value = post.Capcode?.Substring(0, 1).ToUpperInvariant() ?? "N"; InsertQuery.Parameters["@email"].Value = null; // 4chan api doesn't supply this???? InsertQuery.Parameters["@name"].Value = HttpUtility.HtmlDecode(post.Name); InsertQuery.Parameters["@trip"].Value = post.Trip; InsertQuery.Parameters["@title"].Value = HttpUtility.HtmlDecode(post.Subject); InsertQuery.Parameters["@comment"].Value = post.Comment; InsertQuery.Parameters["@sticky"].Value = post.Sticky == true ? 1 : 0; InsertQuery.Parameters["@locked"].Value = post.Closed == true ? 1 : 0; InsertQuery.Parameters["@poster_hash"].Value = post.PosterID == "Developer" ? "Dev" : post.PosterID; InsertQuery.Parameters["@poster_country"].Value = post.CountryCode; await InsertQuery.ExecuteNonQueryAsync(); } }