How to use the eris.User 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
test('uses the alt mode', () => {
      const formatter: Formatter = (user, alt) =>
        alt ? user.id : user.mention;
      const user = new Eris.User({ id: '1234567890' } as any, client);

      expect(client.format(user, { formatter, alt: true })).toBe(user.id);
    });
  });
github erisaaa / erisa / test / misc.spec.ts View on Github external
test('gets called instead of default formatter', () => {
      const formatter: Formatter = user => user.mention;
      const user = new Eris.User({ id: '1234567890' } as any, client);

      expect(client.format(user, { formatter })).toBe(user.mention);
    });
github erisaaa / erisa / test / misc.spec.ts View on Github external
describe('formatting `User`', () => {
    const user = new Eris.User(
      { username: 'foo', discriminator: '0000' } as any,
      client
    );

    test("shows the user's full tag", () => {
      expect(client.format(user)).toBe('foo#0000');
    });

    test("doesn't show the user's discriminator", () => {
      expect(client.format(user, { alt: true })).toBe('foo');
    });
  });
github Yahweasel / craig / craig / eris-flavor.js View on Github external
process.send({"_sEval": cmd});

            function receiver(msg) {
                if (msg._sEval === cmd)
                    res(msg._result);
                else
                    process.once("message", receiver);
            }
            process.once("message", receiver);
        });
    });
})(Eris.Shard.prototype);

Eris.TextChannel.prototype.send = Eris.TextChannel.prototype.createMessage;

odf(Eris.User.prototype, "send", function () {
    const args = arguments;
    const user = this;
    return new Promise((res, rej) => {
        user.getDMChannel().then((channel) => {
            channel.createMessage.apply(channel, args).then(res).catch(rej);
        }).catch(rej);
    });
});

odg(Eris.VoiceChannel.prototype, "joinable", function(){return this.permissionsOf(this.guild.shard.client.user.id).has("voiceConnect");});
odg(Eris.VoiceChannel.prototype, "members", function(){return this.voiceMembers;});

odg(Eris.VoiceConnection.prototype, "channel", function () {
    var ret = this.flavorSavedChannel;
    if (!ret)
        ret = this.flavorSavedChannel = this.shard.client.guilds.get(this.id).channels.get(this.channelID);