public RaidsService(IFilesRepository files, ResourceManager resource, IViewDiscordChannel viewDiscordChannel, IUnitOfWork database) { RaidsService.instance = this; this.files = files; this.resourceManager = resource; this.viewDiscordChannel = viewDiscordChannel; this.database = database; this.captainRoleName = resource.GetString("CaptainRoleName"); var config = new MapperConfiguration(cfg => { cfg.CreateMap <Raid, Raids>(); cfg.CreateMap <User, Users>(); }); this.mapperRaidToRaids = new Mapper(config); config = new MapperConfiguration(cfg => { cfg.AllowNullCollections = true; cfg.CreateMap <Raids, Raid>(); cfg.CreateMap <Users, User>(); }); this.mapperRaidsToRaid = new Mapper(config); config = new MapperConfiguration(cfg => { cfg.CreateMap <User, Users>(); }); this.mapperUserToUsers = new Mapper(config); config = new MapperConfiguration(cfg => { cfg.CreateMap <Users, User>(); }); this.mapperUsersToUser = new Mapper(config); LoadRaidsFromFie(); }
static async Task MainAsync(string[] args) { try { var bot = new MainBot.Bot(); await bot.Run(Secrets.botToken); var discordChannelView = new Views.Discord.DiscordChannelView(bot, GeneralResource.Prefix); var filesReposiroty = new DataAccess.Repositories.FilesReposiroty(ForFiles.ResourceManager); var dataBase = new DataAccess.Repositories.EFUnitOfWork(); var raidsService = new BusinessLogic.Services.RaidsService(filesReposiroty, RaidAssembling.ResourceManager, discordChannelView, dataBase); var discordMessagesService = new BusinessLogic.Services.DiscordMessagesService (GeneralResource.ResourceManager, DiscordMessagesCommands.ResourceManager, discordChannelView, filesReposiroty, dataBase, raidsService, Patterns.ResourceManager, DiscordMessageOutput.ResourceManager); await Task.Delay(-1); } catch (Exception ex) { Console.WriteLine($"\nEXCEPTION: {ex.Message}" + $"\n{ex.StackTrace}" + $"\n\n"); } }