Skip to content

Commit

Permalink
refactor: switch to /builders Embed (#7067)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranet committed Jan 24, 2022
1 parent 2f16f87 commit d2d3a80
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 729 deletions.
2 changes: 1 addition & 1 deletion .github/COMMIT_CONVENTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Other prefixes are up to your discretion. Suggested prefixes are `docs`, `chore`

### Scope

The scope could be anything specifying the place of the commit change. For example `GuildMember`, `Guild`, `Message`, `MessageEmbed` etc...
The scope could be anything specifying the place of the commit change. For example `GuildMember`, `Guild`, `Message`, `TextChannel` etc...

### Subject

Expand Down
7 changes: 0 additions & 7 deletions packages/discord.js/src/errors/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ const Messages = {

INVITE_OPTIONS_MISSING_CHANNEL: 'A valid guild channel must be provided when GuildScheduledEvent is EXTERNAL.',

EMBED_TITLE: 'MessageEmbed title must be a string.',
EMBED_FIELD_NAME: 'MessageEmbed field names must be non-empty strings.',
EMBED_FIELD_VALUE: 'MessageEmbed field values must be non-empty strings.',
EMBED_FOOTER_TEXT: 'MessageEmbed footer text must be a string.',
EMBED_DESCRIPTION: 'MessageEmbed description must be a string.',
EMBED_AUTHOR_NAME: 'MessageEmbed author name must be a string.',

BUTTON_LABEL: 'MessageButton label must be a string',
BUTTON_URL: 'MessageButton URL must be a string',
BUTTON_CUSTOM_ID: 'MessageButton customId must be a string',
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ exports.Collector = require('./structures/interfaces/Collector');
exports.CommandInteractionOptionResolver = require('./structures/CommandInteractionOptionResolver');
exports.ContextMenuCommandInteraction = require('./structures/ContextMenuCommandInteraction');
exports.DMChannel = require('./structures/DMChannel');
exports.Embed = require('@discordjs/builders').Embed;
exports.Emoji = require('./structures/Emoji').Emoji;
exports.Guild = require('./structures/Guild').Guild;
exports.GuildAuditLogs = require('./structures/GuildAuditLogs');
Expand All @@ -115,7 +116,6 @@ exports.MessageAttachment = require('./structures/MessageAttachment');
exports.MessageCollector = require('./structures/MessageCollector');
exports.MessageComponentInteraction = require('./structures/MessageComponentInteraction');
exports.MessageContextMenuCommandInteraction = require('./structures/MessageContextMenuCommandInteraction');
exports.MessageEmbed = require('./structures/MessageEmbed');
exports.MessageMentions = require('./structures/MessageMentions');
exports.MessagePayload = require('./structures/MessagePayload');
exports.MessageReaction = require('./structures/MessageReaction');
Expand Down
9 changes: 4 additions & 5 deletions packages/discord.js/src/structures/Message.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
'use strict';

const { createComponent } = require('@discordjs/builders');
const { createComponent, Embed } = require('@discordjs/builders');
const { Collection } = require('@discordjs/collection');
const { DiscordSnowflake } = require('@sapphire/snowflake');
const { InteractionType, ChannelType, MessageType } = require('discord-api-types/v9');
const Base = require('./Base');
const ClientApplication = require('./ClientApplication');
const InteractionCollector = require('./InteractionCollector');
const MessageAttachment = require('./MessageAttachment');
const Embed = require('./MessageEmbed');
const Mentions = require('./MessageMentions');
const MessagePayload = require('./MessagePayload');
const ReactionCollector = require('./ReactionCollector');
Expand Down Expand Up @@ -128,9 +127,9 @@ class Message extends Base {
if ('embeds' in data) {
/**
* A list of embeds in the message - e.g. YouTube Player
* @type {MessageEmbed[]}
* @type {Embed[]}
*/
this.embeds = data.embeds.map(e => new Embed(e, true));
this.embeds = data.embeds.map(e => new Embed(e));
} else {
this.embeds = this.embeds?.slice() ?? [];
}
Expand Down Expand Up @@ -632,7 +631,7 @@ class Message extends Base {
* Options that can be passed into {@link Message#edit}.
* @typedef {Object} MessageEditOptions
* @property {?string} [content] Content to be edited
* @property {MessageEmbed[]|APIEmbed[]} [embeds] Embeds to be added/edited
* @property {Embed[]|APIEmbed[]} [embeds] Embeds to be added/edited
* @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content
* @property {MessageFlags} [flags] Which flags to set for the message. Only `SUPPRESS_EMBEDS` can be edited.
* @property {MessageAttachment[]} [attachments] An array of attachments to keep,
Expand Down
Loading

0 comments on commit d2d3a80

Please sign in to comment.