How to use the eris.Guild 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
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) {
github erisaaa / erisa / test / misc.spec.ts View on Github external
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');
    });
  });