Skip to content

Commit

Permalink
Remove bot protection
Browse files Browse the repository at this point in the history
  • Loading branch information
outerwinnie committed Sep 4, 2024
1 parent d23d65e commit 60ef1a9
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ 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");

// 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;
Expand All @@ -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))
{
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 60ef1a9

Please sign in to comment.