Compare commits

..

10 Commits
4.2.3 ... 4.2.6

8 changed files with 42 additions and 30 deletions

View File

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

View File

@@ -3,6 +3,18 @@
Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o 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
- Fixed `.crypto`, you will still need coinmarketcapApiKey in `creds.yml` in order to make it run consistently as the key is shared
## [4.2.3] - 17.06.2022 ## [4.2.3] - 17.06.2022
### Fixed ### Fixed

View File

@@ -16,11 +16,11 @@ public class CmcQuote
[JsonPropertyName("volume_24h")] [JsonPropertyName("volume_24h")]
public double Volume24h { get; set; } public double Volume24h { get; set; }
[JsonPropertyName("volume_change_24h")] // [JsonPropertyName("volume_change_24h")]
public double VolumeChange24h { get; set; } // public double VolumeChange24h { get; set; }
//
[JsonPropertyName("percent_change_1h")] // [JsonPropertyName("percent_change_1h")]
public double PercentChange1h { get; set; } // public double PercentChange1h { get; set; }
[JsonPropertyName("percent_change_24h")] [JsonPropertyName("percent_change_24h")]
public double PercentChange24h { get; set; } public double PercentChange24h { get; set; }
@@ -33,12 +33,6 @@ public class CmcQuote
[JsonPropertyName("market_cap_dominance")] [JsonPropertyName("market_cap_dominance")]
public double MarketCapDominance { get; set; } public double MarketCapDominance { get; set; }
[JsonPropertyName("fully_diluted_market_cap")]
public double FullyDilutedMarketCap { get; set; }
[JsonPropertyName("last_updated")]
public DateTime LastUpdated { get; set; }
} }
public class CmcResponseData public class CmcResponseData
@@ -58,9 +52,6 @@ public class CmcResponseData
[JsonPropertyName("cmc_rank")] [JsonPropertyName("cmc_rank")]
public int CmcRank { get; set; } public int CmcRank { get; set; }
[JsonPropertyName("num_market_pairs")]
public int NumMarketPairs { get; set; }
[JsonPropertyName("circulating_supply")] [JsonPropertyName("circulating_supply")]
public double? CirculatingSupply { get; set; } public double? CirculatingSupply { get; set; }
@@ -70,15 +61,6 @@ public class CmcResponseData
[JsonPropertyName("max_supply")] [JsonPropertyName("max_supply")]
public double? MaxSupply { get; set; } public double? MaxSupply { get; set; }
[JsonPropertyName("last_updated")]
public DateTime LastUpdated { get; set; }
[JsonPropertyName("date_added")]
public DateTime DateAdded { get; set; }
[JsonPropertyName("tags")]
public List<string> Tags { get; set; }
[JsonPropertyName("quote")] [JsonPropertyName("quote")]
public Dictionary<string, CmcQuote> Quote { get; set; } public Dictionary<string, CmcQuote> Quote { get; set; }
} }

View File

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

View File

@@ -18,5 +18,19 @@ public class PatronageConfig : ConfigServiceBase<PatronConfigData>
x => x.IsEnabled, x => x.IsEnabled,
bool.TryParse, bool.TryParse,
ConfigPrinters.ToString); 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.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>(

View File

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

View File

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