How to use the eris.Role 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 erisaaa / erisa / test / misc.spec.ts View on Github external
describe('formating `Role`', () => {
    const role = new Eris.Role(
      { id: '1234567890', name: 'foo', mentionable: true } as any,
      {} as any
    );

    test("shows the role's mention", () => {
      expect(client.format(role)).toBe(role.mention);
    });

    test("shows the role's name", () => {
      role.mentionable = false;
      expect(client.format(role)).toBe('foo');
    });
  });
github Yahweasel / craig / craig / eris-flavor.js View on Github external
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) {
        return new Promise((res, rej) => {
            process.send({"_sEval": cmd});

            function receiver(msg) {
                if (msg._sEval === cmd)
                    res(msg._result);
                else