Fixed a patron bug which didn't let patrons execute patron commands in non-patron servers

This commit is contained in:
Kwoth
2022-06-18 10:29:33 +02:00
parent 3343fd2f6e
commit 9f445c0866

View File

@@ -3,6 +3,7 @@ using LinqToDB.EntityFrameworkCore;
using NadekoBot.Common.ModuleBehaviors; using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Db.Models; using NadekoBot.Db.Models;
using OneOf; using OneOf;
using OneOf.Types;
using StackExchange.Redis; using StackExchange.Redis;
using CommandInfo = Discord.Commands.CommandInfo; using CommandInfo = Discord.Commands.CommandInfo;
@@ -500,8 +501,8 @@ public sealed class PatronageService
if (!confData.IsEnabled) if (!confData.IsEnabled)
return default; return default;
if (_creds.IsOwner(userId)) // if (_creds.IsOwner(userId))
return default; // return default;
// get user tier // get user tier
var patron = await GetPatronAsync(userId); var patron = await GetPatronAsync(userId);
@@ -558,7 +559,9 @@ public sealed class PatronageService
data.TryGetValue(QuotaPer.PerMonth, out var monthly) ? monthly : null data.TryGetValue(QuotaPer.PerMonth, out var monthly) ? monthly : null
); );
return quotaCheckResult.Match(_ => default, x => x); return quotaCheckResult.Match<OneOf<Success, InsufficientTier, QuotaLimit>>(
_ => new Success(),
x => x);
} }
private bool TryGetTierDataOrLower<T>( private bool TryGetTierDataOrLower<T>(