This repository has been archived on 2024-06-23. You can view files and clone it, but cannot push or open issues or pull requests.
OctobotStealth/Boyfriend/Commands/Unban.cs
2021-12-07 23:27:27 +05:00

23 lines
No EOL
968 B
C#

using Discord;
using Discord.Commands;
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedMember.Global
namespace Boyfriend.Commands;
public class UnbanModule : ModuleBase<SocketCommandContext> {
[Command("unban")]
[Summary("Возвращает пользователя из бана")]
[Alias("разбан")]
public async Task Run(IUser toBan, TimeSpan duration, [Remainder]string reason)
=> await UnbanUser(Context.Guild, Context.User, toBan, reason);
public async Task UnbanUser(IGuild guild, IUser author, IUser toBan, string reason = "") {
var authorMention = author.Mention;
await toBan.SendMessageAsync("Тебя разбанил " + authorMention + " за " + reason);
await guild.RemoveBanAsync(toBan);
await guild.GetSystemChannelAsync().Result.SendMessageAsync(authorMention + " возвращает из бана "
+ toBan.Mention + " за " + reason);
}
}