From ef03c6c3fefd5d843652f022063aa1c808f628d8 Mon Sep 17 00:00:00 2001 From: Toastie Date: Thu, 28 Nov 2024 20:05:33 +1300 Subject: [PATCH] MessageXpCooldown is not in seconds --- src/EllieBot/Modules/Xp/XpConfig.cs | 6 +++--- src/EllieBot/Modules/Xp/XpConfigService.cs | 5 +++-- src/EllieBot/Modules/Xp/XpService.cs | 2 +- src/EllieBot/data/xp.yml | 18 +++++++++--------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/EllieBot/Modules/Xp/XpConfig.cs b/src/EllieBot/Modules/Xp/XpConfig.cs index 665df23..efa89e8 100644 --- a/src/EllieBot/Modules/Xp/XpConfig.cs +++ b/src/EllieBot/Modules/Xp/XpConfig.cs @@ -10,13 +10,13 @@ namespace EllieBot.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/EllieBot/Modules/Xp/XpConfigService.cs b/src/EllieBot/Modules/Xp/XpConfigService.cs index b269379..5b8ed99 100644 --- a/src/EllieBot/Modules/Xp/XpConfigService.cs +++ b/src/EllieBot/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/EllieBot/Modules/Xp/XpService.cs b/src/EllieBot/Modules/Xp/XpService.cs index 808b79a..e0af343 100644 --- a/src/EllieBot/Modules/Xp/XpService.cs +++ b/src/EllieBot/Modules/Xp/XpService.cs @@ -933,7 +933,7 @@ public class XpService : IEService, 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/EllieBot/data/xp.yml b/src/EllieBot/data/xp.yml index c680e0b..e32fe62 100644 --- a/src/EllieBot/data/xp.yml +++ b/src/EllieBot/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 @@ -35,11 +35,11 @@ shop: # 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 # Direct url to the .png image which will be applied to the user's XP card - url: "" + url: '' # Optional preview url which will show instead of the real URL in the shop - preview: + preview: # Optional description of the item - desc: + desc: # Backgrounds available for sale. Keys are unique IDs. # Do not change keys as they are not publicly visible. Only change properties (name, price, id) # Removing a key which previously existed means that all previous purchases will also be unusable. @@ -51,8 +51,8 @@ shop: # 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 # Direct url to the .png image which will be applied to the user's XP card - url: "" + url: '' # Optional preview url which will show instead of the real URL in the shop - preview: + preview: # Optional description of the item - desc: + desc: