mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-29 10:39:53 +03:00
Rename solution & project, move the project files one layer up
This commit is contained in:
parent
b486d2d3d9
commit
c220a0f379
27 changed files with 52 additions and 76 deletions
25
Commands/UnbanCommand.cs
Normal file
25
Commands/UnbanCommand.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using Discord;
|
||||
|
||||
namespace Boyfriend.Commands;
|
||||
|
||||
public sealed class UnbanCommand : ICommand {
|
||||
public string[] Aliases { get; } = { "unban", "разбан" };
|
||||
|
||||
public async Task RunAsync(CommandProcessor cmd, string[] args, string[] cleanArgs) {
|
||||
if (!cmd.HasPermission(GuildPermission.BanMembers)) return;
|
||||
|
||||
var id = cmd.GetBan(args, 0);
|
||||
if (id is null) return;
|
||||
var reason = cmd.GetRemaining(args, 1, "UnbanReason");
|
||||
if (reason is not null) await UnbanUserAsync(cmd, id.Value, reason);
|
||||
}
|
||||
|
||||
private static async Task UnbanUserAsync(CommandProcessor cmd, ulong id, string reason) {
|
||||
var requestOptions = Utils.GetRequestOptions($"({cmd.Context.User}) {reason}");
|
||||
await cmd.Context.Guild.RemoveBanAsync(id, requestOptions);
|
||||
|
||||
var feedback = string.Format(Messages.FeedbackUserUnbanned, $"<@{id.ToString()}>", Utils.Wrap(reason));
|
||||
cmd.Reply(feedback);
|
||||
cmd.Audit(feedback);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue