guild wrapper compatibility

This commit is contained in:
Erik 2022-03-15 02:02:56 +02:00
parent 62d2fe48ab
commit 4eedd21e62
No known key found for this signature in database
GPG Key ID: FEFF4B220DDF5589

View File

@ -4,6 +4,7 @@ const DiscordClient = require('../DiscordClient');
// eslint-disable-next-line no-unused-vars
const Component = require('../interfaces/Component');
const { Constants: { InfractionResolves } } = require('../../constants');
const { GuildWrapper } = require('./wrappers');
class Resolver {
@ -150,6 +151,7 @@ class Resolver {
if (!(resolveables instanceof Array)) resolveables = [resolveables];
if (resolveables.length === 0) return [];
if (!guild) throw new Error('Missing guild');
if (guild instanceof GuildWrapper) ({ guild } = guild);
const { roles } = guild;
const resolved = [];
@ -218,6 +220,8 @@ class Resolver {
if (typeof resolveables === 'string') resolveables = [resolveables];
if (resolveables.length === 0) return [];
if (!guild) throw new Error('Missing guild');
if (guild instanceof GuildWrapper) ({ guild } = guild);
const CM = guild.channels;
const resolved = [];