/** * Checks if the voice channel is full * @type {boolean} * @readonly */ get full() { return this.userLimit > 0 && this.members.size >= this.userLimit; }
it('.emit()', async function() { expect(emitter.emit('a')).to.be.a('promise'); const array = []; emitter.on('a', () => array.push(1)); emitter.on('a', async () => { await timeout(10); array.push(2); }); emitter.on('a', () => array.push(3)); expect(await emitter.emit('a')).to.be.true; expect(array).to.have.ordered.members([1, 2, 3]); });
/** * Gets the overall set of permissions for a member or role in this channel, taking into account channel overwrites. * @param {GuildMemberResolvable|RoleResolvable} memberOrRole The member or role to obtain the overall permissions for * @returns {?Readonly<Permissions>} */ permissionsFor(memberOrRole) { const member = this.guild.members.resolve(memberOrRole); if (member) return this.memberPermissions(member); const role = this.guild.roles.resolve(memberOrRole); if (role) return this.rolePermissions(role); return null; }
it('.emitParallel() - stopPropagation', async function() { const array = []; emitter.on('a', async e => { e.stopPropagation(); array.push(1); }); emitter.on('a', () => array.push(2)); expect(await emitter.emitParallel('a')).to.be.false; expect(array).to.have.ordered.members([1, 2]); });
/** * The owner of this team * @type {?TeamMember} * @readonly */ get owner() { return this.members.get(this.ownerID) || null; }
it('.eventNames()', function() { const listener = () => {}; expect(emitter.eventNames()).to.have.lengthOf(0); emitter.on('a', listener); emitter.on('b', listener); expect(emitter.eventNames()).to.have.ordered.members(['a', 'b']); emitter.off('a', listener); expect(emitter.eventNames()).to.have.ordered.members(['b']); });
/** * The member that this voice state belongs to * @type {?GuildMember} * @readonly */ get member() { return this.guild.members.cache.get(this.id) || null; }
/** * Fetches this GuildMember. * @param {boolean} [force=false] Whether to skip the cache check and request the API * @returns {Promise<GuildMember>} */ fetch(force = false) { return this.guild.members.fetch({ user: this.id, cache: true, force }); }
it('.emitSync() - stopPropagation', async function() { const array = []; emitter.on('a', e => { e.stopPropagation(); array.push(1); }); emitter.on('a', () => array.push(2)); expect(emitter.emitSync('a')).to.be.false; expect(array).to.have.ordered.members([1]); });
it('.emit() - stopPropagation', async function() { const array = []; emitter.on('a', async e => { e.stopPropagation(); array.push(1); }); emitter.on('a', () => array.push(2)); expect(await emitter.emit('a')).to.be.false; expect(array).to.have.ordered.members([1]); });
it('.emitParallel() - stopPropagation', async function() { const array = []; emitter.on('a', async e => { e.stopPropagation(); array.push(1); }); emitter.on('a', () => array.push(2)); expect(await emitter.emitParallel('a')).to.be.false; expect(array).to.have.ordered.members([1, 2]); });
it('.emit()', async function() { expect(emitter.emit('a')).to.be.a('promise'); const array = []; emitter.on('a', () => array.push(1)); emitter.on('a', async () => { await timeout(10); array.push(2); }); emitter.on('a', () => array.push(3)); expect(await emitter.emit('a')).to.be.true; expect(array).to.have.ordered.members([1, 2, 3]); });
it('.emit() - stopPropagation', async function() { const array = []; emitter.on('a', async e => { e.stopPropagation(); array.push(1); }); emitter.on('a', () => array.push(2)); expect(await emitter.emit('a')).to.be.false; expect(array).to.have.ordered.members([1]); });
it('.eventNames()', function() { const listener = () => {}; expect(emitter.eventNames()).to.have.lengthOf(0); emitter.on('a', listener); emitter.on('b', listener); expect(emitter.eventNames()).to.have.ordered.members(['a', 'b']); emitter.off('a', listener); expect(emitter.eventNames()).to.have.ordered.members(['b']); });