/// <summary> /// CStor. /// </summary> /// <param name="service"></param> public MOTDModule(MOTDTimerService service) { _service = service; // if the timer is not already running add an event handler if (!Globals.TIMERRUNNING) { _service.MOTDTimerFired += _service_MOTDTimerFired; } }
/// <summary> /// Loads the bots modules and sets some events. /// </summary> /// <param name="c"></param> /// <returns></returns> public async Task Install(DiscordSocketClient c) { _logcommands = BotConfiguration.Load().LogCommands; _da = new DataAccess(); _client = c; // Save an instance of the discord client. _cmds = new CommandService(); // Create a new instance of the commandservice. _timer = new MOTDTimerService(); // Create an instance of our MOTD timer service. await _cmds.AddModulesAsync(Assembly.GetEntryAssembly()); // Load all modules from the assembly. _client.MessageReceived += MessageReceived; // Register the messagereceived event to handle commands. _client.Connected += _client_Connected; _client.Disconnected += _client_Disconnected; }