Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

Commit

Permalink
Prevent Whitespace Messages From Being Sent
Browse files Browse the repository at this point in the history
When the hastebin upload happened, it'd remove that content from the
original message, and if that was the only thing containing in that
message then blank messages would be sent to irc.
  • Loading branch information
Headline committed Aug 18, 2017
1 parent 7a07cae commit 7890e03
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions IRC-Relay/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,14 @@ public async Task OnDiscordMessage(SocketMessage messageParam)
return;
}

Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("Discord -> IRC <" + messageParam.Author.Username + ">: " + formatted);
if (formatted.Replace(" ", "").Replace("\n", "").Length != 0) // if the string is empty or just spaces
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("Discord -> IRC <" + messageParam.Author.Username + ">: " + formatted);

Program.IRC.SendMessage(SendType.Message, Config.Config.Instance.IRCChannel, "<" + messageParam.Author.Username + "> " + formatted);
}

Program.IRC.SendMessage(SendType.Message, Config.Config.Instance.IRCChannel, "<" + messageParam.Author.Username + "> " + formatted);
if (!url.Equals(""))
{
Console.ForegroundColor = ConsoleColor.Cyan;
Expand Down

0 comments on commit 7890e03

Please sign in to comment.