Skip to content

Commit d0cfe99

Browse files
committed
feat: mention <= 5 alts in /userinfo
1 parent 2c9c3b7 commit d0cfe99

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [5.8.1] - 2023-10-03
9+
10+
### Changed
11+
- If a user has 5 or fewer alt accounts, the users are mentioned in /userinfo directly.
12+
813
## [5.8.0] - 2023-09-30
914

1015
### Added
@@ -443,6 +448,7 @@ No substantial changes. Commit 3b8259a6cfb82ec0f5f51804c1ac7f1f5880d014 fixed an
443448

444449
- Hammer is released.
445450

451+
[5.8.1]: https://github.com/BrackeysBot/Hammer/releases/tag/v5.8.1
446452
[5.8.0]: https://github.com/BrackeysBot/Hammer/releases/tag/v5.8.0
447453
[5.7.0]: https://github.com/BrackeysBot/Hammer/releases/tag/v5.7.0
448454
[5.6.1]: https://github.com/BrackeysBot/Hammer/releases/tag/v5.6.1

Hammer/Commands/UserInfoCommand.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Hammer.Configuration;
66
using Hammer.Extensions;
77
using Hammer.Services;
8+
using Humanizer;
89
using X10D.DSharpPlus;
910

1011
namespace Hammer.Commands;
@@ -100,10 +101,16 @@ private DiscordEmbed CreateUserInfoEmbed(DiscordUser user, DiscordMember? member
100101
if (staffRequested)
101102
{
102103
int infractionCount = _infractionService.GetInfractionCount(user, guild);
103-
int altCount = _altAccountService.GetAltsFor(user.Id).Count;
104-
105104
embed.AddFieldIf(infractionCount > 0, "Infractions", infractionCount, true);
106-
embed.AddFieldIf(altCount > 0, "Alt Accounts", altCount, true);
105+
106+
IReadOnlyCollection<ulong> altAccounts = _altAccountService.GetAltsFor(user.Id);
107+
int altCount = altAccounts.Count;
108+
embed.AddFieldIf(altCount > 0, "Alt Account".ToQuantity(altCount), () => altCount switch
109+
{
110+
1 => MentionUtility.MentionUser(altAccounts.First()),
111+
<= 5 => string.Join("\n", altAccounts.Select(id => $"• {MentionUtility.MentionUser(id)} ({id})")),
112+
_ => $"Use `/alt view user:{user.Id}` to view."
113+
});
107114
}
108115

109116
if (member is null)

0 commit comments

Comments
 (0)