diff --git a/commands/events/apod.js b/commands/events/apod.js index 1d5f3f1e..6bcc6864 100644 --- a/commands/events/apod.js +++ b/commands/events/apod.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const request = require('node-superfetch'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { shorten } = require('../../util/Util'); const { GOV_KEY } = process.env; diff --git a/commands/events/doomsday-clock.js b/commands/events/doomsday-clock.js index 7f33b5f2..6ef5ae66 100644 --- a/commands/events/doomsday-clock.js +++ b/commands/events/doomsday-clock.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const request = require('node-superfetch'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); module.exports = class DoomsdayClockCommand extends Command { constructor(client) { diff --git a/commands/events/horoscope.js b/commands/events/horoscope.js index ef6d3bc6..80d2d7a7 100644 --- a/commands/events/horoscope.js +++ b/commands/events/horoscope.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const cheerio = require('cheerio'); const { list, firstUpperCase } = require('../../util/Util'); diff --git a/commands/events/today-in-history.js b/commands/events/today-in-history.js index db7f9aa4..b6f31c60 100644 --- a/commands/events/today-in-history.js +++ b/commands/events/today-in-history.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); module.exports = class TodayInHistoryCommand extends Command { diff --git a/commands/info/avatar.js b/commands/info/avatar.js index 999c0216..7713aff1 100644 --- a/commands/info/avatar.js +++ b/commands/info/avatar.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); module.exports = class AvatarCommand extends Command { constructor(client) { diff --git a/commands/info/channel.js b/commands/info/channel.js index 7b471a60..177723b9 100644 --- a/commands/info/channel.js +++ b/commands/info/channel.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const types = { dm: 'DM', group: 'Group DM', diff --git a/commands/info/emoji.js b/commands/info/emoji.js index 6280f815..f3eaf02e 100644 --- a/commands/info/emoji.js +++ b/commands/info/emoji.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); module.exports = class EmojiCommand extends Command { constructor(client) { diff --git a/commands/info/first-message.js b/commands/info/first-message.js index 5f6cd1d3..1672550f 100644 --- a/commands/info/first-message.js +++ b/commands/info/first-message.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); module.exports = class FirstMessageCommand extends Command { constructor(client) { diff --git a/commands/info/message.js b/commands/info/message.js index 4a26b177..db5de698 100644 --- a/commands/info/message.js +++ b/commands/info/message.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); module.exports = class MessageCommand extends Command { constructor(client) { diff --git a/commands/info/role.js b/commands/info/role.js index 5fe22edd..cc9584f2 100644 --- a/commands/info/role.js +++ b/commands/info/role.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { util: { permissions } } = require('discord.js-commando'); module.exports = class RoleCommand extends Command { diff --git a/commands/info/server.js b/commands/info/server.js index 4dd3eb48..8fa8701d 100644 --- a/commands/info/server.js +++ b/commands/info/server.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { stripIndents } = require('common-tags'); const filterLevels = ['Off', 'No Role', 'Everyone']; const verificationLevels = ['None', 'Low', 'Medium', '(╯°□°)╯︵ ┻━┻', '┻━┻ ミヽ(ಠ益ಠ)ノ彡┻━┻']; diff --git a/commands/info/user.js b/commands/info/user.js index 74782f27..edd1d567 100644 --- a/commands/info/user.js +++ b/commands/info/user.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { stripIndents } = require('common-tags'); const { trimArray } = require('../../util/Util'); diff --git a/commands/random/meme.js b/commands/random/meme.js index f6472be6..7d3438ec 100644 --- a/commands/random/meme.js +++ b/commands/random/meme.js @@ -1,5 +1,5 @@ const SubredditCommand = require('../../structures/commands/Subreddit'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { list, formatNumber } = require('../../util/Util'); const subreddits = require('../../assets/json/meme'); diff --git a/commands/random/subreddit.js b/commands/random/subreddit.js index 00041e2c..55bbc6c4 100644 --- a/commands/random/subreddit.js +++ b/commands/random/subreddit.js @@ -1,5 +1,5 @@ const SubredditCommandBase = require('../../structures/commands/Subreddit'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { formatNumber } = require('../../util/Util'); module.exports = class SubredditCommand extends SubredditCommandBase { diff --git a/commands/random/waifu.js b/commands/random/waifu.js index 1379450e..cd15d5d2 100644 --- a/commands/random/waifu.js +++ b/commands/random/waifu.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten } = require('../../util/Util'); diff --git a/commands/search/anime.js b/commands/search/anime.js index eb222001..c26f5cfa 100644 --- a/commands/search/anime.js +++ b/commands/search/anime.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { stripIndents } = require('common-tags'); const { cleanAnilistHTML } = require('../../util/Util'); diff --git a/commands/search/book.js b/commands/search/book.js index 61413841..963e8d9d 100644 --- a/commands/search/book.js +++ b/commands/search/book.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten, formatNumber } = require('../../util/Util'); const { GOOGLE_KEY } = process.env; diff --git a/commands/search/bulbapedia.js b/commands/search/bulbapedia.js index 6a198c59..90c32f56 100644 --- a/commands/search/bulbapedia.js +++ b/commands/search/bulbapedia.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten } = require('../../util/Util'); diff --git a/commands/search/character.js b/commands/search/character.js index 8da8a2b3..78c21122 100644 --- a/commands/search/character.js +++ b/commands/search/character.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { stripIndents } = require('common-tags'); const { cleanAnilistHTML } = require('../../util/Util'); diff --git a/commands/search/github.js b/commands/search/github.js index be75b5c5..9ab9c5b3 100644 --- a/commands/search/github.js +++ b/commands/search/github.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten, formatNumber, base64 } = require('../../util/Util'); const { GITHUB_USERNAME, GITHUB_PASSWORD } = process.env; diff --git a/commands/search/itunes.js b/commands/search/itunes.js index bd1f6dbc..ce20fb97 100644 --- a/commands/search/itunes.js +++ b/commands/search/itunes.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); module.exports = class ItunesCommand extends Command { diff --git a/commands/search/kickstarter.js b/commands/search/kickstarter.js index 36b069bb..36755ddd 100644 --- a/commands/search/kickstarter.js +++ b/commands/search/kickstarter.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten, formatNumber } = require('../../util/Util'); diff --git a/commands/search/know-your-meme.js b/commands/search/know-your-meme.js index aa6fe302..df48072e 100644 --- a/commands/search/know-your-meme.js +++ b/commands/search/know-your-meme.js @@ -1,7 +1,7 @@ const Command = require('../../structures/Command'); const request = require('node-superfetch'); const cheerio = require('cheerio'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { shorten } = require('../../util/Util'); module.exports = class KnowYourMemeCommand extends Command { diff --git a/commands/search/league-of-legends.js b/commands/search/league-of-legends.js index 525474c2..092fd9c0 100644 --- a/commands/search/league-of-legends.js +++ b/commands/search/league-of-legends.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const buttons = ['Q', 'W', 'E', 'R']; diff --git a/commands/search/manga.js b/commands/search/manga.js index ebd7b365..f5b913a5 100644 --- a/commands/search/manga.js +++ b/commands/search/manga.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { stripIndents } = require('common-tags'); const { cleanAnilistHTML } = require('../../util/Util'); diff --git a/commands/search/mayo-clinic.js b/commands/search/mayo-clinic.js index be409517..5bce5b25 100644 --- a/commands/search/mayo-clinic.js +++ b/commands/search/mayo-clinic.js @@ -1,7 +1,7 @@ const Command = require('../../structures/Command'); const request = require('node-superfetch'); const cheerio = require('cheerio'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { shorten } = require('../../util/Util'); module.exports = class MayoClinicCommand extends Command { diff --git a/commands/search/mdn.js b/commands/search/mdn.js index 5c63fe18..7d3efc51 100644 --- a/commands/search/mdn.js +++ b/commands/search/mdn.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); module.exports = class MDNCommand extends Command { diff --git a/commands/search/movie.js b/commands/search/movie.js index 9cc79a84..f4aee8ed 100644 --- a/commands/search/movie.js +++ b/commands/search/movie.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten } = require('../../util/Util'); const { TMDB_KEY } = process.env; diff --git a/commands/search/nasa.js b/commands/search/nasa.js index 216ab9db..cea99a35 100644 --- a/commands/search/nasa.js +++ b/commands/search/nasa.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const request = require('node-superfetch'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { shorten } = require('../../util/Util'); module.exports = class NASACommand extends Command { diff --git a/commands/search/neopets-item.js b/commands/search/neopets-item.js index 274a473f..a4802464 100644 --- a/commands/search/neopets-item.js +++ b/commands/search/neopets-item.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const request = require('node-superfetch'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { formatNumber } = require('../../util/Util'); module.exports = class NeopetsItemCommand extends Command { diff --git a/commands/search/npm.js b/commands/search/npm.js index de8fa6f2..7bd36796 100644 --- a/commands/search/npm.js +++ b/commands/search/npm.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { trimArray } = require('../../util/Util'); diff --git a/commands/search/osu.js b/commands/search/osu.js index d1318f35..b07a15d8 100644 --- a/commands/search/osu.js +++ b/commands/search/osu.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { formatNumber } = require('../../util/Util'); const { OSU_KEY } = process.env; diff --git a/commands/search/pokedex.js b/commands/search/pokedex.js index a07857e7..1d24b206 100644 --- a/commands/search/pokedex.js +++ b/commands/search/pokedex.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { stripIndents } = require('common-tags'); module.exports = class PokedexCommand extends Command { diff --git a/commands/search/recipe.js b/commands/search/recipe.js index 6f975b68..6e2dc9ed 100644 --- a/commands/search/recipe.js +++ b/commands/search/recipe.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); module.exports = class RecipeCommand extends Command { diff --git a/commands/search/reddit.js b/commands/search/reddit.js index 25563569..19669942 100644 --- a/commands/search/reddit.js +++ b/commands/search/reddit.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const moment = require('moment'); const { formatNumber } = require('../../util/Util'); diff --git a/commands/search/rotten-tomatoes.js b/commands/search/rotten-tomatoes.js index acb09536..aa23ac47 100644 --- a/commands/search/rotten-tomatoes.js +++ b/commands/search/rotten-tomatoes.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten } = require('../../util/Util'); diff --git a/commands/search/soundcloud.js b/commands/search/soundcloud.js index d98f01f7..e274ce20 100644 --- a/commands/search/soundcloud.js +++ b/commands/search/soundcloud.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten, formatNumber } = require('../../util/Util'); const { SOUNDCLOUD_KEY } = process.env; diff --git a/commands/search/stack-overflow.js b/commands/search/stack-overflow.js index d19dcb1c..21ef4ced 100644 --- a/commands/search/stack-overflow.js +++ b/commands/search/stack-overflow.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { formatNumber } = require('../../util/Util'); const { STACKOVERFLOW_KEY } = process.env; diff --git a/commands/search/steam.js b/commands/search/steam.js index 218f751a..375078e9 100644 --- a/commands/search/steam.js +++ b/commands/search/steam.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { formatNumber } = require('../../util/Util'); diff --git a/commands/search/stocks.js b/commands/search/stocks.js index 09fcf5b4..f9393f54 100644 --- a/commands/search/stocks.js +++ b/commands/search/stocks.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { formatNumber } = require('../../util/Util'); const { ALPHA_VANTAGE_KEY } = process.env; @@ -52,7 +52,7 @@ module.exports = class StocksCommand extends Command { .addField('❯ Volume', formatNumber(data['5. volume']), true) .addField('❯ High', `$${formatNumber(data['2. high'])}`, true) .addField('❯ Low', `$${formatNumber(data['3. low'])}`, true) - .addBlankField(true); + .addField('\u200B', '\u200B', true); return msg.embed(embed); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); diff --git a/commands/search/tumblr.js b/commands/search/tumblr.js index 09f161a4..24f021c7 100644 --- a/commands/search/tumblr.js +++ b/commands/search/tumblr.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { formatNumber } = require('../../util/Util'); const { TUMBLR_KEY } = process.env; diff --git a/commands/search/tv-show.js b/commands/search/tv-show.js index 555a9d8f..69a7caf0 100644 --- a/commands/search/tv-show.js +++ b/commands/search/tv-show.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten, formatNumber } = require('../../util/Util'); const { TMDB_KEY } = process.env; diff --git a/commands/search/twitter.js b/commands/search/twitter.js index a2025b8f..0a4f62f3 100644 --- a/commands/search/twitter.js +++ b/commands/search/twitter.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { formatNumber, base64 } = require('../../util/Util'); const { TWITTER_KEY, TWITTER_SECRET } = process.env; diff --git a/commands/search/urban.js b/commands/search/urban.js index c09ff535..72986f62 100644 --- a/commands/search/urban.js +++ b/commands/search/urban.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten, formatNumber } = require('../../util/Util'); diff --git a/commands/search/vocadb.js b/commands/search/vocadb.js index 4b92e84c..3153e81e 100644 --- a/commands/search/vocadb.js +++ b/commands/search/vocadb.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten } = require('../../util/Util'); diff --git a/commands/search/wattpad.js b/commands/search/wattpad.js index 4b8e4436..c59aa5ec 100644 --- a/commands/search/wattpad.js +++ b/commands/search/wattpad.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten, formatNumber } = require('../../util/Util'); const { WATTPAD_KEY } = process.env; diff --git a/commands/search/weather.js b/commands/search/weather.js index 4f56feb5..1cdffd31 100644 --- a/commands/search/weather.js +++ b/commands/search/weather.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { OPENWEATHERMAP_KEY } = process.env; diff --git a/commands/search/wikia.js b/commands/search/wikia.js index a94896f9..ce3e72bf 100644 --- a/commands/search/wikia.js +++ b/commands/search/wikia.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten } = require('../../util/Util'); diff --git a/commands/search/wikipedia.js b/commands/search/wikipedia.js index 3875a48d..92ccc68a 100644 --- a/commands/search/wikipedia.js +++ b/commands/search/wikipedia.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten } = require('../../util/Util'); diff --git a/commands/search/xkcd.js b/commands/search/xkcd.js index 1186b207..a947a2f3 100644 --- a/commands/search/xkcd.js +++ b/commands/search/xkcd.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const types = ['random', 'today']; diff --git a/commands/search/youtube.js b/commands/search/youtube.js index 74ece209..7538f350 100644 --- a/commands/search/youtube.js +++ b/commands/search/youtube.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const moment = require('moment'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { GOOGLE_KEY } = process.env; diff --git a/commands/search/yu-gi-oh.js b/commands/search/yu-gi-oh.js index 013cec90..83fdb52b 100644 --- a/commands/search/yu-gi-oh.js +++ b/commands/search/yu-gi-oh.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten, formatNumber } = require('../../util/Util'); diff --git a/commands/sp-games/google-feud.js b/commands/sp-games/google-feud.js index 8f022672..709b9ecd 100644 --- a/commands/sp-games/google-feud.js +++ b/commands/sp-games/google-feud.js @@ -1,6 +1,6 @@ const Command = require('../../structures/Command'); const request = require('node-superfetch'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const questions = require('../../assets/json/google-feud'); module.exports = class GoogleFeudCommand extends Command { diff --git a/commands/text-edit/embed.js b/commands/text-edit/embed.js index 296a436c..9a555287 100644 --- a/commands/text-edit/embed.js +++ b/commands/text-edit/embed.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); module.exports = class EmbedCommand extends Command { constructor(client) { diff --git a/commands/text-edit/translate.js b/commands/text-edit/translate.js index 2d4b60c2..c9eae66b 100644 --- a/commands/text-edit/translate.js +++ b/commands/text-edit/translate.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const translate = require('@vitalets/google-translate-api'); const { list } = require('../../util/Util'); const codes = translate.languages; diff --git a/commands/util/changelog.js b/commands/util/changelog.js index 03f0fe20..aa56f544 100644 --- a/commands/util/changelog.js +++ b/commands/util/changelog.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const request = require('node-superfetch'); const { shorten, base64 } = require('../../util/Util'); const { GITHUB_USERNAME, GITHUB_PASSWORD, XIAO_GITHUB_REPO_USERNAME, XIAO_GITHUB_REPO_NAME } = process.env; diff --git a/commands/util/cloc.js b/commands/util/cloc.js index 0df67e1f..adadd826 100644 --- a/commands/util/cloc.js +++ b/commands/util/cloc.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { formatNumber } = require('../../util/Util'); const { promisify } = require('util'); const exec = promisify(require('child_process').execFile); @@ -27,9 +27,9 @@ module.exports = class ClocCommand extends Command { .addField(`❯ JS (${formatNumber(cloc.JavaScript.nFiles)})`, formatNumber(cloc.JavaScript.code), true) .addField(`❯ JSON (${formatNumber(cloc.JSON.nFiles)})`, formatNumber(cloc.JSON.code), true) .addField(`❯ MD (${formatNumber(cloc.Markdown.nFiles)})`, formatNumber(cloc.Markdown.code), true) - .addBlankField(true) + .addField('\u200B', '\u200B', true); .addField(`❯ Total (${formatNumber(cloc.SUM.nFiles)})`, formatNumber(cloc.SUM.code), true) - .addBlankField(true); + .addField('\u200B', '\u200B', true);; return msg.embed(embed); } diff --git a/commands/util/credit.js b/commands/util/credit.js index 238369d5..96bf28a1 100644 --- a/commands/util/credit.js +++ b/commands/util/credit.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); module.exports = class CreditCommand extends Command { constructor(client) { diff --git a/commands/util/help.js b/commands/util/help.js index ee611903..4873a41e 100644 --- a/commands/util/help.js +++ b/commands/util/help.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { stripIndents } = require('common-tags'); module.exports = class HelpCommand extends Command { diff --git a/commands/util/info.js b/commands/util/info.js index dfae3854..005b29ea 100644 --- a/commands/util/info.js +++ b/commands/util/info.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const moment = require('moment'); require('moment-duration-format'); const { formatNumber } = require('../../util/Util'); diff --git a/commands/util/report.js b/commands/util/report.js index c6bb52ed..6f973709 100644 --- a/commands/util/report.js +++ b/commands/util/report.js @@ -1,5 +1,5 @@ const Command = require('../../structures/Command'); -const MessageEmbed = require('../../structures/MessageEmbed'); +const { MessageEmbed } = require('discord.js'); const { list } = require('../../util/Util'); const reasons = ['bug', 'feedback', 'suggestion']; const reasonColors = ['RED', 'GREEN', 'YELLOW']; diff --git a/package.json b/package.json index acd1e6e0..ee89fb41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "110.9.3", + "version": "110.9.4", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": { @@ -38,7 +38,7 @@ "cloc": "^2.5.1", "common-tags": "^1.8.0", "custom-translate": "^2.2.8", - "discord.js": "github:discordjs/discord.js", + "discord.js": "github:almostSouji/discord.js#embed-addfield", "discord.js-commando": "github:discordjs/Commando", "dotenv": "^8.2.0", "gifencoder": "^2.0.1", diff --git a/structures/MessageEmbed.js b/structures/MessageEmbed.js deleted file mode 100644 index 32c374e7..00000000 --- a/structures/MessageEmbed.js +++ /dev/null @@ -1,385 +0,0 @@ -// Credit: -// https://github.com/discordjs/discord.js/blob/ecd8cccddf9b83f4f7cd858fdcad9e436ac51794/src/structures/MessageEmbed.js - -const { Util } = require('discord.js'); - -/** - * Represents an embed in a message (image/video preview, rich embed, etc.) - */ -class MessageEmbed { - constructor(data = {}) { - this.setup(data); - } - - setup(data) { // eslint-disable-line complexity - /** - * The type of this embed, either: - * * `image` - an image embed - * * `video` - a video embed - * * `gifv` - a gifv embed - * * `link` - a link embed - * * `rich` - a rich embed - * @type {string} - */ - this.type = data.type; - - /** - * The title of this embed - * @type {?string} - */ - this.title = data.title; - - /** - * The description of this embed - * @type {?string} - */ - this.description = data.description; - - /** - * The URL of this embed - * @type {?string} - */ - this.url = data.url; - - /** - * The color of this embed - * @type {?number} - */ - this.color = Util.resolveColor(data.color); - - /** - * The timestamp of this embed - * @type {?number} - */ - this.timestamp = data.timestamp ? new Date(data.timestamp).getTime() : null; - - /** - * @typedef {Object} EmbedField - * @property {string} name The name of this field - * @property {string} value The value of this field - * @property {boolean} inline If this field will be displayed inline - */ - - /** - * The fields of this embed - * @type {EmbedField[]} - */ - this.fields = data.fields ? data.fields.map(Util.cloneObject) : []; - - /** - * The thumbnail of this embed (if there is one) - * @type {?Object} - * @property {string} url URL for this thumbnail - * @property {string} proxyURL ProxyURL for this thumbnail - * @property {number} height Height of this thumbnail - * @property {number} width Width of this thumbnail - */ - this.thumbnail = data.thumbnail ? { - url: data.thumbnail.url, - proxyURL: data.thumbnail.proxy_url, - height: data.thumbnail.height, - width: data.thumbnail.width - } : null; - - /** - * The image of this embed, if there is one - * @type {?Object} - * @property {string} url URL for this image - * @property {string} proxyURL ProxyURL for this image - * @property {number} height Height of this image - * @property {number} width Width of this image - */ - this.image = data.image ? { - url: data.image.url, - proxyURL: data.image.proxy_url, - height: data.image.height, - width: data.image.width - } : null; - - /** - * The video of this embed (if there is one) - * @type {?Object} - * @property {string} url URL of this video - * @property {string} proxyURL ProxyURL for this video - * @property {number} height Height of this video - * @property {number} width Width of this video - * @readonly - */ - this.video = data.video ? { - url: data.video.url, - proxyURL: data.video.proxy_url, - height: data.video.height, - width: data.video.width - } : null; - - /** - * The author of this embed (if there is one) - * @type {?Object} - * @property {string} name The name of this author - * @property {string} url URL of this author - * @property {string} iconURL URL of the icon for this author - * @property {string} proxyIconURL Proxied URL of the icon for this author - */ - this.author = data.author ? { - name: data.author.name, - url: data.author.url, - iconURL: data.author.iconURL || data.author.icon_url, - proxyIconURL: data.author.proxyIconUrl || data.author.proxy_icon_url - } : null; - - /** - * The provider of this embed (if there is one) - * @type {?Object} - * @property {string} name The name of this provider - * @property {string} url URL of this provider - */ - this.provider = data.provider; - - /** - * The footer of this embed - * @type {?Object} - * @property {string} text The text of this footer - * @property {string} iconURL URL of the icon for this footer - * @property {string} proxyIconURL Proxied URL of the icon for this footer - */ - this.footer = data.footer ? { - text: data.footer.text, - iconURL: data.footer.iconURL || data.footer.icon_url, - proxyIconURL: data.footer.proxyIconURL || data.footer.proxy_icon_url - } : null; - - /** - * The files of this embed - * @type {Array} - */ - this.files = data.files || []; - } - - /** - * The date this embed was created at - * @type {?Date} - * @readonly - */ - get createdAt() { - return this.timestamp ? new Date(this.timestamp) : null; - } - - /** - * The hexadecimal version of the embed color, with a leading hash - * @type {?string} - * @readonly - */ - get hexColor() { - return this.color ? `#${this.color.toString(16).padStart(6, '0')}` : null; - } - - /** - * The accumulated length for the embed title, description, fields and footer text - * @type {number} - * @readonly - */ - get length() { - return ( - (this.title ? this.title.length : 0) - + (this.description ? this.description.length : 0) - + (this.fields.length >= 1 ? this.fields.reduce((prev, curr) => - prev + curr.name.length + curr.value.length, 0) : 0) - + (this.footer ? this.footer.text.length : 0)); - } - - /** - * Adds a field to the embed (max 25). - * @param {StringResolvable} name The name of the field - * @param {StringResolvable} value The value of the field - * @param {boolean} [inline=false] Set the field to display inline - * @returns {MessageEmbed} - */ - addField(name, value, inline) { - this.fields.push(this.constructor.checkField(name, value, inline)); - return this; - } - - /** - * Convenience function for `.addField('\u200B', '\u200B', inline)`. - * @param {boolean} [inline=false] Set the field to display inline - * @returns {MessageEmbed} - */ - addBlankField(inline) { - return this.addField('\u200B', '\u200B', inline); - } - - /** - * Removes, replaces, and inserts fields in the embed (max 25). - * @param {number} index The index to start at - * @param {number} deleteCount The number of fields to remove - * @param {StringResolvable} [name] The name of the field - * @param {StringResolvable} [value] The value of the field - * @param {boolean} [inline=false] Set the field to display inline - * @returns {MessageEmbed} - */ - spliceField(index, deleteCount, name, value, inline) { - if (name && value) { - this.fields.splice(index, deleteCount, this.constructor.checkField(name, value, inline)); - } else { - this.fields.splice(index, deleteCount); - } - return this; - } - - /** - * Sets the file to upload alongside the embed. This file can be accessed via `attachment://fileName.extension` when - * setting an embed image or author/footer icons. Multiple files can be attached. - * @param {Array} files Files to attach - * @returns {MessageEmbed} - */ - attachFiles(files) { - this.files = this.files.concat(files); - return this; - } - - /** - * Sets the author of this embed. - * @param {StringResolvable} name The name of the author - * @param {string} [iconURL] The icon URL of the author - * @param {string} [url] The URL of the author - * @returns {MessageEmbed} - */ - setAuthor(name, iconURL, url) { - this.author = { name: Util.resolveString(name), iconURL, url }; - return this; - } - - /** - * Sets the color of this embed. - * @param {ColorResolvable} color The color of the embed - * @returns {MessageEmbed} - */ - setColor(color) { - this.color = Util.resolveColor(color); - return this; - } - - /** - * Sets the description of this embed. - * @param {StringResolvable} description The description - * @returns {MessageEmbed} - */ - setDescription(description) { - description = Util.resolveString(description); - this.description = description; - return this; - } - - /** - * Sets the footer of this embed. - * @param {StringResolvable} text The text of the footer - * @param {string} [iconURL] The icon URL of the footer - * @returns {MessageEmbed} - */ - setFooter(text, iconURL) { - text = Util.resolveString(text); - this.footer = { text, iconURL }; - return this; - } - - /** - * Sets the image of this embed. - * @param {string} url The URL of the image - * @returns {MessageEmbed} - */ - setImage(url) { - this.image = { url }; - return this; - } - - /** - * Sets the thumbnail of this embed. - * @param {string} url The URL of the thumbnail - * @returns {MessageEmbed} - */ - setThumbnail(url) { - this.thumbnail = { url }; - return this; - } - - /** - * Sets the timestamp of this embed. - * @param {Date|number} [timestamp=Date.now()] The timestamp or date - * @returns {MessageEmbed} - */ - setTimestamp(timestamp = Date.now()) { - if (timestamp instanceof Date) timestamp = timestamp.getTime(); - this.timestamp = timestamp; - return this; - } - - /** - * Sets the title of this embed. - * @param {StringResolvable} title The title - * @returns {MessageEmbed} - */ - setTitle(title) { - title = Util.resolveString(title); - this.title = title; - return this; - } - - /** - * Sets the URL of this embed. - * @param {string} url The URL - * @returns {MessageEmbed} - */ - setURL(url) { - this.url = url; - return this; - } - - toJSON() { - return Util.flatten(this, { hexColor: true }); - } - - /** - * Transforms the embed object to be processed. - * @returns {Object} The raw data of this embed - * @private - */ - _apiTransform() { - return { - title: this.title, - type: 'rich', - description: this.description, - url: this.url, - timestamp: this.timestamp ? new Date(this.timestamp) : null, - color: this.color, - fields: this.fields, - thumbnail: this.thumbnail, - image: this.image, - author: this.author ? { - name: this.author.name, - url: this.author.url, - icon_url: this.author.iconURL - } : null, - footer: this.footer ? { - text: this.footer.text, - icon_url: this.footer.iconURL - } : null - }; - } - - /** - * Checks for valid field input and resolves strings - * @param {StringResolvable} name The name of the field - * @param {StringResolvable} value The value of the field - * @param {boolean} [inline=false] Set the field to display inline - * @returns {EmbedField} - */ - static checkField(name, value, inline = false) { - name = Util.resolveString(name); - if (!name) throw new Error('MessageEmbed field names may not be empty.'); - value = Util.resolveString(value); - if (!value) throw new Error('MessageEmbed field values may not be empty.'); - return { name, value, inline }; - } -} - -module.exports = MessageEmbed;