diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index db71485bb5ea..3f450bfb5f9d 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -588,6 +588,7 @@ class GuildChannel extends Channel { reason: null, }, options, + 0, ); return this.guild.channels.create(options.name, options); } diff --git a/src/util/Util.js b/src/util/Util.js index 9df2f0935591..1a982aeccca7 100644 --- a/src/util/Util.js +++ b/src/util/Util.js @@ -307,16 +307,18 @@ class Util { * Sets default properties on an object that aren't already specified. * @param {Object} def Default properties * @param {Object} given Object to assign defaults to + * @param {number} [maxDepth=Infinity] The maximum depth to check properties for * @returns {Object} * @private */ - static mergeDefault(def, given) { + static mergeDefault(def, given, maxDepth = Infinity) { + if (maxDepth < 0) return given; if (!given) return def; for (const key in def) { if (!has(given, key) || given[key] === undefined) { given[key] = def[key]; } else if (given[key] === Object(given[key])) { - given[key] = Util.mergeDefault(def[key], given[key]); + given[key] = Util.mergeDefault(def[key], given[key], maxDepth - 1); } }