/// Arcy
        public async Task MessageRelayAsync([Remainder] string message = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                return;
            }

            SocketGuildUser user = BotUtils.GetGUser(Context);

            // Check if admin
            if (user.GuildPermissions.Administrator || ServerData.AdminUsers.Contains(user))
            {
                // Check if in relay users collection
                if (ServerData.RelayUsers.Contains(user))
                {
                    await ReplyAsync(BotUtils.KamtroText("You will no longer receive direct messages sent to Kamtro bot."));

                    ServerData.RelayUsers.Remove(user);
                }
                else
                {
                    await ReplyAsync(BotUtils.KamtroText("You will receive direct messages sent to Kamtro bot."));

                    ServerData.RelayUsers.Add(user);
                }
            }
        }
Exemple #2
0
        public async Task ReplaceSettingsFileAsync([Remainder] string message = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                return;                                                                                                // This is an admin only command
            }
            if (Context.Message.Attachments.Count == 1)
            {
                Attachment file = Context.Message.Attachments.ElementAt(0);

                if (file.Filename != "settings.json")
                {
                    await ReplyAsync(BotUtils.KamtroText("The settings file must be a json file named settings.json!"));

                    return;
                }

                // At this point, the file is valid
                string url = file.Url;

                WebClient wc = new WebClient();
                wc.DownloadFile(url, AdminDataManager.StrikeLogPath);

                KLog.Info($"Settings file updated by {BotUtils.GetFullUsername(Context.User)}");
                await ReplyAsync(BotUtils.KamtroText("The settings file has been updated!"));
            }
        }
Exemple #3
0
 public async Task HelpCommandAsync()
 {
     bool      isAdmin = ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN);
     bool      isMod   = ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.MODERATOR) || isAdmin;
     HelpEmbed he      = new HelpEmbed(Context, isMod, isAdmin);
     await he.Display(Context.User.GetOrCreateDMChannelAsync().Result);
 }
Exemple #4
0
        public async Task ToggleDebugAsync([Remainder] string args = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                return;                                                                                                // permissions checking
            }
            if (string.IsNullOrWhiteSpace(args))
            {
                Program.Debug = !Program.Debug;
                await ReplyAsync(BotUtils.KamtroText($"Debug mode turned {(Program.Debug ? "on" : "off")}."));

                return;
            }

            if (args.ToLower() == "on")
            {
                Program.Debug = true;
                KLog.Important("Debug mode turned on");
                await ReplyAsync(BotUtils.KamtroText("Debug mode turned on."));
            }
            else if (args.ToLower() == "off")
            {
                Program.Debug = false;
                KLog.Important("Debug mode turned off");
                await ReplyAsync(BotUtils.KamtroText("Debug mode turned off."));
            }
            else if (args.ToLower() == "mode")
            {
                await ReplyAsync(BotUtils.KamtroText($"Debug mode is {(Program.Debug ? "on" : "off")}"));
            }
            else
            {
                await ReplyAsync(BotUtils.KamtroText("Invalid arguments. No args to toggle, '!debug on' to turn debug mode on, '!debug off' to turn debug mode off, '!debug mode' to see current debug mode."));
            }
        }
Exemple #5
0
 public async Task RefreshShopAsync([Remainder] string args = "")
 {
     if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
     {
         return;
     }
     ShopManager.GenShopSelection();
     await ReplyAsync(BotUtils.KamtroText("Shop Refreshed."));
 }
Exemple #6
0
        public async Task HackedAsync()
        {
            SocketGuildUser user = BotUtils.GetGUser(Context);

            if (ServerData.HasPermissionLevel(user, ServerData.PermissionLevel.ADMIN))
            {
                await Hacked();
            }
        }
Exemple #7
0
 public async Task SettingsFileAsync([Remainder] string message = "")
 {
     if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
     {
         return;                                                                                                // This is an admin only command
     }
     // Check if the file is being used
     await Context.Channel.SendFileAsync("Config/settings.json");
 }
Exemple #8
0
        public async Task OfflineAsync()
        {
            SocketGuildUser user = BotUtils.GetGUser(Context);

            if (ServerData.HasPermissionLevel(user, ServerData.PermissionLevel.MODERATOR))
            {
                await ReplyAsync(BotUtils.KamtroText("Goodnight 💤"));

                await Program.Client.LogoutAsync();
            }
        }
Exemple #9
0
        public async Task RemModifyRoleAsync([Remainder] string roleName = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                return;                                                                                                // This is an admin only command
            }
            if (string.IsNullOrWhiteSpace(roleName))
            {
                await ReplyAsync(BotUtils.KamtroText("Please specify a role name!"));
            }

            ulong id;

            if (ulong.TryParse(roleName, out id) && BotUtils.GetRole(id) != null)
            {
                await RemModifyRole(BotUtils.GetRole(id));

                return;
            }

            // if it's not a recognized ID, treat it as a name

            List <SocketRole> roles = new List <SocketRole>();

            foreach (SocketRole r in BotUtils.GetRoles(roleName))
            {
                if (Program.Settings.ModifiableRoles.Contains(r.Id))
                {
                    roles.Add(r);
                }
            }

            if (roles.Count == 0)
            {
                await ReplyAsync(BotUtils.KamtroText("I couldn't find any roles on the list that matched the name you told me!"));

                return;
            }
            else if (roles.Count > 10)
            {
                await ReplyAsync(BotUtils.KamtroText("There were too many roles with that name! Please be more specific, or use the role ID"));

                return;
            }
            else if (roles.Count == 1)
            {
                await RemModifyRole(roles[0]);
            }
            else
            {
                RoleSelectionEmbed rse = new RoleSelectionEmbed(roles, RemModifyRole, BotUtils.GetGUser(Context));
                await rse.Display(Context.Channel);
            }
        }
Exemple #10
0
        public async Task ReloadConfigAsync()
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                return;                                                                                                // This is an admin only command
            }
            Program.ReloadConfig();
            ReactionHandler.SetupRoleMap();

            await ReplyAsync(BotUtils.KamtroText("Settings Reloaded."));
        }
        public async Task ResetRepAsync([Remainder] string name = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.MODERATOR))
            {
                return;
            }

            UserDataManager.ResetRep();

            await ReplyAsync(BotUtils.KamtroText("Rep reset."));
        }
Exemple #12
0
        private async Task PermCheck(SocketGuildUser user)
        {
            int perm = 0;

            if (ServerData.HasPermissionLevel(user, ServerData.PermissionLevel.USER))
            {
                perm++;

                if (ServerData.HasPermissionLevel(user, ServerData.PermissionLevel.TRUSTED))
                {
                    perm++;

                    if (ServerData.HasPermissionLevel(user, ServerData.PermissionLevel.MODERATOR))
                    {
                        perm++;

                        if (ServerData.HasPermissionLevel(user, ServerData.PermissionLevel.ADMIN))
                        {
                            perm++;
                        }
                    }
                }
            }

            BasicEmbed be;

            switch (perm)
            {
            case 1:
                be = new BasicEmbed($"Permission Level For User {BotUtils.GetFullUsername(user)}", "User", "Permission Level:", BotUtils.Kamtro, user.GetAvatarUrl());
                break;

            case 2:
                be = new BasicEmbed($"Permission Level For User {BotUtils.GetFullUsername(user)}", "Trusted", "Permission Level:", BotUtils.Green, user.GetAvatarUrl());
                break;

            case 3:
                be = new BasicEmbed($"Permission Level For User {BotUtils.GetFullUsername(user)}", "Moderator", "Permission Level:", BotUtils.Blue, user.GetAvatarUrl());
                break;

            case 4:
                be = new BasicEmbed($"Permission Level For User {BotUtils.GetFullUsername(user)}", "Admin", "Permission Level:", BotUtils.Purple, user.GetAvatarUrl());
                break;

            default:
                be = new BasicEmbed($"Permission Level For User {BotUtils.GetFullUsername(user)}", "Muted", "Permission Level:", BotUtils.Grey, user.GetAvatarUrl());
                break;
            }

            await be.Display(Context.Channel);
        }
        private async Task StrikeUser(SocketUser user)
        {
            // First, the classic null check
            if (BotUtils.GetGUser(Context) == null)
            {
                await Context.Channel.SendMessageAsync(BotUtils.KamtroText("That user does not exist!"));

                KLog.Info($"User {BotUtils.GetFullUsername(Context.User)} attempted to strike non-existant member {BotUtils.GetFullUsername(user)}");
                return;
            }

            // Flavor text for trying to strike yourself
            if (user.Id == Context.User.Id)
            {
                await Context.Channel.SendMessageAsync(BotUtils.KamtroText("We would like to save the strikes for those that deserve it."));

                return;
            }

            // next, check to see if Kamtro has perms to ban the user
            if (!BotUtils.HighestUser(BotUtils.GetGUser(Context.Client.CurrentUser.Id), BotUtils.GetGUser(user.Id)))
            {
                await Context.Channel.SendMessageAsync(BotUtils.KamtroText("The user is higher than me, so I cannot strike them."));

                KLog.Info($"User {BotUtils.GetFullUsername(Context.User)} attempted to strike member {BotUtils.GetFullUsername(user)} of higher status than bot");
                return;
            }

            // next, check if the caller can ban the user
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                if (BotUtils.HighestUser(BotUtils.GetGUser(user.Id), BotUtils.GetGUser(Context), true))
                {
                    await Context.Channel.SendMessageAsync(BotUtils.KamtroText("This user is higher or equal than you, and as such, you cannot strike them."));

                    KLog.Info($"User {BotUtils.GetFullUsername(Context.User)} attempted to strike member {BotUtils.GetFullUsername(user)} of higher status than caller");
                    return;
                }
            }

            if (AdminDataManager.GetStrikes(user) >= 2)
            {
                await BanUser(user);

                return;
            }

            StrikeEmbed se = new StrikeEmbed(Context, user);
            await se.Display();
        }
Exemple #14
0
        public async Task AddEmoteRoleAsync([Remainder] string args = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                return;                                                                                                // This is an admin only command
            }
            if (string.IsNullOrWhiteSpace(args))
            {
                await ReplyAsync(BotUtils.KamtroText("Please specify a role!"));

                return;
            }

            ulong id;

            if (ulong.TryParse(args, out id) && BotUtils.GetRole(id) != null)
            {
                await AddRoleEmote(BotUtils.GetRole(id));

                return;
            }

            // if it's not a recognized ID, treat it as a name

            List <SocketRole> roles = BotUtils.GetRoles(args);

            if (roles.Count == 0)
            {
                await ReplyAsync(BotUtils.KamtroText("I couldn't find any roles that matched the name you told me!"));

                return;
            }
            else if (roles.Count > 10)
            {
                await ReplyAsync(BotUtils.KamtroText("There were too many roles with that name! Please be more specific, or use the role ID"));

                return;
            }
            else if (roles.Count == 1)
            {
                await AddRoleEmote(roles[0]);
            }
            else
            {
                RoleSelectionEmbed rse = new RoleSelectionEmbed(roles, AddRoleEmote, BotUtils.GetGUser(Context));
                await rse.Display(Context.Channel);
            }
        }
        public async Task UserInfoAsync([Remainder] string args = null)
        {
            // Moderator check
            SocketGuildUser user = BotUtils.GetGUser(Context);

            if (ServerData.HasPermissionLevel(user, ServerData.PermissionLevel.MODERATOR))
            {
                // Only command was used. Get info on current user
                if (string.IsNullOrWhiteSpace(args))
                {
                    await DisplayUserInfoEmbed(user);

                    return;
                }
                else
                {
                    List <SocketGuildUser> users = BotUtils.GetUser(Context.Message);

                    // No user found
                    if (users.Count == 0)
                    {
                        await ReplyAsync(BotUtils.KamtroText("I could not find that user. Please try again and make sure you are spelling the user correctly."));

                        return;
                    }
                    // Get info on user
                    else if (users.Count == 1)
                    {
                        await DisplayUserInfoEmbed(users[0]);

                        return;
                    }
                    // Name is too vague. More than 10 users found
                    else if (users.Count > 10)
                    {
                        await ReplyAsync(BotUtils.KamtroText("That name is too vague. Please try specifying the user."));

                        return;
                    }
                    // More than one user mentioned, or ambiguous user
                    else
                    {
                        UserSelectionEmbed use = new UserSelectionEmbed(users, DisplayUserInfoEmbed, BotUtils.GetGUser(Context.User.Id));
                        await use.Display(Context.Channel);
                    }
                }
            }
        }
Exemple #16
0
 public async Task UserDataAsync([Remainder] string message = "")
 {
     if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
     {
         return;                                                                                                // This is an admin only command
     }
     // Check if the file is being used
     if (!BotUtils.SaveInProgress)
     {
         await Context.Channel.SendFileAsync("User Data/UserData.json");
     }
     else
     {
         await ReplyAsync(BotUtils.KamtroText("The user data file is currently being saved."));
     }
 }
        public async Task StrikeLogAsync([Remainder] string args = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.MODERATOR))
            {
                return;
            }

            if (File.Exists(AdminDataManager.StrikeLogPath))
            {
                await Context.Channel.SendFileAsync(AdminDataManager.StrikeLogPath);
            }
            else
            {
                AdminDataManager.InitExcel();
                await ReplyAsync(BotUtils.KamtroText("Stirke file was missing, so I made a new one."));

                await Context.Channel.SendFileAsync(AdminDataManager.StrikeLogPath);
            }
        }
        private async Task BanUser(SocketUser user)
        {
            // First, the classic null check
            if (BotUtils.GetGUser(Context) == null)
            {
                await Context.Channel.SendMessageAsync(BotUtils.KamtroText("That user does not exist!"));

                KLog.Info($"User {BotUtils.GetFullUsername(Context.User)} attempted to ban non-existant member {BotUtils.GetFullUsername(user)}");
                return;
            }

            // Flavor text for trying to ban yourself
            if (user.Id == Context.User.Id)
            {
                await Context.Channel.SendMessageAsync(BotUtils.KamtroText("Sorry, but we still need you."));

                return;
            }

            // next, check to see if Kamtro has perms to ban the user
            if (!BotUtils.HighestUser(BotUtils.GetGUser(Context.Client.CurrentUser.Id), BotUtils.GetGUser(user.Id)))
            {
                await Context.Channel.SendMessageAsync(BotUtils.KamtroText("The user is higher than me, so I cannot ban them."));

                KLog.Info($"User {BotUtils.GetFullUsername(Context.User)} attempted to ban member {BotUtils.GetFullUsername(user)} of higher status than bot");
                return;
            }

            // next, check if the caller can ban the user
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                if (BotUtils.HighestUser(BotUtils.GetGUser(user.Id), BotUtils.GetGUser(Context), true))
                {
                    await Context.Channel.SendMessageAsync(BotUtils.KamtroText("This user is higher or equal than you, and as such, you cannot ban them."));

                    KLog.Info($"User {BotUtils.GetFullUsername(Context.User)} attempted to ban member {BotUtils.GetFullUsername(user)} of higher status than caller");
                    return;
                }
            }

            BanEmbed be = new BanEmbed(Context, user);
            await be.Display();
        }
Exemple #19
0
        public async Task SaveAsync([Remainder] string args = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                return;                                                                                                // This is an admin only command
            }
            if (BotUtils.SaveInProgress)
            {
                await ReplyAsync(BotUtils.KamtroText("User data is already being saved!"));
            }
            else
            {
                BotUtils.PauseSave = true;
                UserDataManager.SaveUserData();
                BotUtils.PauseSave = false;

                await ReplyAsync(BotUtils.KamtroText("User data saved."));
            }
        }
Exemple #20
0
        public async Task AddAdminAsync([Remainder] string user = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                return;                                                                                                // This is an admin only command
            }
            // This command adds an admin to the bot config.

            List <SocketGuildUser> users = BotUtils.GetUser(Context.Message);

            if (users.Count == 0)
            {
                await ReplyAsync(BotUtils.KamtroText("I can't find a user with that name, make sure the name is spelt correctly!"));

                return;
            }
            else if (users.Count > 10)
            {
                await ReplyAsync(BotUtils.KamtroText("Please be more specific! You can attach a discriminator if you need to (Username#1234)"));

                return;
            }
            else if (users.Count == 1)
            {
                // Check if the user is already an admin
                if (Program.Settings.AdminUsers.Contains(users[0].Id))
                {
                    await ReplyAsync(BotUtils.KamtroText(users[0].Username + "#" + users[0].Discriminator + " is already an admin!"));

                    return;
                }

                await AddAdmin(users[0]);
            }
            else
            {
                UserSelectionEmbed use = new UserSelectionEmbed(users, AddAdmin, BotUtils.GetGUser(Context));
                await use.Display(Context.Channel);
            }

            Program.ReloadConfig();
        }
        public async Task PurgeAsync([Remainder] string name = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.MODERATOR))
            {
                return;
            }

            ISocketMessageChannel channel = Context.Channel;

            List <IMessage> messages = await channel.GetMessagesAsync(99999, CacheMode.AllowDownload).Flatten().ToList();

            List <IMessage> messagesToDelete = new List <IMessage>();

            for (int i = 0; i < messages.Count; i++)
            {
                // Check if message can be deleted and record it
                if (messages[i].Timestamp.AddDays(14) > DateTimeOffset.Now)
                {
                    messagesToDelete.Add(messages[i]);
                }
                else
                {
                    break; // Cannot get any more messages
                }
            }

            StreamWriter sw = new StreamWriter("Admin/PurgeLog.txt");

            // Delete Messages
            for (int i = messagesToDelete.Count - 1; i >= 0; i--)
            {
                sw.WriteLine($"[{messagesToDelete[i].Timestamp.DateTime.ToLongTimeString()}] {messagesToDelete[i].Author.Username}#{messagesToDelete[i].Author.Discriminator}: {messagesToDelete[i].Content}");
                await messagesToDelete[i].DeleteAsync();
            }

            sw.Close();

            await ServerData.AdminChannel.SendMessageAsync(BotUtils.KamtroText($"{messagesToDelete.Count} messages were deleted in {channel.Name}."));

            await ServerData.AdminChannel.SendFileAsync("Admin/PurgeLog.txt", "");
        }
        public async Task BanMemberAsync([Remainder] string name = "")
        {
            SocketGuildUser caller = BotUtils.GetGUser(Context);

            if (!ServerData.HasPermissionLevel(caller, ServerData.PermissionLevel.MODERATOR))
            {
                return;
            }

            if (name == "")
            {
                await ReplyAsync(BotUtils.KamtroText("Please specify a user!"));

                return;
            }

            List <SocketGuildUser> users = BotUtils.GetUser(Context.Message);

            if (users.Count == 0)
            {
                await ReplyAsync(BotUtils.KamtroText("I can't find a user with that name. Make sure the name is spelt correctly!"));

                return;
            }
            else if (users.Count > 10)
            {
                await ReplyAsync(BotUtils.KamtroText("Please be more specific! You can attach a discriminator if you need to (Username#1234)"));

                return;
            }
            else if (users.Count == 1)
            {
                await BanUser(users[0]);
            }
            else
            {
                UserSelectionEmbed use = new UserSelectionEmbed(users, BanUser, BotUtils.GetGUser(Context));
                await use.Display(Context.Channel);
            }
        }
Exemple #23
0
        public async Task RewardUserAsync([Remainder] string args = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(args))
            {
                await ReplyAsync(BotUtils.KamtroText("Please specify a user!"));

                return;
            }

            // This command is used as an easy way to give a user rewards after winning a tournament.
            List <SocketGuildUser> users = BotUtils.GetUsers(args);

            if (users.Count == 0)
            {
                await ReplyAsync(BotUtils.KamtroText("I can't find a user with that name, make sure the name is spelt correctly!"));

                return;
            }
            else if (users.Count > 10)
            {
                await ReplyAsync(BotUtils.KamtroText("Please be more specific! You can attach a discriminator if you need to (Username#1234)"));

                return;
            }
            else if (users.Count == 1)
            {
                await RewardUser(users[0]);
            }
            else
            {
                UserSelectionEmbed use = new UserSelectionEmbed(users, RewardUser, BotUtils.GetGUser(Context));
                await use.Display(Context.Channel);
            }
        }
Exemple #24
0
        public async Task ConvertAsync()
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                return;
            }

            FileInfo     f = new FileInfo("Strike_Log.xlsx");
            ExcelPackage p = new ExcelPackage(f);

            ExcelWorksheet log = p.Workbook.Worksheets["Sheet1"];

            int users = 0;
            int dates = 0;

            for (int i = 2; i <= 421; i++)
            {
                if (!string.IsNullOrWhiteSpace(log.Cells[$"E{i}"].Text))
                {
                    log.Cells[$"E{i}"].Value = ConvertDT(log.Cells[$"E{i}"].Text, i).ToString("F"); dates++;
                }

                if (!string.IsNullOrWhiteSpace(log.Cells[$"G{i}"].Text))
                {
                    log.Cells[$"G{i}"].Value = ConvertDT(log.Cells[$"G{i}"].Text, i).ToString("F"); dates++;
                }

                if (!string.IsNullOrWhiteSpace(log.Cells[$"I{i}"].Text))
                {
                    log.Cells[$"I{i}"].Value = ConvertDT(log.Cells[$"I{i}"].Text, i).ToString("F"); dates++;
                }

                users++;
            }

            p.Save();

            await ReplyAsync(BotUtils.KamtroText($"Conveted {dates} dates for {users} users."));
        }
Exemple #25
0
        public async Task SetWelcomeMessageAsync([Remainder] string message = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                return;                                                                                                // This is an admin only command
            }
            string msg;

            if (string.IsNullOrWhiteSpace(message))
            {
                msg = BotUtils.ZeroSpace;
            }
            else
            {
                msg = message;
            }

            Program.Settings.WelcomeMessageTemplate = msg;
            Program.SaveSettings();

            await ReplyAsync(BotUtils.KamtroText($"Welcome message set to '{msg}'"));
        }
Exemple #26
0
        public async Task PermCheckAsync([Remainder] string user = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                return;                                                                                                // This is an admin only command
            }
            if (string.IsNullOrWhiteSpace(user))
            {
                await PermCheck(BotUtils.GetGUser(Context));
            }
            else
            {
                List <SocketGuildUser> users = BotUtils.GetUser(Context.Message);

                if (users.Count == 0)
                {
                    await ReplyAsync(BotUtils.KamtroText("I can't find a user with that name, make sure the name is spelt correctly!"));

                    return;
                }
                else if (users.Count > 10)
                {
                    await ReplyAsync(BotUtils.KamtroText("Please be more specific! You can attach a discriminator if you need to (Username#1234)"));

                    return;
                }
                else if (users.Count == 1)
                {
                    await PermCheck(users[0]);
                }
                else
                {
                    UserSelectionEmbed use = new UserSelectionEmbed(users, PermCheck, BotUtils.GetGUser(Context));
                    await use.Display(Context.Channel);
                }
            }
        }
        public async Task EditStrikeLogAsync([Remainder] string args = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.MODERATOR))
            {
                return;
            }

            if (Context.Message.Attachments.Count != 1)
            {
                StrikeLogEditEmbed sle = new StrikeLogEditEmbed(Context);
                await sle.Display();

                return;
            }

            // Alt version
            Attachment file = Context.Message.Attachments.ElementAt(0);

            if (file.Filename != "strikelog.xlsx")
            {
                await ReplyAsync(BotUtils.KamtroText("The strike log must be an excel file named strikelog.xlsx!"));

                return;
            }

            // At this point, the file is valid
            string url = file.Url;

            WebClient wc = new WebClient();

            wc.DownloadFile(url, AdminDataManager.StrikeLogPath);
            wc.Dispose();

            KLog.Info($"Strike log updated by {BotUtils.GetFullUsername(Context.User)}");
            await ReplyAsync(BotUtils.KamtroText("The strike log has been updated!"));
        }
        public async Task DeleteBanMessagesAsync([Remainder] string name = "")
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.MODERATOR))
            {
                return;
            }

            SocketUser bannedUser = ServerData.BannedUser;

            if (bannedUser != null)
            {
                await ServerData.Server.RemoveBanAsync(bannedUser);

                await ServerData.Server.AddBanAsync(bannedUser, 7);

                await ReplyAsync(BotUtils.KamtroText($"Messages from {bannedUser.Username}#{bannedUser.Discriminator} in the past 7 days have been deleted."));
            }
            else
            {
                await ReplyAsync(BotUtils.KamtroText("There is not a ban recently to delete messages from."));
            }

            /*
             * await ReplyAsync(BotUtils.KamtroText("Please wait. This will take a while."));
             *
             * // Warning: This command is very intensive!
             * if (bannedUser != null)
             * {
             *  List<IMessage> messagesToDelete = new List<IMessage>();
             *
             *  // Check all channels
             *  foreach (SocketTextChannel channel in ServerData.Server.TextChannels)
             *  {
             *      // Get only accessible text channels
             *      if (channel.Users.Contains(BotUtils.GetGUser(Context.Client.CurrentUser.Id)))
             *      {
             *          // Get all messages
             *          List<IMessage> messages = await channel.GetMessagesAsync(1000).Flatten().ToList();
             *
             *          foreach (IMessage message in messages)
             *          {
             *              // Check for messages that were sent by the banned user
             *              if (message.Author.Id == bannedUser.Id)
             *              {
             *                  messagesToDelete.Add(message);
             *              }
             *          }
             *      }
             *  }
             *
             *  // Delete all messages by the banned user
             *  foreach (IMessage message in messagesToDelete)
             *  {
             *      await message.DeleteAsync();
             *  }
             *
             *  await ServerData.AdminChannel.SendMessageAsync($"{messagesToDelete.Count} messages were deleted from {bannedUser.Username}#{bannedUser.Discriminator}.");
             * }
             * else
             * {
             *  await ServerData.AdminChannel.SendMessageAsync(BotUtils.KamtroText("There is not a ban recently to delete messages from."));
             * }*/
        }
        public async Task DirectMessageAsync([Remainder] string args = null)
        {
            if (!ServerData.HasPermissionLevel(BotUtils.GetGUser(Context), ServerData.PermissionLevel.ADMIN))
            {
                return;
            }

            SocketGuildUser user = BotUtils.GetGUser(Context);

            // Check if admin
            if (user.GuildPermissions.Administrator || ServerData.AdminUsers.Contains(user))
            {
                /// TO DO
                ///
                /// Get the user in remainder of the message [DONE]
                /// Make prompt on what message to send to the user [DONE]
                /// Include attachments
                /// Sends the message to the user [DONE]

                // Inform user to specify the user to DM
                if (args == null)
                {
                    await ReplyAsync(BotUtils.KamtroText("You must specify the user to directly message."));

                    return;
                }
                else
                {
                    // Split the message to get the corresponding parts
                    string[]        msgSplit = Context.Message.Content.Split(' ');
                    SocketGuildUser target   = BotUtils.GetUser(msgSplit[1]);

                    if (target == null)
                    {
                        await ReplyAsync(BotUtils.KamtroText("I cannot find that user."));

                        return;
                    }
                    else if (msgSplit.Length == 2)
                    {
                        /// To Do:
                        /// Show embed for messaging the user [DONE]
                        /// Toggle on messaging that user

                        MessagingEmbed embed = new MessagingEmbed(user);
                        // Send embed in DMs to user
                        try
                        {
                            await embed.Display((IMessageChannel)user.GetOrCreateDMChannelAsync());
                        }
                        // Could not send to the user
                        catch (Exception)
                        {
                            if (user.Nickname != null)
                            {
                                await ReplyAsync(BotUtils.KamtroText($"I cannot send direct messages to you, {user.Nickname}. Please allow direct messages from me."));
                            }
                            else
                            {
                                await ReplyAsync(BotUtils.KamtroText($"I cannot send direct messages to you, {user.Username}. Please allow direct messages from me."));
                            }
                        }
                    }
                    else
                    {
                        // Build the message back together
                        string msgSend = "";
                        for (int i = 2; i < msgSplit.Length; i++)
                        {
                            msgSend += msgSplit[i];
                            if (i != msgSplit.Length - 1)
                            {
                                msgSend += " ";
                            }
                        }

                        // Send message and notify user using the command
                        try
                        {
                            await target.SendMessageAsync(msgSend);
                            await ReplyAsync(BotUtils.KamtroText($"Message sent to {target.Username}#{user.Discriminator}."));
                        }
                        // Could not send to the user
                        catch (Exception)
                        {
                            await ReplyAsync(BotUtils.KamtroText($"Message could not be sent to the user. The user either has messages from only friends allowed or has blocked me."));
                        }
                    }
                }
            }
        }
        public async Task VoiceKickAsync([Remainder] string args = null)
        {
            // Moderator check
            SocketGuildUser user = BotUtils.GetGUser(Context);

            if (ServerData.HasPermissionLevel(user, ServerData.PermissionLevel.MODERATOR))
            {
                // Only command was used. Reply to user saying a user needs to be specified for the command.
                if (string.IsNullOrWhiteSpace(args))
                {
                    await ReplyAsync(BotUtils.KamtroText("You did not specify the user to remove from voice chat."));

                    return;
                }
                else
                {
                    List <SocketGuildUser> users = BotUtils.GetUser(Context.Message);

                    // No user found
                    if (users.Count == 0)
                    {
                        await ReplyAsync(BotUtils.KamtroText("I could not find that user. Please try again and make sure you are spelling the user correctly."));

                        return;
                    }
                    // Check for users in voice channels and remove those that aren't
                    else
                    {
                        List <SocketGuildUser> removeUsers = new List <SocketGuildUser>();
                        foreach (SocketGuildUser currentUser in users)
                        {
                            if (currentUser.VoiceChannel == null)
                            {
                                removeUsers.Add(currentUser);
                            }
                        }

                        foreach (SocketGuildUser currentUser in removeUsers)
                        {
                            users.Remove(currentUser);
                        }
                    }

                    // No users found in voice channels
                    if (users.Count == 0)
                    {
                        await ReplyAsync(BotUtils.KamtroText("That user is not in a voice channel."));
                    }
                    // Create temporary voice channel, move user, then delete voice channel
                    else if (users.Count == 1)
                    {
                        SocketVoiceChannel currentVc = users[0].VoiceChannel;
                        await users[0].ModifyAsync(x => x.Channel = null);

                        await ReplyAsync(BotUtils.KamtroText($"{users[0].GetDisplayName()} has been removed from {currentVc.Name}."));

                        return;
                    }
                    // Name is too vague. More than 10 users found
                    else if (users.Count > 10)
                    {
                        await ReplyAsync(BotUtils.KamtroText("That name is too vague. Please try specifying the user."));

                        return;
                    }
                    // More than one user mentioned, or ambiguous user
                    else
                    {
                        UserSelectionEmbed use = new UserSelectionEmbed(users, VoiceKickUserAsync, BotUtils.GetGUser(Context.User.Id));
                        await use.Display(Context.Channel);
                    }
                }
            }
        }