public async Task <bool> Init(string[] args)
        {
            Settings = ServerSettings.Load();
            if (!await Settings.Init(args))
            {
                return(false);
            }
            Logger.Instance = new UnixLogger(webClient, Path.Combine(Settings.ServerDir, "log.csv"), Settings.WebHook);
            if (Settings.Test)
            {
                await Logger.WriteLine("Started in test mode");
            }
            await Logger.WriteLine(Settings.GitCommit);

            Api = new OsuApi(webClient, Settings.OsuId, Settings.OsuSecret, Settings.OsuApiKey);
            var apiToken = Api.RefreshToken();

            Directory.CreateDirectory(Path.Combine(Settings.ServerDir, "beatmaps"));
            Directory.CreateDirectory(Path.Combine(Settings.ServerDir, "replays"));
            BeatmapDb    = new ServerBeatmapDb(Api, Settings.ServerDir, Settings.Reload);
            ReplayDb     = new ServerReplayDb(Api, Settings.ServerDir);
            CachedMisses = new MemoryCache <ulong, Response>(128);
            CachedMisses.SetPolicy(typeof(LfuEvictionPolicy <,>));

            Discord = new DiscordShardedClient(new DiscordConfiguration
            {
                Token     = Settings.DiscordToken,
                TokenType = TokenType.Bot,
                Intents   = DiscordIntents.Guilds |
                            DiscordIntents.GuildMessages |
                            DiscordIntents.GuildMessageReactions |
                            DiscordIntents.DirectMessages |
                            DiscordIntents.DirectMessageReactions
            });
            var slash = await Discord.UseSlashCommandsAsync(new SlashCommandsConfiguration
            {
                Services = new ServiceCollection().AddSingleton(this).BuildServiceProvider(),
            });

            if (Settings.Test)
            {
                slash.RegisterCommands <Commands>(Settings.TestGuild);
            }
            else
            {
                slash.RegisterCommands <Commands>();
            }

            numberEmojis = new DiscordEmoji[10];

            for (int i = 0; i < 10; i++)
            {
                numberEmojis[i] = DiscordEmoji.FromUnicode(i + "\ufe0f\u20e3");
            }

            status = new Stopwatch();
            status.Start();

            Discord.MessageCreated += async(d, e) =>
            {
                await HandleMessage(d, e);
                await CheckStatus();
            };

            Discord.MessageReactionAdded += HandleReaction;

            Discord.ComponentInteractionCreated += HandleInteraction;

            Discord.ClientErrored += async(d, e) =>
            {
                await Logger.WriteLine(e.EventName);

                await Logger.LogException(e.Exception);
            };

            Discord.SocketErrored += async(d, e) =>
            {
                await Logger.LogException(e.Exception);
            };

            foreach (var s in slash)
            {
                s.Value.SlashCommandErrored += async(d, e) =>
                {
                    await Logger.WriteLine(e.Context.CommandName);

                    await Logger.LogException(e.Exception);
                };
            }
            Logger.Instance.UpdateLogs += () => Logger.LogAbsolute(Logging.ServersJoined, Discord.ShardClients.Select(s => s.Value.Guilds?.Count ?? 0).Sum());

            await apiToken;

            return(true);
        }
        public async Task <bool> Init(string[] args)
        {
            Settings = ServerSettings.Load();
            if (!await Settings.Init(args))
            {
                return(false);
            }
            Logger.Instance = new Logger(Path.Combine(Settings.ServerDir, "log.csv"), Settings.WebHook);
            Api             = new OsuApi(Settings.OsuId, Settings.OsuSecret, Settings.OsuApiKey);
            var apiToken = Api.RefreshToken();

            Directory.CreateDirectory(Path.Combine(Settings.ServerDir, "beatmaps"));
            Directory.CreateDirectory(Path.Combine(Settings.ServerDir, "replays"));
            BeatmapDb    = new ServerBeatmapDb(Api, Settings.ServerDir, Settings.Reload);
            ReplayDb     = new ServerReplayDb(Api, Settings.ServerDir);
            CachedMisses = new MemoryCache <DiscordMessage, SavedMiss>(128);
            CachedMisses.SetPolicy(typeof(LfuEvictionPolicy <,>));

            Discord = new DiscordClient(new DiscordConfiguration
            {
                Token     = Settings.DiscordToken,
                TokenType = TokenType.Bot
            });

            numberEmojis = new DiscordEmoji[10];

            for (int i = 0; i < 10; i++)
            {
                numberEmojis[i] = DiscordEmoji.FromName(Discord, $":{numbers[i]}:");
            }

            status = new Stopwatch();
            status.Start();

            Discord.MessageCreated += async(d, e) =>
            {
                await HandleMessage(d, e);
                await CheckStatus();
            };

            Discord.MessageReactionAdded += HandleReaction;

            Discord.ClientErrored += async(d, e) =>
            {
                Logger.Log(Logging.ErrorUnhandled);
                await Logger.WriteLine(e.EventName);

                await Logger.WriteLine(e.Exception, Logger.LogLevel.ALERT);
            };

            Discord.SocketErrored += async(d, e) =>
            {
                Logger.Log(Logging.ErrorUnhandled);
                await Logger.WriteLine(e.Exception, Logger.LogLevel.ALERT);

                await d.ConnectAsync();
            };

            Logger.Instance.UpdateLogs += () => Logger.LogAbsolute(Logging.ServersJoined, Discord?.Guilds?.Count ?? 0);
            await apiToken;

            return(true);
        }