diff --git a/CompatBot/Commands/Invites.cs b/CompatBot/Commands/Invites.cs index ca4ff98a..9f90fdd4 100644 --- a/CompatBot/Commands/Invites.cs +++ b/CompatBot/Commands/Invites.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -32,7 +31,7 @@ namespace CompatBot.Commands if (ctx.Channel.IsPrivate) header += $" | {"Invite link".PadRight(linkLength)}"; header += " | Server Name"; - var result = new StringBuilder("```") + var result = new StringBuilder("Whitelisted discord servers:\n```") .AppendLine(header) .AppendLine("".PadRight(header.Length + 10, '-')); var whitelistedInvites = await db.WhitelistedInvites.ToListAsync().ConfigureAwait(false); diff --git a/CompatBot/EventHandlers/DiscordInviteFilter.cs b/CompatBot/EventHandlers/DiscordInviteFilter.cs index adeec295..7bc87a42 100644 --- a/CompatBot/EventHandlers/DiscordInviteFilter.cs +++ b/CompatBot/EventHandlers/DiscordInviteFilter.cs @@ -18,9 +18,9 @@ namespace CompatBot.EventHandlers internal static class DiscordInviteFilter { private const RegexOptions DefaultOptions = RegexOptions.Compiled | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase | RegexOptions.Multiline; - private static readonly Regex InviteLink = new Regex(@"https?://discord(((app\.com/invite|\.gg)/(?.*?))|(\.me/(?.*?)))(\s|\W|$)", DefaultOptions); - private static readonly Regex DiscordInviteLink = new Regex(@"https?://discord(app\.com/invite|\.gg)/(?.*?)(\s|\W|$)", DefaultOptions); - private static readonly Regex DiscordMeLink = new Regex(@"https?://discord\.me/(?.*?)(\s|$)", DefaultOptions); + private static readonly Regex InviteLink = new Regex(@"(https?://)?discord(((app\.com/invite|\.gg)/(?.*?))|(\.me/(?.*?)))(\s|\W|$)", DefaultOptions); + private static readonly Regex DiscordInviteLink = new Regex(@"(https?://)?discord(app\.com/invite|\.gg)/(?.*?)(\s|\W|$)", DefaultOptions); + private static readonly Regex DiscordMeLink = new Regex(@"(https?://)?discord\.me/(?.*?)(\s|$)", DefaultOptions); private static readonly HttpClient HttpClient = HttpClientFactory.Create(new CompressionMessageHandler()); public static Task OnMessageCreated(MessageCreateEventArgs args) => CheckMessageForInvitesAsync(args.Client, args.Message);