public BlacklistService(IDependencyMap dependencies) { Client = dependencies.Get <DiscordSocketClient>(); Database = dependencies.Get <BotDbContext>(); Client.GuildAvailable += CheckBlacklist(false); Client.JoinedGuild += CheckBlacklist(true); }
public Owner(Bot bot, CounterSet counters, BotDbContext db, LogService logs, DiscordSocketClient client) : base(db) { Bot = bot; Counters = counters; LogService = logs; Client = client; }
async Task Run() { Log.Info($"Starting..."); using (var database = new BotDbContext()) { await Initialize(database); while (!ExitSource.Task.IsCompleted) { try { await MainLoop(); } catch (Exception error) { Log.Error(error); } } } }
async Task Initialize(BotDbContext db) { if (_initialized) { return; } StartTime = DateTime.Now; Log.Info("Initializing..."); var config = new DiscordSocketConfig(); Client = new DiscordSocketClient(config); var CommandService = new CommandService(); var map = new DependencyMap(); map.Add(this); map.Add(map); map.Add(Client); map.Add(db); map.Add(new CounterSet(new ActivatorFactory <SimpleCounter>())); map.Add(new LogSet()); map.Add(new DatabaseService(map)); map.Add(new LogService(map, ExecutionDirectory)); map.Add(new CounterService(map)); map.Add(CommandService); await CommandService.AddModulesAsync(Assembly.GetEntryAssembly()); map.Add(new BotCommandService(map)); map.Add(new TempService(map)); map.Add(new BlacklistService(map)); map.Add(new AnnounceService(map)); map.Add(new SearchService(map)); _initialized = true; }
public Blacklist(BotDbContext db) : base(db) { }
protected DatabaseHouraiModule(BotDbContext db) { Database = db; }
public SearchService(IDependencyMap map) { Logs = map.Get <LogSet>(); Database = map.Get <BotDbContext>(); }