diff --git a/ColorsList.cs b/ColorsList.cs
index ee7a0b5..fc66573 100644
--- a/ColorsList.cs
+++ b/ColorsList.cs
@@ -5,6 +5,9 @@
namespace Boyfriend;
+///
+/// Contains all colors used in embeds.
+///
public static class ColorsList {
public static readonly Color Default = Color.Gray;
public static readonly Color Red = Color.Firebrick;
diff --git a/Commands/BanCommandGroup.cs b/Commands/BanCommandGroup.cs
index e773f48..92ed248 100644
--- a/Commands/BanCommandGroup.cs
+++ b/Commands/BanCommandGroup.cs
@@ -19,6 +19,9 @@ using Remora.Results;
namespace Boyfriend.Commands;
+///
+/// Handles commands related to ban management: /ban and unban.
+///
public class BanCommandGroup : CommandGroup {
private readonly IDiscordRestChannelAPI _channelApi;
private readonly ICommandContext _context;
@@ -41,12 +44,26 @@ public class BanCommandGroup : CommandGroup {
_utility = utility;
}
- [Command("ban")]
+ ///
+ /// A slash command that bans a Discord user with the specified reason.
+ ///
+ /// The user to ban.
+ ///
+ /// The reason for this ban. Must be encoded with when passed to
+ /// .
+ ///
+ ///
+ /// A feedback sending result which may or may not have succeeded. A successful result does not mean that the user
+ /// was banned and vice-versa.
+ ///
+ ///
+ [Command("ban", "бан")]
[RequireContext(ChannelContext.Guild)]
[RequireDiscordPermission(DiscordPermission.BanMembers)]
[RequireBotDiscordPermissions(DiscordPermission.BanMembers)]
[Description("банит пидора")]
public async Task BanUserAsync([Description("Юзер, кого банить")] IUser target, string reason) {
+ // Data checks
if (!_context.TryGetGuildID(out var guildId))
return Result.FromError(new ArgumentNullError(nameof(guildId)));
if (!_context.TryGetUserID(out var userId))
@@ -54,6 +71,7 @@ public class BanCommandGroup : CommandGroup {
if (!_context.TryGetChannelID(out var channelId))
return Result.FromError(new ArgumentNullError(nameof(channelId)));
+ // The current user's avatar is used when sending error messages
var currentUserResult = await _userApi.GetCurrentUserAsync(CancellationToken);
if (!currentUserResult.IsDefined(out var currentUser))
return Result.FromError(currentUserResult);
@@ -110,6 +128,7 @@ public class BanCommandGroup : CommandGroup {
return Result.FromError(logEmbed);
var builtArray = new[] { logBuilt };
+ // Not awaiting to reduce response time
if (cfg.PrivateFeedbackChannel != channelId.Value)
_ = _channelApi.CreateMessageAsync(
cfg.PrivateFeedbackChannel.ToDiscordSnowflake(), embeds: builtArray,
@@ -127,12 +146,26 @@ public class BanCommandGroup : CommandGroup {
return (Result)await _feedbackService.SendContextualEmbedAsync(built, ct: CancellationToken);
}
+ ///
+ /// A slash command that unbans a Discord user with the specified reason.
+ ///
+ /// The user to unban.
+ ///
+ /// The reason for this unban. Must be encoded with when passed to
+ /// .
+ ///
+ ///
+ /// A feedback sending result which may or may not have succeeded. A successful result does not mean that the user
+ /// was unbanned and vice-versa.
+ ///
+ ///
[Command("unban")]
[RequireContext(ChannelContext.Guild)]
[RequireDiscordPermission(DiscordPermission.BanMembers)]
[RequireBotDiscordPermissions(DiscordPermission.BanMembers)]
[Description("разбанит пидора")]
public async Task UnBanUserAsync([Description("Юзер, кого разбанить")] IUser target, string reason) {
+ // Data checks
if (!_context.TryGetGuildID(out var guildId))
return Result.FromError(new ArgumentNullError(nameof(guildId)));
if (!_context.TryGetUserID(out var userId))
@@ -140,6 +173,7 @@ public class BanCommandGroup : CommandGroup {
if (!_context.TryGetChannelID(out var channelId))
return Result.FromError(new ArgumentNullError(nameof(channelId)));
+ // The current user's avatar is used when sending error messages
var currentUserResult = await _userApi.GetCurrentUserAsync(CancellationToken);
if (!currentUserResult.IsDefined(out var currentUser))
return Result.FromError(currentUserResult);
@@ -158,8 +192,7 @@ public class BanCommandGroup : CommandGroup {
return (Result)await _feedbackService.SendContextualEmbedAsync(alreadyBuilt, ct: CancellationToken);
}
- Result