mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-05 13:36:30 +03:00
Seal all possible classes, add LICENSE, follow async naming conventions
This commit is contained in:
parent
ac63719a0b
commit
e767205c1a
20 changed files with 873 additions and 123 deletions
|
@ -3,19 +3,19 @@ using Discord.WebSocket;
|
|||
|
||||
namespace Boyfriend.Commands;
|
||||
|
||||
public class KickCommand : Command {
|
||||
public override string[] Aliases { get; } = { "kick", "кик", "выгнать" };
|
||||
public sealed class KickCommand : ICommand {
|
||||
public string[] Aliases { get; } = { "kick", "кик", "выгнать" };
|
||||
|
||||
public override async Task Run(CommandProcessor cmd, string[] args) {
|
||||
var toKick = cmd.GetMember(args, 0, "ToKick");
|
||||
public async Task RunAsync(CommandProcessor cmd, string[] args, string[] cleanArgs) {
|
||||
var toKick = cmd.GetMember(args, cleanArgs, 0, "ToKick");
|
||||
if (toKick == null || !cmd.HasPermission(GuildPermission.KickMembers)) return;
|
||||
|
||||
if (!cmd.CanInteractWith(toKick, "Kick")) return;
|
||||
|
||||
await KickMember(cmd, toKick, cmd.GetRemaining(args, 1, "KickReason"));
|
||||
await KickMemberAsync(cmd, toKick, cmd.GetRemaining(args, 1, "KickReason"));
|
||||
}
|
||||
|
||||
private static async Task KickMember(CommandProcessor cmd, SocketGuildUser toKick, string? reason) {
|
||||
private static async Task KickMemberAsync(CommandProcessor cmd, SocketGuildUser toKick, string? reason) {
|
||||
if (reason == null) return;
|
||||
var guildKickMessage = $"({cmd.Context.User}) {reason}";
|
||||
|
||||
|
@ -28,4 +28,4 @@ public class KickCommand : Command {
|
|||
cmd.Reply(format, ":police_car: ");
|
||||
cmd.Audit(format);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue