diff --git a/Program.cs b/Program.cs index 04f11bf..920133c 100644 --- a/Program.cs +++ b/Program.cs @@ -37,11 +37,6 @@ static async Task Main(string[] args) if (string.IsNullOrEmpty(token) || string.IsNullOrEmpty(channelIdStr) || string.IsNullOrEmpty(_fileId) || string.IsNullOrEmpty(_credentialsPath) || string.IsNullOrEmpty(postTimeStr)) { Console.WriteLine("Environment variables are not set correctly."); - Console.WriteLine($"DISCORD_BOT_TOKEN: {(string.IsNullOrEmpty(token) ? "Not set" : "Set")}"); - Console.WriteLine($"DISCORD_CHANNEL_ID: {(string.IsNullOrEmpty(channelIdStr) ? "Not set" : "Set")}"); - Console.WriteLine($"GOOGLE_DRIVE_FILE_ID: {(string.IsNullOrEmpty(_fileId) ? "Not set" : "Set")}"); - Console.WriteLine($"GOOGLE_CREDENTIALS_PATH: {(string.IsNullOrEmpty(_credentialsPath) ? "Not set" : "Set")}"); - Console.WriteLine($"POST_TIME: {(string.IsNullOrEmpty(postTimeStr) ? "Not set" : "Set")}"); return; } @@ -92,15 +87,17 @@ private static async Task OnReady() { var records = csv.GetRecords().ToList(); - // Filter records with at least 8 reactions, including those without images - _messages = records.Where(record => record.total_reactions >= 8).Select(record => - { - if (!string.IsNullOrWhiteSpace(record.image_url)) - { - return $"{record.message}\n{record.image_url.Trim()}"; - } - return record.message; - }).ToList(); + // Filter records with at least 8 reactions + _messages = records.Where(record => record.total_reactions >= 8) + .Select(record => + { + string result = $"{record.name}: {record.message}\n{record.message_link.Trim()}"; + if (!string.IsNullOrWhiteSpace(record.image_url)) + { + result += $"\n{record.image_url.Trim()}"; + } + return result; + }).ToList(); } Console.WriteLine("Filtered messages read from CSV:"); @@ -211,8 +208,10 @@ private static async Task PostRandomMessage() // Define a class that matches the CSV structure public class YourRecordClass { + public string name { get; set; } public string message { get; set; } public string image_url { get; set; } + public string message_link { get; set; } public string has_spoilers { get; set; } public int total_reactions { get; set; } }