diff --git a/Program.cs b/Program.cs index 57335a7..b2868f9 100644 --- a/Program.cs +++ b/Program.cs @@ -34,7 +34,6 @@ static async Task Main(string[] args) var token = Environment.GetEnvironmentVariable("DISCORD_BOT_TOKEN"); var channelIdStr = Environment.GetEnvironmentVariable("DISCORD_CHANNEL_ID"); var specificUserIdStr = Environment.GetEnvironmentVariable("SPECIFIC_USER_ID"); - var specificChannelIdStr = Environment.GetEnvironmentVariable("SPECIFIC_CHANNEL_ID"); _fileId = Environment.GetEnvironmentVariable("GOOGLE_DRIVE_FILE_ID"); _credentialsPath = Environment.GetEnvironmentVariable("GOOGLE_CREDENTIALS_PATH"); var postTimeStr = Environment.GetEnvironmentVariable("POST_TIME"); @@ -42,7 +41,7 @@ static async Task Main(string[] args) // Check if token, channelId, fileId, credentialsPath, or postTime is null or empty if (string.IsNullOrEmpty(token) || string.IsNullOrEmpty(channelIdStr) || string.IsNullOrEmpty(_fileId) || string.IsNullOrEmpty(_credentialsPath) || string.IsNullOrEmpty(postTimeStr) || - string.IsNullOrEmpty(specificUserIdStr) || string.IsNullOrEmpty(specificChannelIdStr)) + string.IsNullOrEmpty(specificUserIdStr)) { Console.WriteLine("Environment variables are not set correctly."); return; @@ -61,12 +60,6 @@ static async Task Main(string[] args) return; } - if (!ulong.TryParse(specificChannelIdStr, out _specificChannelId)) - { - Console.WriteLine("Invalid SPECIFIC_CHANNEL_ID format."); - return; - } - // Parse post time if (!TimeSpan.TryParse(postTimeStr, out _postTimeSpain)) { @@ -166,14 +159,14 @@ private static async Task HandleInteractionAsync(SocketInteraction interaction) private static async Task HandleMessageReceivedAsync(SocketMessage message) { // Ensure the message is from a user and not a bot - if (message.Author.IsBot) - return; + //if (message.Author.IsBot) + //return; // Check if the message is from the specific user in the specific channel if (message.Author.Id == _specificUserId && message.Channel.Id == _specificChannelId) { - // Check if the message content matches the trigger (e.g., "/send" command) - if (message.Content.Equals("/send", StringComparison.OrdinalIgnoreCase)) + // Check if the message content matches the trigger (e.g., "send" command) + if (message.Content.Equals("send", StringComparison.OrdinalIgnoreCase)) { await HandleSendCommandAsync(message.Channel); }