Remove RichEmbed in favour of MessageEmbed (#1584)

* remove RichEmbed in favour of MessageEmbed

* fix provider typo
This commit is contained in:
Drahcirius
2017-07-03 18:53:22 -04:00
committed by Crawl
parent c42e53d70d
commit b1d9084345
7 changed files with 63 additions and 249 deletions

View File

@@ -1,12 +1,15 @@
const Util = require('../../util/Util');
const Embed = require('../MessageEmbed');
const { RangeError } = require('../../errors');
module.exports = function sendMessage(channel, options) {
module.exports = function sendMessage(channel, options) { // eslint-disable-line complexity
const User = require('../User');
const GuildMember = require('../GuildMember');
if (channel instanceof User || channel instanceof GuildMember) return channel.createDM().then(dm => dm.send(options));
let { content, nonce, reply, code, disableEveryone, tts, embed, files, split } = options;
if (embed) embed = new Embed(embed)._apiTransform();
if (typeof nonce !== 'undefined') {
nonce = parseInt(nonce);
if (isNaN(nonce) || nonce < 0) throw new RangeError('MESSAGE_NONCE_TYPE');