mirror of
https://github.com/RPCS3/discord-bot.git
synced 2024-12-13 05:35:58 +00:00
allow invite links without the protocol
This commit is contained in:
parent
5e62feed7f
commit
8644811efe
@ -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);
|
||||
|
@ -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)/(?<invite_id>.*?))|(\.me/(?<me_id>.*?)))(\s|\W|$)", DefaultOptions);
|
||||
private static readonly Regex DiscordInviteLink = new Regex(@"https?://discord(app\.com/invite|\.gg)/(?<invite_id>.*?)(\s|\W|$)", DefaultOptions);
|
||||
private static readonly Regex DiscordMeLink = new Regex(@"https?://discord\.me/(?<me_id>.*?)(\s|$)", DefaultOptions);
|
||||
private static readonly Regex InviteLink = new Regex(@"(https?://)?discord(((app\.com/invite|\.gg)/(?<invite_id>.*?))|(\.me/(?<me_id>.*?)))(\s|\W|$)", DefaultOptions);
|
||||
private static readonly Regex DiscordInviteLink = new Regex(@"(https?://)?discord(app\.com/invite|\.gg)/(?<invite_id>.*?)(\s|\W|$)", DefaultOptions);
|
||||
private static readonly Regex DiscordMeLink = new Regex(@"(https?://)?discord\.me/(?<me_id>.*?)(\s|$)", DefaultOptions);
|
||||
private static readonly HttpClient HttpClient = HttpClientFactory.Create(new CompressionMessageHandler());
|
||||
|
||||
public static Task OnMessageCreated(MessageCreateEventArgs args) => CheckMessageForInvitesAsync(args.Client, args.Message);
|
||||
|
Loading…
Reference in New Issue
Block a user