public async Task UpdateAutoproxy(SystemId system, ulong?guildId, ulong?channelId, AutoproxyPatch patch) { var locationStr = guildId != null ? "guild" : (channelId != null ? "channel" : "global"); _logger.Information("Updated autoproxy for {SystemId} in location {location}: {@AutoproxyPatch}", system, locationStr, patch); var query = patch.Apply(new Query("autoproxy") .Where("system", system) .Where("guild_id", guildId ?? 0) .Where("channel_id", channelId ?? 0) ); _ = _dispatch.Dispatch(system, guildId, channelId, patch); await _db.ExecuteQuery(query); }
public Task <AutoproxySettings> UpdateAutoproxy(SystemId system, ulong?guildId, ulong?channelId, AutoproxyPatch patch) { var locationStr = guildId != null ? "guild" : (channelId != null ? "channel" : "global"); _logger.Information("Updated autoproxy for {SystemId} in location {location}: {@AutoproxyPatch}", system, locationStr, patch); var query = patch.Apply(new Query("autoproxy") .Where("system", system) .Where("guild_id", guildId ?? 0) .Where("channel_id", channelId ?? 0) ); _ = _dispatch.Dispatch(system, guildId, channelId, patch); return(_db.QueryFirst <AutoproxySettings>(query, "returning *")); }