General bits of cleanup

This commit is contained in:
Ske 2020-06-13 22:20:24 +02:00
parent 4b69ef806a
commit 2702c45b4f
5 changed files with 7 additions and 21 deletions

View File

@ -64,7 +64,8 @@ namespace PluralKit.Bot
{ {
PrivacyFilter.PrivateOnly => PrivacyLevel.Private, PrivacyFilter.PrivateOnly => PrivacyLevel.Private,
PrivacyFilter.PublicOnly => PrivacyLevel.Public, PrivacyFilter.PublicOnly => PrivacyLevel.Public,
PrivacyFilter.All => null PrivacyFilter.All => null,
_ => throw new ArgumentOutOfRangeException($"Unknown privacy filter {PrivacyFilter}")
}, Filter, SearchInDescription); }, Filter, SearchInDescription);
private IEnumerable<ListedMember> Sort(IEnumerable<ListedMember> input) private IEnumerable<ListedMember> Sort(IEnumerable<ListedMember> input)

View File

@ -9,10 +9,10 @@ namespace PluralKit.Bot
{ {
public class ProxyMatcher public class ProxyMatcher
{ {
public static readonly Duration LatchExpiryTime = Duration.FromHours(6); private static readonly Duration LatchExpiryTime = Duration.FromHours(6);
private IClock _clock; private readonly IClock _clock;
private ProxyTagParser _parser; private readonly ProxyTagParser _parser;
public ProxyMatcher(ProxyTagParser parser, IClock clock) public ProxyMatcher(ProxyTagParser parser, IClock clock)
{ {

View File

@ -18,7 +18,7 @@ namespace PluralKit.Bot
{ {
public class ProxyService public class ProxyService
{ {
public static readonly TimeSpan MessageDeletionDelay = TimeSpan.FromMilliseconds(1000); private static readonly TimeSpan MessageDeletionDelay = TimeSpan.FromMilliseconds(1000);
private readonly LogChannelService _logChannel; private readonly LogChannelService _logChannel;
private readonly IDatabase _db; private readonly IDatabase _db;

View File

@ -1,5 +1,4 @@
#nullable enable #nullable enable
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -49,20 +48,6 @@ namespace PluralKit.Bot
return false; return false;
} }
public bool TryMatchTags(string input, ProxyTag tag, out string inner)
{
// This just wraps TryMatchTagsInner w/ support for leading mentions
var leadingMention = ExtractLeadingMention(ref input);
inner = "";
if (!TryMatchTagsInner(input, tag, out var innerRaw)) return false;
// Add leading mentions back
inner = leadingMention == null ? innerRaw : $"{leadingMention} {innerRaw}";
return true;
}
private bool TryMatchTagsInner(string input, ProxyTag tag, out string inner) private bool TryMatchTagsInner(string input, ProxyTag tag, out string inner)
{ {
inner = ""; inner = "";

View File

@ -5,7 +5,7 @@ using System.Threading.Tasks;
using NodaTime; using NodaTime;
namespace PluralKit.Bot namespace PluralKit.Core
{ {
public class HandlerQueue<T> public class HandlerQueue<T>
{ {