diff --git a/src/client/ClientDataResolver.js b/src/client/ClientDataResolver.js index f8f027e0d..60870d8c0 100644 --- a/src/client/ClientDataResolver.js +++ b/src/client/ClientDataResolver.js @@ -99,23 +99,6 @@ class ClientDataResolver { return guild.members.get(user.id) || null; } - /** - * Data that resolves to give a Base64 string, typically for image uploading. This can be: - * * A Buffer - * * A Base64 string - * @typedef {Buffer|string} Base64Resolvable - */ - - /** - * Resolves a Base64Resolvable to a Base 64 image - * @param {Base64Resolvable} data The base 64 resolvable you want to resolve - * @returns {?string} - */ - resolveBase64(data) { - if (data instanceof Buffer) return `data:image/jpg;base64,${data.toString('base64')}`; - return data; - } - /** * Data that can be resolved to give a Channel. This can be: * * An instance of a Channel @@ -138,6 +121,26 @@ class ClientDataResolver { return null; } + /** + * Data that can be resolved to give an invite code. This can be: + * * An invite code + * * An invite URL + * @typedef {string} InviteResolvable + */ + + /** + * Resolves InviteResolvable to an invite code + * @param {InviteResolvable} data The invite resolvable to resolve + * @returns {string} + */ + resolveInviteCode(data) { + const inviteRegex = /discord(?:app)?\.(?:gg|com\/invite)\/([a-z0-9]{5})/i; + const match = inviteRegex.exec(data); + + if (match && match[1]) return match[1]; + return data; + } + /** * Data that can be resolved to give a permission number. This can be: * * A string @@ -206,22 +209,19 @@ class ClientDataResolver { } /** - * Data that can be resolved to give an invite code. This can be: - * * An invite code - * * An invite URL - * @typedef {string} InviteResolvable + * Data that resolves to give a Base64 string, typically for image uploading. This can be: + * * A Buffer + * * A Base64 string + * @typedef {Buffer|string} Base64Resolvable */ /** - * Resolves InviteResolvable to an invite code - * @param {InviteResolvable} data The invite resolvable to resolve - * @returns {string} + * Resolves a Base64Resolvable to a Base 64 image + * @param {Base64Resolvable} data The base 64 resolvable you want to resolve + * @returns {?string} */ - resolveInviteCode(data) { - const inviteRegex = /discord(?:app)?\.(?:gg|com\/invite)\/([a-z0-9]{5})/i; - const match = inviteRegex.exec(data); - - if (match && match[1]) return match[1]; + resolveBase64(data) { + if (data instanceof Buffer) return `data:image/jpg;base64,${data.toString('base64')}`; return data; }