Skip to content

Commit

Permalink
Don't send empty message
Browse files Browse the repository at this point in the history
  • Loading branch information
oldnapalm committed Jan 8, 2021
1 parent c5dd3af commit 69e4ff2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions DiscordBot/DiscordBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public async Task MainAsync()
_client.Log += LogAsync;
_client.Ready += ReadyAsync;
_client.MessageReceived += MessageReceivedAsync;
_client.UserJoined += WelcomeJoinedUser;
if (_settings.WelcomeMessage.Length > 0)
_client.UserJoined += WelcomeJoinedUser;
await _client.LoginAsync(TokenType.Bot, _settings.Token);
await _client.StartAsync();
}
Expand All @@ -127,7 +128,7 @@ private async Task MessageReceivedAsync(SocketMessage message)
return;
if (message.Content == "!ping")
await message.Channel.SendMessageAsync("pong");
else if (message.Content == "!help")
else if (message.Content == "!help" && _settings.HelpMessage.Length > 0)
await message.Channel.SendMessageAsync(_settings.HelpMessage);
else if (message.Channel == _channel && !message.Author.IsBot && message.Content.Length > 0)
_server.SendChatMessageToAll(message.Author.Username + " [Discord]: " + message.Content);
Expand Down

0 comments on commit 69e4ff2

Please sign in to comment.