-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMuteCommandHandler.cs
More file actions
22 lines (19 loc) · 906 Bytes
/
Copy pathMuteCommandHandler.cs
File metadata and controls
22 lines (19 loc) · 906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using RustPlusBot.Features.Commands.Dispatching;
using RustPlusBot.Features.Commands.Localization;
using RustPlusBot.Persistence.Commands;
namespace RustPlusBot.Features.Commands.Handlers;
/// <summary>!mute — silence all bot-to-game output.</summary>
/// <param name="store">The mute store.</param>
/// <param name="localizer">The reply localizer.</param>
internal sealed class MuteCommandHandler(IMuteStore store, ICommandLocalizer localizer) : ICommandHandler
{
/// <inheritdoc />
public string Name => "mute";
/// <inheritdoc />
public async Task<string?> ExecuteAsync(CommandContext context, CancellationToken cancellationToken)
{
ArgumentNullException.ThrowIfNull(context);
await store.SetMutedAsync(context.GuildId, context.ServerId, true, cancellationToken).ConfigureAwait(false);
return localizer.Get("command.mute.done", context.Culture);
}
}