Added an optional preview url to the xp shop items

This commit is contained in:
Kwoth
2022-08-01 10:53:59 +02:00
parent 4b3fc53cb6
commit cf3788c6ea
4 changed files with 14 additions and 5 deletions

View File

@@ -395,7 +395,9 @@ public partial class Xp : NadekoModule<XpService>
.WithTitle(item.Name) .WithTitle(item.Name)
.AddField(GetText(strs.price), Gambling.Gambling.N(item.Price, culture), true) .AddField(GetText(strs.price), Gambling.Gambling.N(item.Price, culture), true)
// .AddField(GetText(strs.buy), $"{prefix}xpbuy {key}", true) // .AddField(GetText(strs.buy), $"{prefix}xpbuy {key}", true)
.WithImageUrl(item.Url.ToString()); .WithImageUrl(string.IsNullOrWhiteSpace(item.Preview)
? item.Url
: item.Preview);
if (!string.IsNullOrWhiteSpace(item.Desc)) if (!string.IsNullOrWhiteSpace(item.Desc))
eb.WithDescription(item.Desc); eb.WithDescription(item.Desc);

View File

@@ -10,7 +10,7 @@ namespace NadekoBot.Modules.Xp;
public sealed partial class XpConfig : ICloneable<XpConfig> public sealed partial class XpConfig : ICloneable<XpConfig>
{ {
[Comment(@"DO NOT CHANGE")] [Comment(@"DO NOT CHANGE")]
public int Version { get; set; } = 3; public int Version { get; set; } = 4;
[Comment(@"How much XP will the users receive per message")] [Comment(@"How much XP will the users receive per message")]
public int XpPerMessage { get; set; } = 3; public int XpPerMessage { get; set; } = 3;
@@ -71,6 +71,9 @@ To remove an item from the shop, but keep previous purchases, set the price to -
[Comment(@"Direct url to the .png image which will be applied to the user's XP card")] [Comment(@"Direct url to the .png image which will be applied to the user's XP card")]
public string Url { get; set; } public string Url { get; set; }
[Comment(@"Optional preview url which will show instead of the real URL in the shop ")]
public string Preview { get; set; }
[Comment(@"Optional description of the item")] [Comment(@"Optional description of the item")]
public string Desc { get; set; } public string Desc { get; set; }
} }

View File

@@ -52,11 +52,11 @@ public sealed class XpConfigService : ConfigServiceBase<XpConfig>
}); });
} }
if (data.Version < 3) if (data.Version < 4)
{ {
ModifyConfig(c => ModifyConfig(c =>
{ {
c.Version = 3; c.Version = 4;
}); });
} }
} }

View File

@@ -1,5 +1,5 @@
# DO NOT CHANGE # DO NOT CHANGE
version: 3 version: 4
# How much XP will the users receive per message # How much XP will the users receive per message
xpPerMessage: 3 xpPerMessage: 3
# How often can the users receive XP in minutes # How often can the users receive XP in minutes
@@ -31,6 +31,8 @@ shop:
price: 0 price: 0
# Direct url to the .png image which will be applied to the user's XP card # 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:
# Optional description of the item # Optional description of the item
desc: desc:
# Backgrounds available for sale. Keys are unique IDs. # Backgrounds available for sale. Keys are unique IDs.
@@ -45,5 +47,7 @@ shop:
price: 0 price: 0
# Direct url to the .png image which will be applied to the user's XP card # 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:
# Optional description of the item # Optional description of the item
desc: desc: