refactor: remove unnecessary checks (#6777)

This commit is contained in:
Bas950
2021-10-08 12:35:24 +02:00
committed by GitHub
parent d399a28323
commit e24209a8b1
7 changed files with 17 additions and 22 deletions

View File

@@ -57,8 +57,9 @@ class GuildStickerManager extends CachedManager {
* .catch(console.error);
*/
async create(file, name, tags, { description, reason } = {}) {
file = { ...(await MessagePayload.resolveFile(file)), key: 'file' };
if (!file) throw new TypeError('REQ_RESOURCE_TYPE');
const resolvedFile = await MessagePayload.resolveFile(file);
if (!resolvedFile) throw new TypeError('REQ_RESOURCE_TYPE');
file = { ...resolvedFile, key: 'file' };
const data = { name, tags, description: description ?? '' };