Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (member)
return new Promise((res)=>{res(member);});
return new Promise((res, rej) => {
this.fetchMembers().then(() => {res(guild.members.get(id));}).catch(rej);
});
});
odf(egp, "fetchMembers", function () {
// There's no good way to simulate this
const guild = this;
this.fetchAllMembers();
return new Promise((res, rej) => {
setTimeout(()=>{res(guild);}, 1000);
});
});
odg(egp, "voiceConnection", function(){return this.shard.client.voiceConnections.get(this.id);});
})(Eris.Guild.prototype);
odg(Eris.Member.prototype, "voiceChannel", function(){return this.voiceState.channelID?(this.guild.channels.get(this.voiceState.channelID)):undefined;});
odg(Eris.Message.prototype, "guild", function(){return this.channel.guild;});
odf(Eris.Message.prototype, "reply", function(content){return this.channel.send(this.author.mention + ", " + content);});
Eris.PrivateChannel.prototype.send = Eris.PrivateChannel.prototype.createMessage;
odg(Eris.Role.prototype, "members", function () {
const role = this;
return this.guild.members.filter((member) => {
return member.roles.includes(role.id);
});
});
(function (esp) {
describe('formatting `Guild`', () => {
const guild = new Eris.Guild({ name: 'foo' } as any, client);
test("shows the guild's name", () => {
expect(client.format(guild)).toBe('foo');
});
});