Compare commits

..

4 Commits
4.2.5 ... 4.2.6

7 changed files with 31 additions and 7 deletions

View File

@@ -113,6 +113,7 @@ docker-build:
# Use the official docker image.
image: docker:latest
stage: build
allow_failure: true
services:
- docker:dind
before_script:

View File

@@ -3,6 +3,12 @@
Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
## [4.2.6] - 22.06.2022
### Fixed
- Patron system should now properly by disabled on selfhosts by default.
## [4.2.5] - 18.06.2022
### Fixed

View File

@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Utility.Patronage;
public partial class PatronConfigData : ICloneable<PatronConfigData>
{
[Comment("DO NOT CHANGE")]
public int Version { get; set; } = 1;
public int Version { get; set; } = 2;
[Comment("Whether the patronage feature is enabled")]
public bool IsEnabled { get; set; }

View File

@@ -18,5 +18,19 @@ public class PatronageConfig : ConfigServiceBase<PatronConfigData>
x => x.IsEnabled,
bool.TryParse,
ConfigPrinters.ToString);
Migrate();
}
private void Migrate()
{
ModifyConfig(c =>
{
if (c.Version == 1)
{
c.Version = 2;
c.IsEnabled = false;
}
});
}
}

View File

@@ -3,6 +3,7 @@ using LinqToDB.EntityFrameworkCore;
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Db.Models;
using OneOf;
using OneOf.Types;
using StackExchange.Redis;
using CommandInfo = Discord.Commands.CommandInfo;
@@ -500,8 +501,8 @@ public sealed class PatronageService
if (!confData.IsEnabled)
return default;
if (_creds.IsOwner(userId))
return default;
// if (_creds.IsOwner(userId))
// return default;
// get user tier
var patron = await GetPatronAsync(userId);
@@ -558,7 +559,9 @@ public sealed class PatronageService
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>(

View File

@@ -7,7 +7,7 @@ namespace NadekoBot.Services;
public sealed class StatsService : IStatsService, IReadyExecutor, INService
{
public const string BOT_VERSION = "4.2.5";
public const string BOT_VERSION = "4.2.6";
public string Author
=> "Kwoth#2452";

View File

@@ -1,7 +1,7 @@
# DO NOT CHANGE
version: 1
version: 2
# Whether the patronage feature is enabled
isEnabled: true
isEnabled: false
# List of patron only features and relevant quota data
quotas:
# Dictionary of feature names with their respective limits. Set to null for unlimited