From 8ef777ca8b0e3029e33887b4fc3050b34a47edc5 Mon Sep 17 00:00:00 2001 From: Matthew Ray Date: Tue, 11 Sep 2018 22:46:53 -0400 Subject: [PATCH] Add exception notifiers --- commands/game.js | 19 ++++--------------- commands/whois.js | 5 ++++- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/commands/game.js b/commands/game.js index 875b1ad..1e385ca 100644 --- a/commands/game.js +++ b/commands/game.js @@ -21,22 +21,8 @@ if (botuser.user.bot === true) { bot = "No"; } -if(!botuser.user.presence.game.assets.assets) { - const embed = new Discord.RichEmbed() - .setAuthor(botuser.displayName, `undefined`) - .setColor(botuser.displayColor) - .addField("Status", `${status[botuser.user.presence.status]}`, true) - .addField("Playing", `${botuser.user.presence.game ? `${botuser.user.presence.game.name}` : "not playing anything."}`, true) - .addField("Details", `${botuser.user.presence.game.details}`, true) - .addField("State", `${botuser.user.presence.game.state}`, true) - .addField("ID", botuser.id, false) - .addField("Bot", `${bot}`, false) - .addField("Guild", `${bot}`, false) - .setFooter("ShadowShard | Alpha Development") - msg.edit(embed) -} - const embed = new Discord.RichEmbed() +try { const embed = new Discord.RichEmbed() .setAuthor(botuser.displayName, botuser.user.presence.game.assets.smallImageURL) .setThumbnail(botuser.user.presence.game.assets.largeImageURL) .setColor(botuser.displayColor) @@ -49,6 +35,9 @@ if(!botuser.user.presence.game.assets.assets) { .addField("Guild", `${bot}`, false) .setFooter("ShadowShard | Alpha Development") msg.edit(embed) +} catch (err) { + msg.edit('Exception: ' + err) + } } diff --git a/commands/whois.js b/commands/whois.js index 1105280..ff86f68 100644 --- a/commands/whois.js +++ b/commands/whois.js @@ -12,7 +12,7 @@ exports.run = async (client, message, args, level) => { } catch(e) { level = 0; } - const msg = await message.channel.send("Loading..."); + try { const msg = await message.channel.send("Loading..."); const friendly = client.config.permLevels.find(l => l.level === level).name; let botuser = message.mentions.users.first() ? message.guild.members.get(message.mentions.users.first().id) : message.member let matt = message.mentions.users.first() ? message.guild.members.get(message.mentions.users.first().id).roles.sort((a, b) => b.position - a.position).map(i => i.id).slice(0, -1) : message.member.roles.sort((a, b) => b.position - a.position).map(i => i.id).slice(0, -1) @@ -44,6 +44,9 @@ myDick; .addField("System Level", `${level}`, true) .setFooter("ShadowShard | Alpha Development") msg.edit(embed) +} catch (err) { + msg.edit('Exception: ' + err) + } }; exports.conf = { enabled: true,