Esempio n. 1
0
        private async Task Run()
        {
            Console.OutputEncoding = Encoding.Unicode;
            await PrintInfoAsync();

            using (var db = new NeoContext()) {
                db.Database.EnsureCreated();
            }
            EnsureConfigExists();

            _client = new DiscordSocketClient(new DiscordSocketConfig {
                LogLevel         = LogSeverity.Info,
                MessageCacheSize = 5000
            });

            await _client.LoginAsync(TokenType.Bot, Configuration.Load().Token);

            await NeoConsole.Append("Logging in...", ConsoleColor.Cyan);

            await _client.StartAsync();

            await NeoConsole.NewLine("Success...", ConsoleColor.Cyan);

            _services = new ServiceCollection()
                        .AddSingleton(_client)
                        .AddSingleton <CommandHandler>()
                        .AddSingleton <InteractiveService>()
                        .BuildServiceProvider();
            await NeoConsole.NewLine("Activating Services...\nDone.", ConsoleColor.Cyan);

            await _services.GetRequiredService <CommandHandler>().Install(_client, _services);

            await NeoConsole.NewLine("Command Handler starting...\nDone.\n", ConsoleColor.Cyan);

            _client.Log   += Log;
            _client.Ready += _client_Ready;

            await Task.Delay(-1);
        }
Esempio n. 2
0
        private static async Task PrintInfoAsync()
        {
            var art = new[] {
                @"███████╗███████╗███████╗██████╗  ██████╗ ████████╗██████╗ ███████╗██████╗ ██╗   ██╗██╗  ██╗",
                @"██╔════╝██╔════╝╚══███╔╝██╔══██╗██╔═══██╗╚══██╔══╝██╔══██╗██╔════╝██╔══██╗██║   ██║╚██╗██╔╝",
                @"█████╗  █████╗    ███╔╝ ██████╔╝██║   ██║   ██║   ██████╔╝█████╗  ██║  ██║██║   ██║ ╚███╔╝ ",
                @"██╔══╝  ██╔══╝   ███╔╝  ██╔══██╗██║   ██║   ██║   ██╔══██╗██╔══╝  ██║  ██║██║   ██║ ██╔██╗ ",
                @"██║     ███████╗███████╗██████╔╝╚██████╔╝   ██║   ██║  ██║███████╗██████╔╝╚██████╔╝██╔╝ ██╗",
                @"╚═╝     ╚══════╝╚══════╝╚═════╝  ╚═════╝    ╚═╝   ╚═╝  ╚═╝╚══════╝╚═════╝  ╚═════╝ ╚═╝  ╚═╝",
                @"                                                                                           "
            };

            foreach (var line in art)
            {
                await NeoConsole.NewLineArt(line, ConsoleColor.DarkMagenta);
            }
            await NeoConsole.Append("\n        +-------------------------------------------------------------------------+", ConsoleColor.Gray);

            await NeoConsole.Append("\n           Source Code(Github Repo): https://github.com/EchelonDev/NeoKapcho/      ", ConsoleColor.Yellow);

            await NeoConsole.Append("\n                 Build with love by 48 | Powered by SQLite and EFCore              ", ConsoleColor.Red);

            await NeoConsole.Append("\n        +-------------------------------------------------------------------------+", ConsoleColor.Gray);
        }