diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f59f917f..bb940cce3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o +## [5.2.3] - 27.11.2024 + +## Fixed + +- `.iam` Fixed +- `.sclr` will now properly change color on many commands it didn't work previously + +### Changed + +- `.rps` now also has bet amount in the result, like other gambling commands + ## [5.2.2] - 27.11.2024 ### Changed diff --git a/src/NadekoBot/Modules/Administration/SelfAssignableRoles/SelfAssignedRolesCommands.cs b/src/NadekoBot/Modules/Administration/SelfAssignableRoles/SelfAssignedRolesCommands.cs index 06d4bff3b..11a3c94d9 100644 --- a/src/NadekoBot/Modules/Administration/SelfAssignableRoles/SelfAssignedRolesCommands.cs +++ b/src/NadekoBot/Modules/Administration/SelfAssignableRoles/SelfAssignedRolesCommands.cs @@ -21,7 +21,7 @@ public partial class Administration { var guildUser = (IGuildUser)ctx.User; - var group = await _service.GetRoleGroup(ctx.User.Id, role.Id); + var group = await _service.GetRoleGroup(ctx.Guild.Id, role.Id); IUserMessage msg = null; try @@ -90,7 +90,7 @@ public partial class Administration return; } - var group = await _service.GetRoleGroup(role.Guild.Id, role.Id); + var group = await _service.GetRoleGroup(ctx.Guild.Id, role.Id); if (group is null || group.Roles.All(x => x.RoleId != role.Id)) { diff --git a/src/NadekoBot/Modules/Gambling/Gambling.cs b/src/NadekoBot/Modules/Gambling/Gambling.cs index ffc44d67d..09cefdbcb 100644 --- a/src/NadekoBot/Modules/Gambling/Gambling.cs +++ b/src/NadekoBot/Modules/Gambling/Gambling.cs @@ -390,7 +390,7 @@ public partial class Gambling : GamblingModule [Priority(0)] public Task CurrencyTransactions([Leftover] IUser usr) => InternalCurrencyTransactions(usr.Id, 1); - + [Cmd] [OwnerOnly] [Priority(-1)] @@ -872,9 +872,6 @@ public partial class Gambling : GamblingModule } else if (result.Result == RpsResultType.Win) { - if ((long)result.Won > 0) - embed.AddField(GetText(strs.won), N((long)result.Won)); - msg = GetText(strs.rps_win(ctx.User.Mention, GetRpsPick(pick), GetRpsPick((InputRpsPick)result.ComputerPick))); @@ -890,6 +887,13 @@ public partial class Gambling : GamblingModule .WithOkColor() .WithDescription(msg); + if (amount > 0) + { + embed + .AddField(GetText(strs.bet), N(amount), true) + .AddField(GetText(strs.won), $"{N((long)result.Won)}", true); + } + await Response().Embed(embed).SendAsync(); } diff --git a/src/NadekoBot/Modules/Utility/Ai/UtilityCommands.cs b/src/NadekoBot/Modules/Utility/Ai/UtilityCommands.cs index 389abf946..6f5ee29bf 100644 --- a/src/NadekoBot/Modules/Utility/Ai/UtilityCommands.cs +++ b/src/NadekoBot/Modules/Utility/Ai/UtilityCommands.cs @@ -14,7 +14,7 @@ public partial class Utility } private string GetCommandString(NadekoCommandCallModel res) - => $"{_bcs.Data.Prefix}{res.Name} {res.Arguments.Select((x, i) => GetParamString(x, i + 1 == res.Arguments.Count)).Join(" ")}"; + => $"{prefix}{res.Name} {res.Arguments.Select((x, i) => GetParamString(x, i + 1 == res.Arguments.Count)).Join(" ")}"; private static string GetParamString(string val, bool isLast) => isLast ? val : "\"" + val + "\""; diff --git a/src/NadekoBot/NadekoBot.csproj b/src/NadekoBot/NadekoBot.csproj index 5dde47632..b161ce15d 100644 --- a/src/NadekoBot/NadekoBot.csproj +++ b/src/NadekoBot/NadekoBot.csproj @@ -4,7 +4,7 @@ enable true en - 5.2.2 + 5.2.3 $(MSBuildProjectDirectory) diff --git a/src/NadekoBot/_common/NadekoModule.cs b/src/NadekoBot/_common/NadekoModule.cs index 99e3a1acb..26f771a54 100644 --- a/src/NadekoBot/_common/NadekoModule.cs +++ b/src/NadekoBot/_common/NadekoModule.cs @@ -19,7 +19,6 @@ public abstract class NadekoModule : ModuleBase public INadekoInteractionService _inter { get; set; } public IReplacementService repSvc { get; set; } public IMessageSenderService _sender { get; set; } - public BotConfigService _bcs { get; set; } protected string prefix => _cmdHandler.GetPrefix(ctx.Guild); @@ -31,7 +30,7 @@ public abstract class NadekoModule : ModuleBase => _sender.CreateEmbed(ctx.Guild?.Id); public ResponseBuilder Response() - => new ResponseBuilder(Strings, _bcs, (DiscordSocketClient)ctx.Client) + => new ResponseBuilder(Strings, _sender, (DiscordSocketClient)ctx.Client) .Context(ctx); protected override void BeforeExecute(CommandInfo command) diff --git a/src/NadekoBot/_common/Sender/MessageSenderService.cs b/src/NadekoBot/_common/Sender/MessageSenderService.cs index 0827b6ac5..caaccbb3f 100644 --- a/src/NadekoBot/_common/Sender/MessageSenderService.cs +++ b/src/NadekoBot/_common/Sender/MessageSenderService.cs @@ -9,31 +9,31 @@ public sealed class MessageSenderService : IMessageSenderService, INService public MessageSenderService( IBotStrings bs, - BotConfigService bcs, DiscordSocketClient client, - IGuildColorsService gcs) + IGuildColorsService gcs, + BotConfigService bcs) { _bs = bs; - _bcs = bcs; _client = client; _gcs = gcs; + _bcs = bcs; } public ResponseBuilder Response(IMessageChannel channel) - => new ResponseBuilder(_bs, _bcs, _client) + => new ResponseBuilder(_bs, this, _client) .Channel(channel); public ResponseBuilder Response(ICommandContext ctx) - => new ResponseBuilder(_bs, _bcs, _client) + => new ResponseBuilder(_bs, this, _client) .Context(ctx); public ResponseBuilder Response(IUser user) - => new ResponseBuilder(_bs, _bcs, _client) + => new ResponseBuilder(_bs, this, _client) .User(user); public ResponseBuilder Response(SocketMessageComponent smc) - => new ResponseBuilder(_bs, _bcs, _client) + => new ResponseBuilder(_bs, this, _client) .Channel(smc.Channel); public NadekoEmbedBuilder CreateEmbed(ulong? guildId = null) diff --git a/src/NadekoBot/_common/Sender/ResponseBuilder.cs b/src/NadekoBot/_common/Sender/ResponseBuilder.cs index 7f74e4385..ff537b8de 100644 --- a/src/NadekoBot/_common/Sender/ResponseBuilder.cs +++ b/src/NadekoBot/_common/Sender/ResponseBuilder.cs @@ -6,16 +6,17 @@ public sealed partial class ResponseBuilder { private ICommandContext? ctx; private IMessageChannel? channel; + private IUser? user; + private IUserMessage? msg; + private string? plainText; private IReadOnlyCollection? embeds; - private IUserMessage? msg; - private IUser? user; private bool sanitizeMentions = true; private LocStr? locTxt; private object[] locParams = []; private bool shouldReply = true; private readonly IBotStrings _bs; - private readonly BotConfigService _bcs; + private readonly IMessageSenderService _sender; private EmbedBuilder? embedBuilder; private NadekoInteractionBase? inter; private Stream? fileStream; @@ -25,10 +26,10 @@ public sealed partial class ResponseBuilder public DiscordSocketClient Client { get; set; } - public ResponseBuilder(IBotStrings bs, BotConfigService bcs, DiscordSocketClient client) + public ResponseBuilder(IBotStrings bs, IMessageSenderService sender, DiscordSocketClient client) { _bs = bs; - _bcs = bcs; + _sender = sender; Client = client; } @@ -197,7 +198,7 @@ public sealed partial class ResponseBuilder string? url = null, string? footer = null) { - var eb = new NadekoEmbedBuilder(_bcs) + var eb = _sender.CreateEmbed(ctx?.Guild?.Id ?? (channel as ITextChannel)?.GuildId ?? (user as IGuildUser)?.GuildId) .WithDescription(text); if (!string.IsNullOrWhiteSpace(title)) diff --git a/src/NadekoBot/_common/_Extensions/SocketMessageComponentExtensions.cs b/src/NadekoBot/_common/_Extensions/SocketMessageComponentExtensions.cs index da53513a7..215374ac7 100644 --- a/src/NadekoBot/_common/_Extensions/SocketMessageComponentExtensions.cs +++ b/src/NadekoBot/_common/_Extensions/SocketMessageComponentExtensions.cs @@ -9,7 +9,7 @@ public static class SocketMessageComponentExtensions MsgType type, bool ephemeral = false) { - var embed = sender.CreateEmbed().WithDescription(text); + var embed = sender.CreateEmbed(ch.GuildId).WithDescription(text); embed = (type switch {