public ServiceInfo GetServiceInfo() { var proc = Process.GetCurrentProcess(); return(new ServiceInfo { ServiceName = _hostingEnvironment.ApplicationName, Environment = _hostingEnvironment.EnvironmentName, ProcessName = proc.ProcessName, StartTime = proc.StartTime, CommandSuccesses = _messageReceiver.CommandSuccesses, CommandFailures = _messageReceiver.CommandFailures, Guilds = _discord.Guilds.Count, Users = _discord.Guilds.Select(a => a.MemberCount).Sum(), Channels = _discord.Guilds.Select(a => a.TextChannels.Count + a.VoiceChannels.Count).Sum(), Modules = _commandService.GetAllModules().Count, Commands = _commandService.GetAllCommands().Count, OperatingSystem = Environment.OSVersion.VersionString, MachineName = Environment.MachineName, ProcessorCount = Environment.ProcessorCount, CurrentThreadId = Environment.CurrentManagedThreadId, RuntimeVersion = Environment.Version.ToString(), Culture = CultureInfo.InstalledUICulture.EnglishName, ContentRootPath = _hostingEnvironment.ContentRootPath, AddonsLoaded = _addons.GetAllAddons().Count }); }
public static string?Levenshtein(this string original, ICommandService cmdsrvc) { if (original.Length < 3) { return(null); } var commands = cmdsrvc.GetAllCommands().ToList(); var cmds = commands.Select(cmd => cmd.Name).ToList(); return(original.Levenshtein(cmds)); }
public IEnumerable <CommandInfo> GetCommands() { return(_service.GetAllCommands().Select(a => { return new CommandInfo { Aliases = a.Aliases.ToArray(), Checks = a.Checks.Select(a => a.GetType().Name).ToArray(), Enabled = a.IsEnabled, Module = a.Module.Name, Parameters = a.Parameters.Select(c => c.Name).ToArray() }; })); }
public async Task <ActionResult> Command_GetAbyssInfoAsync() { var dotnetVersion = Assembly.GetEntryAssembly()?.GetCustomAttribute <TargetFrameworkAttribute>()?.FrameworkName ?? ".NET Core"; var app = await Context.Client.GetApplicationInfoAsync().ConfigureAwait(false); var response = new EmbedBuilder { ThumbnailUrl = Context.Client.CurrentUser.GetEffectiveAvatarUrl(), Description = string.IsNullOrEmpty(app.Description) ? "None" : app.Description, Author = new EmbedAuthorBuilder { Name = $"Information about {_config.Name}", IconUrl = Context.Bot.GetEffectiveAvatarUrl() } }; response .AddField("Uptime", DateTime.Now - Process.GetCurrentProcess().StartTime) .AddField("Heartbeat", Context.Client.Latency + "ms", true) .AddField("Commands", _commandService.GetAllCommands().Count(), true) .AddField("Modules", _commandService.GetAllModules().Count(), true) .AddField("Source", $"https://github.com/abyssal512/Abyss"); if (!string.IsNullOrWhiteSpace(_config.Connections.Discord.SupportServer)) { response.AddField("Support Server", _config.Connections.Discord.SupportServer, true); } response .AddField("Language", $"C# 7.1 ({dotnetVersion})") .AddField("Libraries", $"Discord.Net {DiscordConfig.Version} w/ Qmmands"); return(Ok(response)); }
public ActionResult <IEnumerable <CommandReadDto> > GetAllCommands() { return(Ok(_mapper.Map <IEnumerable <CommandReadDto> >(_commandService.GetAllCommands()))); }
public async Task<IEnumerable<CommandDto>> GetAllCommands() { var commandItems = await _service.GetAllCommands(); return commandItems; }