예제 #1
0
        public async System.Threading.Tasks.Task TaskViewer(CommandContext ctx, string serviceConnectionInfo)
        {
            await ctx.TriggerTypingAsync();

            if (!(Service.GetGameServices(serviceConnectionInfo)[0] is Service service) || !service.Find())
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Task Manager",
                                                                               "**Cannot find service with search criteria: ** *" + serviceConnectionInfo + "*"));

                return;
            }

            var serviceTaskList =
                TCAdmin.TaskScheduler.SDK.Objects.Task.GetTasksForSource(service.GetType().ToString(),
                                                                         service.ServiceId.ToString());
            var servicesTask = serviceTaskList.Cast <TCAdmin.TaskScheduler.SDK.Objects.Task>().ToList();

            if (servicesTask.Count == 0)
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Task Manager", "No Tasks Found"));

                return;
            }

            var taskManager =
                new TcaTaskManager(
                    await ctx.RespondAsync(embed: EmbedTemplates.CreateInfoEmbed("Task Manager", "Initialize...")),
                    servicesTask.Last().TaskId);
            await taskManager.Initialize();
        }
예제 #2
0
        public async Task ServerPowerShell(CommandContext ctx, string serverName, [RemainingText] string script)
        {
            await ctx.TriggerTypingAsync();

            if (!script.StartsWith("```\n") && !script.EndsWith("```"))
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("PowerShell",
                                                                               "**No script found!** Example Script: ```\necho 'test'\n```"));

                return;
            }

            if (!(Server.GetServers(true, serverName)[0] is Server server))
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Server Not Found",
                                                                               $"{serverName} could not be found."));

                return;
            }

            server.FileSystemService.CreateTextFile(@"C:\\DiscordScripts\\script.ps1",
                                                    Encoding.ASCII.GetBytes(script.Replace("```\n", string.Empty).Replace("```", string.Empty)));
            var console = new RemoteConsole(server, @"C:\\Windows\\System32\\cmd.exe",
                                            "/c powershell \"C:\\DiscordScripts\\script.ps1\"", "Powershell - Script", true);

            await ctx.RespondAsync(embed : EmbedTemplates.CreateInfoEmbed("Live Output",
                                                                          $"To start the command, click [here]({console.GetUrl()})"));
        }
        public static async Task <Service> GetService(CommandContext ctx)
        {
            var guildServices = new List <Service>();

            var servicesFresh = Service.GetServices();

            foreach (Service service in servicesFresh)
            {
                if (service.Variables["__Nexus::DiscordGuild"] != null &&
                    service.Variables["__Nexus::DiscordGuild"].ToString() ==
                    ctx.Guild.Id.ToString() /*&& ShowServiceVar(service)*/)
                {
                    guildServices.Add(service);
                }
            }

            if (guildServices.Count == 0)
            {
                throw new CustomMessageException(EmbedTemplates.CreateErrorEmbed("Service Link",
                                                                                 "**No Services could be found. Add one by doing the `;Link` command!**"));
            }

            if (guildServices.Count == 1)
            {
                return(guildServices[0]);
            }

            if (guildServices.Count > 1)
            {
                return(await ChooseServiceFromList(ctx, guildServices));
            }

            return(null);
        }
예제 #4
0
        public async Task LoginUserAs(CommandContext ctx, DiscordMember member, string username)
        {
            var user = User.GetUserByUserName(username);

            if (!user.Find())
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Login As", "Cannot find user"));
            }
        }
예제 #5
0
            public override async Task <bool> ExecuteCheckAsync(CommandContext ctx, bool help)
            {
                if (await IsAdministrator(ctx))
                {
                    return(true);
                }

                throw new CustomMessageException(EmbedTemplates.CreateErrorEmbed("Access Denied",
                                                                                 "**You require `Administrator` permissions to execute this command.**"));
            }
예제 #6
0
            public override async Task <bool> ExecuteCheckAsync(CommandContext ctx, bool help)
            {
                if (await IsTcSubAdministrator(ctx))
                {
                    return(true);
                }

                var companyInfo = new CompanyInfo(2);

                throw new CustomMessageException(EmbedTemplates.CreateErrorEmbed("Access Denied",
                                                                                 $"**You do not have the correct Access Group in `{companyInfo.ControlPanelUrl}` to use this command.**"));
            }
예제 #7
0
        public async System.Threading.Tasks.Task TaskList(CommandContext ctx, string serviceConnectionInfo, int amountOfTasks)
        {
            await ctx.TriggerTypingAsync();

            var interactivity = ctx.Client.GetInteractivity();

            if (!(Service.GetGameServices(serviceConnectionInfo)[0] is Service service) || !service.Find())
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Task Manager",
                                                                               "**Cannot find service with search criteria: ** *" + serviceConnectionInfo + "*"));

                return;
            }

            var serviceTaskList =
                TCAdmin.TaskScheduler.SDK.Objects.Task.GetTasksForSource(service.GetType().ToString(),
                                                                         service.ServiceId.ToString());
            var servicesTask = new List <TCAdmin.TaskScheduler.SDK.Objects.Task>();

            foreach (TCAdmin.TaskScheduler.SDK.Objects.Task task in serviceTaskList)
            {
                servicesTask.Add(task);
            }

            if (servicesTask.Count == 0)
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Task Manager", "No Tasks Found"));

                return;
            }

            var tasksList  = string.Empty;
            var taskIdList = 1;

            tasksList = servicesTask.Take(amountOfTasks).Aggregate(tasksList,
                                                                   (current, task) => current + $"**{taskIdList++}**) {task.Name} [{task.ScheduledTime:f}]\n");

            await ctx.RespondAsync(embed : EmbedTemplates.CreateInfoEmbed("Task Picker", tasksList));

            var msg = await interactivity.WaitForMessageAsync(x => x.Channel == ctx.Channel && x.Author == ctx.User);

            if (int.TryParse(msg.Result.Content, out var result))
            {
                var taskManager = new TcaTaskManager(
                    await ctx.RespondAsync(embed: EmbedTemplates.CreateInfoEmbed("Task Manager", "Initialize...")),
                    servicesTask[result - 1].TaskId);
                await taskManager.Initialize();
            }
            else
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Task Manager", "Invalid Option"));
            }
        }
        public async Task GetVariable(CommandContext ctx, DiscordMember member, string variableName)
        {
            var user = AccountsService.GetUser(member.Id);

            if (user == null)
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("SetVariable", "Could not find user."));

                return;
            }

            await GetVariable(ctx, user.UserId, variableName);
        }
예제 #9
0
        public async Task RestartMonitor(CommandContext ctx, string serverName)
        {
            if (!(Server.GetServers(true, serverName)[0] is Server server))
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Server Not Found",
                                                                               $"{serverName} could not be found."));

                return;
            }

            server.ServerUtilitiesService.RestartMonitor();
            await ctx.RespondAsync(embed : EmbedTemplates.CreateSuccessEmbed("Monitor Restart",
                                                                             $"{server.Name}'s monitor is restarting."));
        }
예제 #10
0
        public async Task ForceLinkService(CommandContext ctx, int serviceId)
        {
            await ctx.Message.DeleteAsync();

            if (DiscordService.LinkService(ctx.Guild.Id, serviceId))
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateSuccessEmbed(description: "**Linked Service**"));
            }
            else
            {
                await ctx.RespondAsync(
                    embed : EmbedTemplates.CreateErrorEmbed(description: "**Failed to link service**"));
            }
        }
        public async Task SignOut(CommandContext ctx)
        {
            var user = AccountsService.GetUser(ctx.User.Id);

            if (user == null)
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Logout",
                                                                               "**You have to be signed in, in order to logout.**"));

                return;
            }

            AccountsService.LogoutUser(user, ctx.User.Id);
            await ctx.RespondAsync(embed : EmbedTemplates.CreateSuccessEmbed("Logout", "**You have been logged out**"));
        }
예제 #12
0
        public async Task LoginAs(CommandContext ctx, string username)
        {
            var user = User.GetUserByUserName(username);

            if (!user.Find())
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Login As", "Cannot find user"));

                return;
            }

            AccountsService.AddUserToEmulation(ctx.User.Id, user);
            await ctx.RespondAsync(
                embed : EmbedTemplates.CreateSuccessEmbed(description: "Logged in as " + user.UserName));
        }
        public async Task PlayersTask(CommandContext ctx)
        {
            var settings =
                new NexusModuleConfiguration <PlayersMenuSettings>("PlayerMenuSettings", "./Config/TCAdminModule/")
                .GetConfiguration();
            await ctx.TriggerTypingAsync();

            var service = await DiscordService.GetService(ctx);

            var server = new Server(service.ServerId);

            var query = ServerQuery.GetQueryResults(server, new TCAdmin.GameHosting.SDK.Objects.Game(service.GameId),
                                                    service);

            if (query.NumPlayers == 0)
            {
                await ctx.RespondAsync(
                    embed : EmbedTemplates.CreateErrorEmbed(service.NameNoHtml, "**No players online**"));

                return;
            }

            if (query.NumPlayers != query.Players.Count)
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateInfoEmbed(service.NameNoHtml,
                                                                              $"There are **{query.NumPlayers}/{query.MaxPlayers}** online!"));

                return;
            }

            var embed = new DiscordEmbedBuilder
            {
                Title     = $"{service.Name} | Players: {query.NumPlayers}/{query.MaxPlayers}",
                Color     = new Optional <DiscordColor>(new DiscordColor(settings.HexColor)),
                Timestamp = DateTime.Now,
                Thumbnail = new DiscordEmbedBuilder.EmbedThumbnail
                {
                    Url = settings.ThumbnailUrl
                }
            };

            foreach (var player in query.Players.OrderBy(x => x.Name))
            {
                embed.Description += $":bust_in_silhouette: {player.Name}\n";
            }

            await ctx.RespondAsync(embed : embed);
        }
예제 #14
0
        public async Task EmulateAs(CommandContext ctx, DiscordMember member)
        {
            var user = AccountsService.GetUser(member.Id);

            if (user == null || !user.Find())
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed(description: "User not found"));

                return;
            }

            AccountsService.AddUserToEmulation(ctx.User.Id, user);

            await ctx.RespondAsync(embed : EmbedTemplates.CreateSuccessEmbed(
                                       description: $"You are now emulating as: {member.Username}#{member.Discriminator} ({user.UserName})"));
        }
예제 #15
0
        public async Task Whois(CommandContext ctx, DiscordMember member)
        {
            var user = AccountsService.GetUser(member.Id);

            if (user == null || !user.Find())
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed(description: "User not found"));

                return;
            }

            var userInfo = $"**User: {user.UserName} ({user.UserId})**\n" +
                           $"**Owner: {user.OwnerId} Sub: {user.SubUserOwnerId}**\n" +
                           $"**Role ID: {user.RoleId} Name: {user.RoleName}**\n";
            var embed = EmbedTemplates.CreateInfoEmbed("User Information: " + user.FullName, userInfo);

            await ctx.RespondAsync(embed : embed);
        }
예제 #16
0
        public async Task ServerCmd(CommandContext ctx, string serverName, [RemainingText] string script)
        {
            await ctx.TriggerTypingAsync();

            if (!(Server.GetServers(true, serverName)[0] is Server server))
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Server Not Found",
                                                                               $"{serverName} could not be found."));

                return;
            }

            var console = new RemoteConsole(server, @"C:\\Windows\\System32\\cmd.exe", "/c " + script,
                                            "Command Prompt - Script", true);

            await ctx.RespondAsync(embed : EmbedTemplates.CreateInfoEmbed("Live Output",
                                                                          $"To start the command, click [here]({console.GetUrl()})"));
        }
예제 #17
0
        public async System.Threading.Tasks.Task RconTask(string command)
        {
            await CommandContext.TriggerTypingAsync();

            if (Authentication.Service.Status.ServiceStatus != ServiceStatus.Running)
            {
                await CommandContext.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("Remote Console",
                                                                                          $"{Authentication.Service.NameNoHtml} is **Offline**"));

                return;
            }

            var server = new Server(Authentication.Service.ServerId);

            var rconResponse = server.GameAdminService.ExecuteRConCommand(Authentication.Service.ServiceId,
                                                                          Authentication.Service.Variables["RConPassword"].ToString(), command);

            rconResponse = rconResponse.Length > 1500 ? rconResponse.Substring(0, 1500) : rconResponse;
            await CommandContext.RespondAsync($"```yaml\n{rconResponse}\n```");
        }
예제 #18
0
        public async Task RunAllPowerShell(CommandContext ctx, [RemainingText] string script)
        {
            if (!script.StartsWith("```\n") && !script.EndsWith("```"))
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateErrorEmbed("PowerShell",
                                                                               "**No script found!** Example Script: ```\necho 'test'\n```"));

                return;
            }

            foreach (Server enabledServer in Server.GetEnabledServers())
            {
                if (enabledServer.IsMaster)
                {
                    continue;
                }

                await ServerPowerShell(ctx, enabledServer.Name, script);
            }
        }
        public async Task Signin(CommandContext ctx)
        {
            if (AccountsService.IsUserAuthenticated(ctx.User.Id))
            {
                await ctx.RespondAsync(
                    embed : EmbedTemplates.CreateErrorEmbed(description: "You are already logged in!"));

                return;
            }
            var user = AccountsService.GetUser(ctx.User.Id);

            if (user == null)
            {
                await AccountsService.SetupAccount(ctx);

                return;
            }

            await ctx.RespondAsync(embed : EmbedTemplates.CreateInfoEmbed("Login", "**You are already logged in**"));
        }
        public VirtualDirectorySecurity(TCAdmin.SDK.Web.References.FileSystem.FileSystem fileSystem,
                                        string currentDirectory, UserType type, int gameId)
        {
            UserType = type;
            if (!fileSystem.DirectoryExists(currentDirectory))
            {
                throw new CustomMessageException(EmbedTemplates.CreateErrorEmbed("Could not find directory."));
            }

            var game = new TCAdmin.GameHosting.SDK.Objects.Game(gameId);

            var ds = new TCAdmin.SDK.VirtualFileSystem.VirtualDirectorySecurity
            {
                PermissionMode   = PermissionMode.Basic,
                Permissions      = Permission.Read | Permission.Write | Permission.Delete,
                PermissionType   = PermissionType.Root,
                RootPhysicalPath = currentDirectory + "\\",
                RealPhysicalPath =
                    TCAdmin.SDK.Misc.FileSystem.FixAbsoluteFilePath(currentDirectory, OperatingSystem.Windows),
                DisableOwnerCheck    = true,
                DisableSymlinkCheck  = true,
                VirtualDirectoryName = currentDirectory
            };

            if (type == UserType.SubAdmin)
            {
                var f = game.FileSystemPermissions.FirstOrDefault(x => x.RootPhysicalPath == "$[SubAdminFiles]");
                ds.AdditionalPermissions = f.AdditionalPermissions;
                ds.Filters = f.Filters;
            }

            if (type == UserType.User)
            {
                var f = game.FileSystemPermissions.FirstOrDefault(x => x.RootPhysicalPath == "$[UserFiles]");
                ds.AdditionalPermissions = f.AdditionalPermissions;
                ds.Filters = f.Filters;
            }

            VirtualDirectorySecurityObject = ds;
            VirtualDirectorySecurityString = ObjectXml.ObjectToXml(ds);
        }
        private static async Task <Service> ChooseServiceFromList(CommandContext ctx, IReadOnlyList <Service> services)
        {
            var interactivity = ctx.Client.GetInteractivity();

            var serviceId      = 1;
            var servicesString = services.Aggregate(
                string.Empty,
                (current, service) =>
                current + $"**{serviceId++}**) {service.Name} **({service.IpAddress}:{service.GamePort})**\n");

            if (servicesString.Length >= 1900)
            {
                await interactivity.SendPaginatedMessageAsync(ctx.Channel, ctx.User,
                                                              interactivity.GeneratePagesInContent(servicesString));

                await ctx.RespondAsync(
                    embed : EmbedTemplates.CreateInfoEmbed("Tip!",
                                                           "When you have found the number of the server press the **STOP** Button then type the ID number."));
            }
            else
            {
                await ctx.RespondAsync(embed : EmbedTemplates.CreateInfoEmbed("Service Picker", servicesString));
            }

            var serviceOption =
                await interactivity.WaitForMessageAsync(x =>
                                                        x.Author.Id == ctx.User.Id && x.Channel.Id == ctx.Channel.Id);

            if (serviceOption.TimedOut)
            {
                throw new CustomMessageException(EmbedTemplates.CreateInfoEmbed("Timeout", ""));
            }

            if (int.TryParse(serviceOption.Result.Content, out var result) && result <= serviceId && result > 0)
            {
                return(services[result - 1]);
            }

            throw new CustomMessageException(EmbedTemplates.CreateErrorEmbed(description: "Not a number!"));
        }
        public static async Task <ServiceChartType> GetGraphType(CommandContext ctx)
        {
            var interactivity = ctx.Client.GetInteractivity();
            ServiceChartType chartType;

            const string options = "**1**) Players\n" +
                                   "**2**) CPU Usage\n" +
                                   "**3**) RAM Usage";
            await ctx.RespondAsync(
                embed : EmbedTemplates.CreateInfoEmbed("Selection", "**Please choose an option:**\n\n" + options));

            var graphChoice = await interactivity.WaitForMessageAsync(x => x.Author.Id == ctx.User.Id);

            switch (graphChoice.Result.Content.ToLower())
            {
            case "1":
                chartType = ServiceChartType.Players;
                break;

            case "2":
                chartType = ServiceChartType.Processor;
                break;

            case "3":
                chartType = ServiceChartType.Memory;
                break;

            default:
                await ctx.RespondAsync(
                    embed : EmbedTemplates.CreateErrorEmbed("Unknown Option", "Defaulting to Players graph"));

                chartType = ServiceChartType.Players;
                break;
            }

            return(chartType);
        }
예제 #23
0
        public async System.Threading.Tasks.Task InitializeFileManagerAsync()
        {
            var interactivity = CommandContext.Client.GetInteractivity();
            var waitMsg       = await CommandContext.RespondAsync("Please wait");

            if (!FileSystem.DirectoryExists(CurrentDirectory))
            {
                throw new CustomMessageException(EmbedTemplates.CreateErrorEmbed("Could not find directory"));
            }

            var embed = new DiscordEmbedBuilder
            {
                Title       = "File Manager", Color = new Optional <DiscordColor>(new DiscordColor(_settings.HexColor)),
                Description = $"**Navigating {CurrentDirectory}**\n\n",
                Thumbnail   = new DiscordEmbedBuilder.EmbedThumbnail
                {
                    Url = _settings.ThumbnailUrl
                }
            };

            embed = UpdateEmbedListing(embed);

            await waitMsg.DeleteAsync();

            ListingMessage = await CommandContext.RespondAsync(embed : embed);

            var      currentlyInFile = false;
            FileInfo currentFileInfo = null;

            while (true)
            {
                var choice = await interactivity.WaitForMessageAsync(x =>
                                                                     x.Author.Id == CommandContext.User.Id && x.Channel.Id == CommandContext.Channel.Id);

                if (choice.TimedOut)
                {
                    await ListingMessage.ModifyAsync(
                        embed : new Optional <DiscordEmbed>(
                            EmbedTemplates.CreateInfoEmbed("File Manager", "Ended Session")));

                    return;
                }

                var message = choice.Result.Content.ToLower();
                await choice.Result.DeleteAsync();

                if (_settings.ExitCommand.Contains(message))
                {
                    await ListingMessage.DeleteAsync();

                    return;
                }

                if (_settings.GoBackCommand.Contains(message))
                {
                    if (currentlyInFile)
                    {
                        CurrentListing  = FileSystemUtilities.NavigateCurrentFolder(currentFileInfo.Directory);
                        currentFileInfo = null;
                        currentlyInFile = false;
                        var updatedEmbed = UpdateEmbedListing(embed);
                        await ListingMessage.ModifyAsync(embed : updatedEmbed.Build());
                    }
                    else
                    {
                        if (IsServer)
                        {
                            CurrentListing   = FileSystemUtilities.NavigateBackFolder(CurrentDirectory + "\\");
                            CurrentDirectory = new DirectoryInfo(CurrentDirectory).Parent?.FullName + "\\";
                            var updatedEmbed = UpdateEmbedListing(embed);
                            await ListingMessage.ModifyAsync(embed : updatedEmbed.Build());

                            continue;
                        }

                        if (FileSystemUtilities.CanGoBack(CurrentDirectory + "\\",
                                                          AuthenticationService.Service.ServiceId) && !LockDirectory)
                        {
                            CurrentListing   = FileSystemUtilities.NavigateBackFolder(CurrentDirectory + "\\");
                            CurrentDirectory = new DirectoryInfo(CurrentDirectory).Parent?.FullName + "\\";
                            var updatedEmbed = UpdateEmbedListing(embed);
                            await ListingMessage.ModifyAsync(embed : updatedEmbed.Build());
                        }
                    }
                }

                else if (int.TryParse(message, out var index))
                {
                    if (currentlyInFile)
                    {
                        var fileAction = (FileSystemUtilities.EFileActions)index;
                        if (await FileSystemUtilities.FileAction(currentFileInfo, fileAction))
                        {
                            if (fileAction == FileSystemUtilities.EFileActions.Extract ||
                                fileAction == FileSystemUtilities.EFileActions.Delete)
                            {
                                CurrentListing = FileSystemUtilities.NavigateCurrentFolder(CurrentDirectory);
                                var updatedEmbed = UpdateEmbedListing(embed);
                                await ListingMessage.ModifyAsync(embed : updatedEmbed.Build());

                                currentlyInFile = false;
                                currentFileInfo = null;
                            }
                            else
                            {
                                var updatedEmbed = UpdateEmbedListing(currentFileInfo, embed);
                                await ListingMessage.ModifyAsync(embed : updatedEmbed.Build());
                            }
                        }

                        continue;
                    }

                    var type = FileSystemUtilities.GetListingType(int.Parse(message), CurrentListing);

                    if (type == FileSystemUtilities.EListingType.Directory)
                    {
                        CurrentDirectory = CurrentListing.Directories[index - 1].FullName + "\\";
                        CurrentListing   = FileSystemUtilities.NavigateNextFolder(index, CurrentListing);
                        var updatedEmbed = UpdateEmbedListing(embed);
                        await ListingMessage.ModifyAsync(embed : updatedEmbed.Build());
                    }
                    else
                    {
                        var fileInfo = FileSystemUtilities.GetFileInfo(index - CurrentListing.Directories.Length,
                                                                       CurrentListing);
                        currentFileInfo = fileInfo;
                        currentlyInFile = true;
                        var updatedEmbed = UpdateEmbedListing(fileInfo, embed);
                        await ListingMessage.ModifyAsync(embed : updatedEmbed.Build());
                    }
                }

                else if (char.TryParse(message, out var result))
                {
                    var action = ToEnum <FileSystemUtilities.EDirectoryActions>(result.ToString().ToUpper());

                    if (!Enum.IsDefined(typeof(FileSystemUtilities.EDirectoryActions), action))
                    {
                        await CommandContext.RespondAsync("Cannot execute option if does not exist.");

                        continue;
                    }

                    if (await FileSystemUtilities.DirectoryAction(action, CurrentListing, CurrentDirectory))
                    {
                        if (action == FileSystemUtilities.EDirectoryActions.DeleteFolder)
                        {
                            CurrentListing = FileSystemUtilities.NavigateBackFolder(CurrentDirectory);
                            var updatedEmbed = UpdateEmbedListing(embed);
                            await ListingMessage.ModifyAsync(embed : updatedEmbed.Build());
                        }
                        else
                        {
                            CurrentListing = FileSystemUtilities.NavigateCurrentFolder(CurrentDirectory);
                            var updatedEmbed = UpdateEmbedListing(embed);
                            await ListingMessage.ModifyAsync(embed : updatedEmbed.Build());
                        }
                    }
                    else
                    {
                        await CommandContext.RespondAsync("Error in refreshing directory");
                    }
                }
                else
                {
                    await CommandContext.RespondAsync("I don't know what you mean by " + message);
                }
            }
        }
예제 #24
0
 private void ThrowAccessDeniedError(string message = "")
 {
     throw new CustomMessageException(EmbedTemplates.CreateErrorEmbed("Access Denied", message));
 }