How to use the eris.Member function in eris

To help you get started, we’ve selected a few eris examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Yahweasel / craig / craig / eris-flavor.js View on Github external
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) {
github erisaaa / erisa / test / misc.spec.ts View on Github external
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';