Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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) {
odf(esp, "send", function(){return process.send.apply(process, arguments);});
odf(esp, "broadcastEval", function (cmd) {
describe('formatting `Member`', () => {
const member = new Eris.Member({ nick: 'Foo' } as any, null as any);
member.user = { username: 'foo', discriminator: '0000' } as any;
test("shows the member's nickname", () => {
expect(client.format(member)).toBe('Foo#0000');
});
test("shows the member's username", () => {
member.nick = undefined;
expect(client.format(member)).toBe('foo#0000');
});
test("doesn't show the member's discriminator", () => {
member.nick = 'Foo';
expect(client.format(member, { alt: true })).toBe('Foo');
member.nick = 'foo';