From 378be5da88d8f0ad5a5a638cbbfbcdb0ef1739a7 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sun, 22 Mar 2020 21:54:19 +0100 Subject: [PATCH] Make these command work in dm --- commands/fun/4chan.js | 2 +- commands/fun/reddit.js | 2 +- commands/general/advice.js | 2 +- commands/minigame/guess.js | 2 +- commands/utility/about.js | 2 +- commands/utility/avatar.js | 2 +- commands/utility/donate.js | 2 +- commands/utility/download.js | 4 ++-- commands/utility/help.js | 4 ++-- commands/utility/screenshot.js | 2 +- commands/utility/seebannedword.js | 2 +- commands/utility/seetag.js | 6 +++--- commands/utility/server.js | 2 +- commands/utility/serverIcon.js | 2 +- commands/utility/stats.js | 2 +- commands/utility/translate.js | 4 ++-- commands/utility/updoot.js | 2 +- commands/utility/wallpaper.js | 2 +- event/listeners/commandstarted.js | 2 +- 19 files changed, 24 insertions(+), 24 deletions(-) diff --git a/commands/fun/4chan.js b/commands/fun/4chan.js index c3fed605..f6be7578 100644 --- a/commands/fun/4chan.js +++ b/commands/fun/4chan.js @@ -71,7 +71,7 @@ class FourchanCommand extends Command { } const FourchanEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle(turndown.turndown(title)) .setDescription(turndown.turndown(description)) .setImage(`https://i.4cdn.org/${args.board}/${response.threads[i].posts[0].tim}${response.threads[i].posts[0].ext}`) diff --git a/commands/fun/reddit.js b/commands/fun/reddit.js index a8118555..b994ee6b 100644 --- a/commands/fun/reddit.js +++ b/commands/fun/reddit.js @@ -47,7 +47,7 @@ class RedditCommand extends Command { if (response.data.children[i].data.over_18 == true && !message.channel.nsfw) return message.channel.send('No nsfw'); const redditEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle(response.data.children[i].data.title) .setDescription(response.data.children[i].data.selftext) .setURL('https://reddit.com' + response.data.children[i].data.permalink) diff --git a/commands/general/advice.js b/commands/general/advice.js index 14991784..1416c879 100644 --- a/commands/general/advice.js +++ b/commands/general/advice.js @@ -20,7 +20,7 @@ class AdviceCommand extends Command { return response.json(); }).then((response) => { const adviceEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle(response.slip.slip_id) .setDescription(response.slip.advice); diff --git a/commands/minigame/guess.js b/commands/minigame/guess.js index 48bd23fa..9a745905 100644 --- a/commands/minigame/guess.js +++ b/commands/minigame/guess.js @@ -36,7 +36,7 @@ class guessCommand extends Command { const leaderboard = await guessLeaderboard.findAll({order: ['try']}); let top = []; let leaderboardEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle('Guess leaderboard'); for (let i = 0; i < leaderboard.length; i++) { this.client.users.fetch(leaderboard[i].get('memberID')) diff --git a/commands/utility/about.js b/commands/utility/about.js index 2f2d3eb6..61cf6b0a 100644 --- a/commands/utility/about.js +++ b/commands/utility/about.js @@ -30,7 +30,7 @@ class aboutCommand extends Command { const aboutEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setAuthor(this.client.user.username, this.client.user.avatarURL()) .setTitle('About me') .setDescription(description) diff --git a/commands/utility/avatar.js b/commands/utility/avatar.js index 947d25fe..3310bcc6 100644 --- a/commands/utility/avatar.js +++ b/commands/utility/avatar.js @@ -22,7 +22,7 @@ class AvatarCommand extends Command { async exec(message, args) { const avatarEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle('Avatar'); diff --git a/commands/utility/donate.js b/commands/utility/donate.js index ca2ec599..4127a2a6 100644 --- a/commands/utility/donate.js +++ b/commands/utility/donate.js @@ -16,7 +16,7 @@ class donateCommand extends Command { async exec(message) { const Embed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle('Donation link') .setDescription('If you decide to donate, please use the feedback command to let the owner know about it so he can put you in the about and donator command\n[Paypal](https://www.paypal.me/supositware)\n[Patreon](https://www.patreon.com/bePatron?u=15330358)\n[Brave referal program](https://brave.com/hah459)\nTip me with Brave BAT token on [my website](https://namejeff.xyz/)\nYou can also donate ETH to ``0xe188F9062A74cc29e23D0602F4Fe335B1F5D8409``'); diff --git a/commands/utility/download.js b/commands/utility/download.js index a0460db5..7c7cf465 100644 --- a/commands/utility/download.js +++ b/commands/utility/download.js @@ -52,14 +52,14 @@ class DownloadCommand extends Command { const Embed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setAuthor(`Downloaded by ${message.author.username}`, message.author.displayAvatarURL(), link) .setDescription(args.caption) .setFooter(`You can get the original video by clicking on the "downloaded by ${message.author.username}" message!`); let compressEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle('This one will need compression!') .setDescription('Starting compression now!') .setFooter('Want it to go faster? Donate to the dev with the donate command, so i can get a better server and do it faster!'); diff --git a/commands/utility/help.js b/commands/utility/help.js index 1399213b..d867373b 100644 --- a/commands/utility/help.js +++ b/commands/utility/help.js @@ -38,7 +38,7 @@ class HelpCommand extends Command { }, command.description); const embed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle(`\`${this.client.commandHandler.prefix[0]}${command.aliases[0]} ${description.usage}\``) .addField('Description', description.content) .setFooter(`All the available prefix: ${this.client.commandHandler.prefix.join(' | ')}`); @@ -72,7 +72,7 @@ class HelpCommand extends Command { async execCommandList(message) { const embed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .addField('Command List', [ 'This is a list of commands.', diff --git a/commands/utility/screenshot.js b/commands/utility/screenshot.js index 6d5a4049..c1e016e9 100644 --- a/commands/utility/screenshot.js +++ b/commands/utility/screenshot.js @@ -32,7 +32,7 @@ class screenshotCommand extends Command { async exec(message, args) { if (args.url.includes('config.json')) return message.channel.send('I don\'t think so'); let Embed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle(args.url); let loadingmsg = await message.channel.send('Taking a screenshot '); diff --git a/commands/utility/seebannedword.js b/commands/utility/seebannedword.js index d17f98c8..772925ca 100644 --- a/commands/utility/seebannedword.js +++ b/commands/utility/seebannedword.js @@ -31,7 +31,7 @@ class seebannedwordCommand extends Command { if (list == undefined) return message.channel.send('No word are banned yet.'); const Embed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle('List of banned words') .setDescription(list); diff --git a/commands/utility/seetag.js b/commands/utility/seetag.js index e50f2e4b..acd81953 100644 --- a/commands/utility/seetag.js +++ b/commands/utility/seetag.js @@ -37,7 +37,7 @@ class seetagCommand extends Command { this.client.users.fetch(tagList.dataValues.ownerID) .then(user => { const TagEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle(message.guild.name) .addField('Trigger:', tagList['dataValues']['trigger']) .addField('Response:', tagList['dataValues']['response']) @@ -53,7 +53,7 @@ class seetagCommand extends Command { }) .catch(() => { const TagEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle(message.guild.name) .addField('Trigger:', tagList['dataValues']['trigger']) .addField('Response:', tagList['dataValues']['response']) @@ -82,7 +82,7 @@ class seetagCommand extends Command { let tagList = await Tag.findAll({attributes: ['trigger'], where: {serverID: message.guild.id}}); const tagString = tagList.map(t => t.trigger).join(', ') || 'No tags set.'; const TagEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle('List of tags') .setDescription(tagString) .setFooter('Use this command with the name of the tag to see more info about it!'); diff --git a/commands/utility/server.js b/commands/utility/server.js index df82a245..010701b4 100644 --- a/commands/utility/server.js +++ b/commands/utility/server.js @@ -18,7 +18,7 @@ class ServerCommand extends Command { async exec(message) { let botCount = message.guild.members.cache.filter(member => member.user.bot).size; const addEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle(message.guild.name) .setThumbnail(message.guild.iconURL()) .addField('Number of users', message.guild.memberCount - botCount, true) diff --git a/commands/utility/serverIcon.js b/commands/utility/serverIcon.js index 8ec08788..1dd17525 100644 --- a/commands/utility/serverIcon.js +++ b/commands/utility/serverIcon.js @@ -23,7 +23,7 @@ class serverIconCommand extends Command { async exec(message, args) { const serverEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle('Server icon'); diff --git a/commands/utility/stats.js b/commands/utility/stats.js index 54e14811..414a215b 100644 --- a/commands/utility/stats.js +++ b/commands/utility/stats.js @@ -52,7 +52,7 @@ class StatsCommand extends Command { } const statsEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle('Bot stats') .setAuthor('Haha yes') .addField('Servers', this.client.guilds.cache.size, true) diff --git a/commands/utility/translate.js b/commands/utility/translate.js index 86f632da..aaa80566 100644 --- a/commands/utility/translate.js +++ b/commands/utility/translate.js @@ -61,7 +61,7 @@ class translateCommand extends Command { // If it didn't find anything in the dictionary simply send the translation if (response.def.length == 0) { const translationEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle('Asked for the following translation:') .setURL('https://tech.yandex.com/dictionary/') .setAuthor(message.author.username) @@ -85,7 +85,7 @@ class translateCommand extends Command { } const translationEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle('Asked for the following translation:') .setURL('https://tech.yandex.com/dictionary/') .setAuthor(message.author.username) diff --git a/commands/utility/updoot.js b/commands/utility/updoot.js index 402990fa..2545f781 100644 --- a/commands/utility/updoot.js +++ b/commands/utility/updoot.js @@ -17,7 +17,7 @@ class UpdootCommand extends Command { async exec(message) { const upDoot = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle('Vote for my bot') .setAuthor(message.author.username) .setDescription('You can vote for my bot if you think the bot is awesome!') diff --git a/commands/utility/wallpaper.js b/commands/utility/wallpaper.js index 437389ae..7218a8df 100644 --- a/commands/utility/wallpaper.js +++ b/commands/utility/wallpaper.js @@ -32,7 +32,7 @@ class wallpaperCommand extends Command { }) .then(res => { const wallpaperEmbed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle('Bing wallpaper of the day') .addField('Copyright', `[${res.copyright}](${res.copyright_link})`) .setDescription(`[1366](https://bing.biturl.top/?resolution=1366&format=image&mkt=${mkt}) | [1920](https://bing.biturl.top/?resolution=1920&format=image&mkt=${mkt})`) diff --git a/event/listeners/commandstarted.js b/event/listeners/commandstarted.js index 9650fa03..ea7e0c0e 100644 --- a/event/listeners/commandstarted.js +++ b/event/listeners/commandstarted.js @@ -30,7 +30,7 @@ class commandStartedListener extends Listener { console.log('Gold triggered!'); this.client.user.setActivity('people buy haha yes gold™', { type: 'WATCHING' }); let Embed = this.client.util.embed() - .setColor(message.member.displayHexColor) + .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle('Haha yes **gold**') .setDescription('To further utilize this command, please visit https://namejeff.xyz/gold') .attachFiles(['./asset/img/gold.png'])