Skip to content

Commit

Permalink
Merge branch 'release/5.8.1' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Oct 3, 2023
2 parents b9b4ea9 + 6f2bbca commit a032e63
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.8.1] - 2023-10-03

### Added
- Display the number of infractions on alt accounts in /userinfo.

### Changed
- If a user has 5 or fewer alt accounts, the users are mentioned in /userinfo directly.

## [5.8.0] - 2023-09-30

### Added
Expand Down Expand Up @@ -443,6 +451,7 @@ No substantial changes. Commit 3b8259a6cfb82ec0f5f51804c1ac7f1f5880d014 fixed an

- Hammer is released.

[5.8.1]: https://github.com/BrackeysBot/Hammer/releases/tag/v5.8.1
[5.8.0]: https://github.com/BrackeysBot/Hammer/releases/tag/v5.8.0
[5.7.0]: https://github.com/BrackeysBot/Hammer/releases/tag/v5.7.0
[5.6.1]: https://github.com/BrackeysBot/Hammer/releases/tag/v5.6.1
Expand Down
18 changes: 14 additions & 4 deletions Hammer/Commands/UserInfoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
using DSharpPlus.SlashCommands;
using DSharpPlus.SlashCommands.Attributes;
using Hammer.Configuration;
using Hammer.Data;
using Hammer.Extensions;
using Hammer.Services;
using Humanizer;
using X10D.DSharpPlus;

namespace Hammer.Commands;
Expand Down Expand Up @@ -99,11 +101,19 @@ private DiscordEmbed CreateUserInfoEmbed(DiscordUser user, DiscordMember? member

if (staffRequested)
{
int infractionCount = _infractionService.GetInfractionCount(user, guild);
int altCount = _altAccountService.GetAltsFor(user.Id).Count;
IReadOnlyCollection<ulong> altAccounts = _altAccountService.GetAltsFor(user.Id);

embed.AddFieldIf(infractionCount > 0, "Infractions", infractionCount, true);
embed.AddFieldIf(altCount > 0, "Alt Accounts", altCount, true);
int infractionCount = _infractionService.GetInfractionCount(user, guild);
int altInfractions = altAccounts.SelectMany(alt => _infractionService.GetInfractions(alt, guild.Id)).Count();
embed.AddFieldIf(infractionCount > 0, "Infractions", $"{infractionCount} (+ {altInfractions})", true);

int altCount = altAccounts.Count;
embed.AddFieldIf(altCount > 0, "Alt Account".ToQuantity(altCount), () => altCount switch
{
1 => MentionUtility.MentionUser(altAccounts.First()),
<= 5 => string.Join("\n", altAccounts.Select(id => $"• {MentionUtility.MentionUser(id)} ({id})")),
_ => $"Use `/alt view user:{user.Id}` to view."
});
}

if (member is null)
Expand Down
2 changes: 1 addition & 1 deletion Hammer/Hammer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<VersionPrefix>5.8.0</VersionPrefix>
<VersionPrefix>5.8.1</VersionPrefix>
</PropertyGroup>

<PropertyGroup Condition="'$(VersionSuffix)' != '' And '$(BuildNumber)' == ''">
Expand Down

0 comments on commit a032e63

Please sign in to comment.