예제 #1
0
        public IHitOutput FromOptions(HitOutputOptions options)
        {
            IHitOutput output = options switch
            {
                DatabaseHitOutputOptions _ => new DatabaseHitOutput(hitRepo),
                FileSystemHitOutputOptions x => new FileSystemHitOutput(x.BaseDir),
                DiscordWebhookHitOutputOptions x => new DiscordWebhookHitOutput(x.Webhook, x.Username, x.AvatarUrl),
                _ => throw new NotImplementedException()
            };

            return(output);
        }
    }
예제 #2
0
        public IHitOutput FromOptions(HitOutputOptions options)
        {
            IHitOutput output = options switch
            {
                DatabaseHitOutputOptions _ => new DatabaseHitOutput(hitStorage),
                FileSystemHitOutputOptions x => new FileSystemHitOutput(x.BaseDir),
                DiscordWebhookHitOutputOptions x => new DiscordWebhookHitOutput(x.Webhook, x.Username, x.AvatarUrl),
                TelegramBotHitOutputOptions x => new TelegramBotHitOutput(x.ApiServer, x.Token, x.ChatId),
                CustomWebhookHitOutputOptions x => new CustomWebhookHitOutput(x.Url, x.User),
                _ => throw new NotImplementedException()
            };

            return(output);
        }
    }