From 99827b0fa1400c16b8b93d2ec5d4c0d2636b8d51 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Tue, 26 Nov 2024 19:58:20 +0000 Subject: [PATCH] change: MessageXpCooldown is not in seconds --- src/NadekoBot/Modules/Xp/XpConfig.cs | 6 +++--- src/NadekoBot/Modules/Xp/XpConfigService.cs | 5 +++-- src/NadekoBot/Modules/Xp/XpService.cs | 2 +- src/NadekoBot/data/xp.yml | 16 ++++++++-------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/NadekoBot/Modules/Xp/XpConfig.cs b/src/NadekoBot/Modules/Xp/XpConfig.cs index d6e4e9d6d..aa04b8472 100644 --- a/src/NadekoBot/Modules/Xp/XpConfig.cs +++ b/src/NadekoBot/Modules/Xp/XpConfig.cs @@ -10,13 +10,13 @@ namespace NadekoBot.Modules.Xp; public sealed partial class XpConfig : ICloneable { [Comment("""DO NOT CHANGE""")] - public int Version { get; set; } = 5; + public int Version { get; set; } = 7; [Comment("""How much XP will the users receive per message""")] public int XpPerMessage { get; set; } = 3; - [Comment("""How often can the users receive XP in minutes""")] - public int MessageXpCooldown { get; set; } = 5; + [Comment("""How often can the users receive XP, in seconds""")] + public int MessageXpCooldown { get; set; } = 300; [Comment("""Amount of xp users gain from posting an image""")] public int XpFromImage { get; set; } = 0; diff --git a/src/NadekoBot/Modules/Xp/XpConfigService.cs b/src/NadekoBot/Modules/Xp/XpConfigService.cs index c78fc72ee..80a312c88 100644 --- a/src/NadekoBot/Modules/Xp/XpConfigService.cs +++ b/src/NadekoBot/Modules/Xp/XpConfigService.cs @@ -52,11 +52,12 @@ public sealed class XpConfigService : ConfigServiceBase }); } - if (data.Version < 6) + if (data.Version < 7) { ModifyConfig(c => { - c.Version = 6; + c.Version = 7; + c.MessageXpCooldown *= 60; }); } } diff --git a/src/NadekoBot/Modules/Xp/XpService.cs b/src/NadekoBot/Modules/Xp/XpService.cs index 98f9345a4..7f5683420 100644 --- a/src/NadekoBot/Modules/Xp/XpService.cs +++ b/src/NadekoBot/Modules/Xp/XpService.cs @@ -933,7 +933,7 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand private async Task SetUserRewardedAsync(ulong userId) => await _c.AddAsync(GetUserRewKey(userId), true, - expiry: TimeSpan.FromMinutes(_xpConfig.Data.MessageXpCooldown), + expiry: TimeSpan.FromSeconds(_xpConfig.Data.MessageXpCooldown), overwrite: false); public async Task GetUserStatsAsync(IGuildUser user) diff --git a/src/NadekoBot/data/xp.yml b/src/NadekoBot/data/xp.yml index 5c9537756..710f660d6 100644 --- a/src/NadekoBot/data/xp.yml +++ b/src/NadekoBot/data/xp.yml @@ -1,9 +1,9 @@ # DO NOT CHANGE -version: 6 +version: 7 # How much XP will the users receive per message xpPerMessage: 3 -# How often can the users receive XP in minutes -messageXpCooldown: 5 +# How often can the users receive XP in seconds +messageXpCooldown: 300 # Amount of xp users gain from posting an image xpFromImage: 0 # Average amount of xp earned per minute in VC @@ -14,9 +14,9 @@ voiceMaxMinutes: 720 currencyPerXp: 0 # Xp Shop config shop: -# Whether the xp shop is enabled -# True -> Users can access the xp shop using .xpshop command -# False -> Users can't access the xp shop + # Whether the xp shop is enabled + # True -> Users can access the xp shop using .xpshop command + # False -> Users can't access the xp shop isEnabled: false # Which patron tier do users need in order to use the .xpshop bgs command # Leave at 'None' if patron system is disabled or you don't want any restrictions @@ -30,7 +30,7 @@ shop: # To remove an item from the shop, but keep previous purchases, set the price to -1 frames: default: - # Visible name of the item + # Visible name of the item name: No frame # Price of the item. Set to -1 if you no longer want to sell the item but want the users to be able to keep their old purchase price: 0 @@ -46,7 +46,7 @@ shop: # To remove an item from the shop, but keep previous purchases, set the price to -1 bgs: default: - # Visible name of the item + # Visible name of the item name: Default Background # Price of the item. Set to -1 if you no longer want to sell the item but want the users to be able to keep their old purchase price: 0