fix: Fixed many issues with 5.2.0

This commit is contained in:
Kwoth
2024-11-27 01:23:03 +00:00
parent 22eea3fa7b
commit 2bed4e7eac
6 changed files with 49 additions and 15 deletions

View File

@@ -283,7 +283,13 @@ public partial class Administration
{
var res = await _service.SetExclusiveButtonRoles(ctx.Guild.Id, messageId, exclusive.Value);
if (res)
if (!res)
{
await Response().Error(strs.btnrole_not_found).SendAsync();
return;
}
if (exclusive.Value)
{
await Response().Confirm(strs.btnrole_exclusive).SendAsync();
}

View File

@@ -126,7 +126,11 @@ public sealed class ButtonRolesService : INService, IReadyExecutor
Emote = emoteStr,
Label = string.Empty,
ButtonId = $"{BTN_PREFIX}:{guildId}:{guid}",
Exclusive = (uow.GetTable<ButtonRole>().Where(x => x.GuildId == guildId && x.MessageId == messageId).All(x => x.Exclusive))
Exclusive = uow.GetTable<ButtonRole>()
.Any(x => x.GuildId == guildId && x.MessageId == messageId)
&& uow.GetTable<ButtonRole>()
.Where(x => x.GuildId == guildId && x.MessageId == messageId)
.All(x => x.Exclusive)
},
_ => new()
{
@@ -178,7 +182,6 @@ public sealed class ButtonRolesService : INService, IReadyExecutor
.UpdateAsync((_) => new()
{
Exclusive = exclusive
})
> 0;
}) > 0;
}
}