DM user if it can
This commit is contained in:
parent
18f3bd746b
commit
d26f0d98d2
2 changed files with 48 additions and 6 deletions
|
@ -75,12 +75,12 @@ export default class Timeout extends Command {
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// if (!targetMember.manageable) {
|
if (!targetMember.manageable) {
|
||||||
// await interaction.reply('Insufficient bot permissions. Please contact a moderator.');
|
await interaction.reply('Insufficient bot permissions. Please contact a moderator.');
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// await targetMember.timeout(timeLength.GetMilliseconds(), reason || "");
|
await targetMember.timeout(timeLength.GetMilliseconds(), reason || "");
|
||||||
|
|
||||||
const channelName = await SettingsHelper.GetSetting('channels.logs.mod', interaction.guildId);
|
const channelName = await SettingsHelper.GetSetting('channels.logs.mod', interaction.guildId);
|
||||||
|
|
||||||
|
@ -97,7 +97,45 @@ export default class Timeout extends Command {
|
||||||
|
|
||||||
const resultEmbed = new EmbedBuilder()
|
const resultEmbed = new EmbedBuilder()
|
||||||
.setColor(EmbedColours.Ok)
|
.setColor(EmbedColours.Ok)
|
||||||
.setDescription("User successfully timed out");
|
.setDescription(`<@${targetUser.user.id}> has been timed out`);
|
||||||
|
|
||||||
|
const dmEmbed = new EmbedBuilder()
|
||||||
|
.setColor(EmbedColours.Ok)
|
||||||
|
.setDescription(`You have been timed out in ${interaction.guild.name}`)
|
||||||
|
.addFields([
|
||||||
|
{
|
||||||
|
name: "Reason",
|
||||||
|
value: reason || "*none*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Length",
|
||||||
|
value: timeLength.GetLengthShort(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Until",
|
||||||
|
value: timeLength.GetDateFromNow().toString(),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const dmChannel = await targetUser.user.createDM();
|
||||||
|
|
||||||
|
await dmChannel.send({ embeds: [ dmEmbed ]});
|
||||||
|
|
||||||
|
resultEmbed.addFields([
|
||||||
|
{
|
||||||
|
name: "DM Sent",
|
||||||
|
value: "true",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
} catch {
|
||||||
|
resultEmbed.addFields([
|
||||||
|
{
|
||||||
|
name: "DM Sent",
|
||||||
|
value: "false",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
await interaction.reply({ embeds: [ resultEmbed ]});
|
await interaction.reply({ embeds: [ resultEmbed ]});
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@ export default class AuditTools {
|
||||||
return "Kick";
|
return "Kick";
|
||||||
case AuditType.Ban:
|
case AuditType.Ban:
|
||||||
return "Ban";
|
return "Ban";
|
||||||
|
case AuditType.Timeout:
|
||||||
|
return "Timeout";
|
||||||
default:
|
default:
|
||||||
return "Other";
|
return "Other";
|
||||||
}
|
}
|
||||||
|
@ -30,6 +32,8 @@ export default class AuditTools {
|
||||||
return AuditType.Kick;
|
return AuditType.Kick;
|
||||||
case "ban":
|
case "ban":
|
||||||
return AuditType.Ban;
|
return AuditType.Ban;
|
||||||
|
case "timeout":
|
||||||
|
return AuditType.Timeout;
|
||||||
default:
|
default:
|
||||||
return AuditType.General;
|
return AuditType.General;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue