more descriptive banland message & async ping

This commit is contained in:
Erik 2021-07-19 18:44:28 +03:00
parent 1716e4bf1b
commit 5707493cfb
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16
3 changed files with 13 additions and 7 deletions

View File

@ -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` +

View File

@ -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 });
}

View File

@ -8,7 +8,7 @@ class Ping extends Command {
});
}
execute() {
async execute() {
return `PONG!`;
}