Ejemplo n.º 1
0
        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
            });
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 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()
         };
     }));
 }
Ejemplo n.º 4
0
        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;
 }