public BotCore(BotConfig.Root botConfig) { Config = botConfig; Console.WriteLine(Config.DatabaseConfig.Hostname); _c = new DiscordClient(new DiscordConfiguration { LogLevel = LogLevel.Debug, ShardCount = 1, ShardId = 0, Token = "", TokenType = TokenType.Bot, UseInternalLogHandler = true }); //Singleton will be the same in every commandclass //For the others it dosent, use Transient for DB stuff in the future var serviceProvider = new ServiceCollection() .AddTransient <ServiceResolver>() .BuildServiceProvider(); _cnext = _c.UseCommandsNext(new CommandsNextConfiguration { EnableDefaultHelp = false, Services = serviceProvider, StringPrefixes = new[] { "b!" } }); _cnext.RegisterCommands <Commands.Debug>(); _cnext.RegisterCommands <Music.Commands.Music>(); _vnext = _c.UseVoiceNext(); _me = _c.UseMusic(); _dbe = _c.UseDatabase(); _cnext.CommandErrored += e => { Console.WriteLine(e.Exception); return(Task.CompletedTask); }; }
public IDbConnection GetOpenDbConnection() { return(DatabaseExtension.GetOpenConnection((NonEmptyString)"Main")); }