private async Task RaiseConfigUpdatedEventAsync() { await Logger.RaiseAsync(LogSeverity.Debug, $"Command config updated {Config.Source.ToString().ToLower()} {Config.Name}"); ConfigUpdated?.Invoke(_config.Id, _config); }
private async Task AddCommandHandlerIfNotExistsAsync(IEntity <ulong> source) { switch (source) { case SocketGuild guild: if (!_commandHandlers.ContainsKey(guild.Id)) { await AddCommandHandlerAsync(new CommandConfigBuilder(await GetCommandConfigFromProviderAsync(CommandSource.Guild, guild.Id)) { Id = guild.Id, Name = guild.Name, Source = CommandSource.Guild }.Build(), _services, _guildModules); } break; case IDMChannel channel: if (!_commandHandlers.ContainsKey(channel.Recipient.Id)) { await AddCommandHandlerAsync(new CommandConfigBuilder(await GetCommandConfigFromProviderAsync(CommandSource.User, channel.Recipient.Id)) { Id = channel.Recipient.Id, Name = channel.Recipient.Username, Source = CommandSource.User }.Build(), _services, _dmModules); } break; default: await _log.RaiseAsync(LogSeverity.Warning, $"Can't add command handler with unknown source"); break; } }