From 5707493cfbb8ad692b184a53c849595d584dbb15 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Mon, 19 Jul 2021 18:44:28 +0300 Subject: [PATCH] more descriptive banland message & async ping --- structure/ChannelHandler.js | 7 +++++-- structure/Modmail.js | 11 +++++++---- structure/commands/Ping.js | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/structure/ChannelHandler.js b/structure/ChannelHandler.js index 6e5c5fe..9fa6abd 100644 --- a/structure/ChannelHandler.js +++ b/structure/ChannelHandler.js @@ -141,8 +141,11 @@ class ChannelHandler { footer: { text: `• User ID: ${user.id}` }, color: guild.me.highestRoleColor }; - if (member && member.banned) embed.description = `**__USER IS IN BANLAND__**`; - else if (member) embed.fields.push({ + if (member && member.inAppealServer) { + const ban = await guild.fetchBan(member.id).catch(() => null); + if (ban) embed.description = `**__USER IS BANNED FROM MAIN SERVER__**`; + else embed.description = `**__USER IS IN APPEAL SERVER BUT NOT BANNED FROM MAIN__**`; + } else if (member) embed.fields.push({ name: '__Member Data__', value: `**Nickname:** ${member.nickname || 'N/A'}\n` + `**Server join date:** ${member.joinedAt.toDateString()}\n` + diff --git a/structure/Modmail.js b/structure/Modmail.js index aac5ab0..cf2906d 100644 --- a/structure/Modmail.js +++ b/structure/Modmail.js @@ -81,7 +81,7 @@ class Modmail { if(!result) result = await this.bansServer.members.fetch(user).catch(() => { return null; }); - if (result) result.banned = true; + if (result) result.inAppealServer = true; } return result; @@ -243,12 +243,15 @@ class Modmail { const { member: staff, author } = message; + // Send to channel in server & target + const sent = await this.send({ target: targetMember, staff, anon, content }); + if (sent.error) return sent; + // Inline response await message.channel.send('Delivered.').catch(this.client.logger.error.bind(this.client.logger)); this.log({ author, action: `${author.tag} sent a message to ${targetMember.user.tag}`, content, target: targetMember.user }); - // Send to channel in server - return this.send({ target: targetMember, staff, anon, content }); + } @@ -280,7 +283,7 @@ class Modmail { icon_url: staff.user.displayAvatarURL({ dynamic: true }) }; - await this.channels.send(target, embed, { author: staff.id, content, timestamp: Date.now(), isReply: true, anon }); + return this.channels.send(target, embed, { author: staff.id, content, timestamp: Date.now(), isReply: true, anon }); } diff --git a/structure/commands/Ping.js b/structure/commands/Ping.js index c22ab99..2bebd86 100644 --- a/structure/commands/Ping.js +++ b/structure/commands/Ping.js @@ -8,7 +8,7 @@ class Ping extends Command { }); } - execute() { + async execute() { return `PONG!`; }