static async Task CompareHashCommand(SecretOption opts) { if (opts.compare) { if (opts.marathon) { await CompareHash.Marathon().ConfigureAwait(false); } else { await CompareHash.Proceed().ConfigureAwait(false); } } else if (opts.nothai) { var DeleteUserBlock = new ActionBlock <long>(async(user_id) => await DB.DeleteUser(user_id).ConfigureAwait(false)); Counter.AutoRefresh(); await DB.ThaiAccounts((user_id) => DeleteUserBlock.Post(user_id)).ConfigureAwait(false); DeleteUserBlock.Complete(); await DeleteUserBlock.Completion.ConfigureAwait(false); Counter.PrintReset(); Console.WriteLine("\(^o^)/"); } else if (opts.deleteblurhash) { await new DBHandler().DeleteAllBlurHash().ConfigureAwait(false); Console.WriteLine("\(^o^)/"); } else { Console.WriteLine("Option required."); } }
static async Task CleanupCommand(CleanupOption opts) { if (DateTimeOffset.TryParseExact(opts.begin, "yyyyMMdd", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal, out var begin) && DateTimeOffset.TryParseExact(opts.exclude, "yyyyMMdd", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal, out var exclude)) { Console.WriteLine("Cleanup removed tweets..."); await new RemovedMedia().DeleteRemovedTweet(begin, exclude).ConfigureAwait(false); Counter.PrintReset(); Console.WriteLine("\(^o^)/"); } else { Console.WriteLine("Invalid argument. See --help"); } }
static async Task DeleteTweetsCommand(DeleteOption opts) { long user_id; if (opts.user_id.HasValue) { user_id = opts.user_id.Value; } else { var id = await LookupUserId(opts.screen_name).ConfigureAwait(false); if (id.HasValue) { user_id = id.Value; } else { Console.WriteLine("Account not found."); return; } } await LookupCommand(new LookupOption() { user_id = user_id }).ConfigureAwait(false); if (!opts.yes) { Console.Write("Delete this account? [type \"y\" to delete]: "); string yn = Console.ReadLine(); if (yn.Trim() != "y") { Console.WriteLine("Canceled."); return; } Console.WriteLine("OK. Deleting..."); } Counter.AutoRefresh(); await DB.DeleteUser(user_id).ConfigureAwait(false); Counter.PrintReset(); Console.WriteLine("\(^o^)/"); }