mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-19 04:04:18 +03:00
Refactor guild data storage (#13)
Co-authored-by: mctaylors <volkovvladislav8@gmail.com>
This commit is contained in:
parent
f0a6c8faff
commit
7b8888dae3
24 changed files with 941 additions and 661 deletions
Boyfriend/Commands
|
@ -1,3 +1,4 @@
|
|||
using Boyfriend.Data;
|
||||
using Discord;
|
||||
using Discord.WebSocket;
|
||||
|
||||
|
@ -7,7 +8,7 @@ public sealed class KickCommand : ICommand {
|
|||
public string[] Aliases { get; } = { "kick", "кик", "выгнать" };
|
||||
|
||||
public async Task RunAsync(CommandProcessor cmd, string[] args, string[] cleanArgs) {
|
||||
var toKick = cmd.GetMember(args, cleanArgs, 0, "ToKick");
|
||||
var toKick = cmd.GetMember(args, 0);
|
||||
if (toKick is null || !cmd.HasPermission(GuildPermission.KickMembers)) return;
|
||||
|
||||
if (cmd.CanInteractWith(toKick, "Kick"))
|
||||
|
@ -22,6 +23,9 @@ public sealed class KickCommand : ICommand {
|
|||
string.Format(Messages.YouWereKicked, cmd.Context.User.Mention, cmd.Context.Guild.Name,
|
||||
Utils.Wrap(reason)));
|
||||
|
||||
GuildData.Get(cmd.Context.Guild).MemberData[toKick.Id].Roles.Clear();
|
||||
cmd.ConfigWriteScheduled = true;
|
||||
|
||||
await toKick.KickAsync(guildKickMessage);
|
||||
var format = string.Format(Messages.FeedbackMemberKicked, toKick.Mention, Utils.Wrap(reason));
|
||||
cmd.Reply(format, ReplyEmojis.Kicked);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue