diff --git a/src/NadekoBot/Common/Interaction/SimpleInteraction.cs b/src/NadekoBot/Common/Interaction/SimpleInteraction.cs new file mode 100644 index 000000000..4a54d1232 --- /dev/null +++ b/src/NadekoBot/Common/Interaction/SimpleInteraction.cs @@ -0,0 +1,20 @@ +namespace NadekoBot; + +public class SimpleInteraction +{ + public ButtonBuilder Button { get; } + private readonly Func _onClick; + private readonly T? _state; + + public SimpleInteraction(ButtonBuilder button, Func onClick, T? state = default) + { + Button = button; + _onClick = onClick; + _state = state; + } + + public async Task TriggerAsync(SocketMessageComponent smc) + { + await _onClick(smc, _state!); + } +} \ No newline at end of file diff --git a/src/NadekoBot/Modules/Xp/Xp.cs b/src/NadekoBot/Modules/Xp/Xp.cs index bd415a64c..accde7f27 100644 --- a/src/NadekoBot/Modules/Xp/Xp.cs +++ b/src/NadekoBot/Modules/Xp/Xp.cs @@ -472,23 +472,4 @@ public partial class Xp : NadekoModule return GetText(strs.xpn_notif_disabled); } -} - -public class SimpleInteraction -{ - public ButtonBuilder Button { get; } - private readonly Func _onClick; - private readonly T? _state; - - public SimpleInteraction(ButtonBuilder button, Func onClick, T state = default) - { - Button = button; - _onClick = onClick; - _state = state; - } - - public async Task TriggerAsync(SocketMessageComponent smc) - { - await _onClick(smc, _state); - } } \ No newline at end of file diff --git a/src/NadekoBot/Modules/Xp/XpService.cs b/src/NadekoBot/Modules/Xp/XpService.cs index af5033d38..ab0dc7649 100644 --- a/src/NadekoBot/Modules/Xp/XpService.cs +++ b/src/NadekoBot/Modules/Xp/XpService.cs @@ -1337,7 +1337,7 @@ public class XpService : INService, IReadyExecutor, IExecNoCommand // await using var tran = await ctx.Database.BeginTransactionAsync(); try { - if (await ctx.GetTable().AnyAsyncLinqToDB(x => x.ItemKey == key && x.ItemType == type)) + if (await ctx.GetTable().AnyAsyncLinqToDB(x => x.UserId == userId && x.ItemKey == key && x.ItemType == type)) return BuyResult.AlreadyOwned; var item = GetShopItem(type, key); diff --git a/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs b/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs index a80fd86c5..ccb497b94 100644 --- a/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs +++ b/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs @@ -314,7 +314,7 @@ public static class MessageChannelExtensions } } - if (lastPage == 0) + if (lastPage == 0 && interFactory is null) return; var client = (DiscordSocketClient)ctx.Client;