mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 05:49:49 +02:00
Fix Everything
This commit is contained in:
+28
-34
@@ -23,11 +23,8 @@ module.exports = class WarnCommand extends Command {
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
validate: (reason) => {
|
||||
if (reason.length < 140) {
|
||||
return true;
|
||||
} else {
|
||||
return 'Invalid Reason. Reason must be under 140 characters.';
|
||||
}
|
||||
if (reason.length < 140) return true;
|
||||
else return 'Invalid Reason. Reason must be under 140 characters.';
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -44,39 +41,36 @@ module.exports = class WarnCommand extends Command {
|
||||
time: 15000,
|
||||
errors: ['time']
|
||||
});
|
||||
if (['y', 'yes'].includes(collected.first().content.toLowerCase())) {
|
||||
try {
|
||||
await member.user.send(stripIndents`
|
||||
You were warned in ${msg.guild.name}!
|
||||
Reason: ${reason}
|
||||
`);
|
||||
} catch (err) {
|
||||
await msg.say('Failed to Send DM.');
|
||||
}
|
||||
await msg.say(`Successfully warned ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the warn to the mod logs.');
|
||||
} else if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
|
||||
return modlogs.send(stripIndents`
|
||||
if (!['y', 'yes'].includes(collected.first().content.toLowerCase())) return msg.say('Aborting Warn.');
|
||||
try {
|
||||
await member.user.send(stripIndents`
|
||||
You were warned in ${msg.guild.name}!
|
||||
Reason: ${reason}
|
||||
`);
|
||||
} catch (err) {
|
||||
await msg.say('Failed to Send DM.');
|
||||
}
|
||||
await msg.say(`Successfully warned ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the warn to the mod logs.');
|
||||
} else if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS')) {
|
||||
return modlogs.send(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Warn
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFFFF00)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Warn
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFFFF00)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Warn
|
||||
**Reason:** ${reason}
|
||||
`);
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} else {
|
||||
return msg.say('Aborting Warn.');
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} catch (err) {
|
||||
return msg.say('Aborting Warn.');
|
||||
|
||||
Reference in New Issue
Block a user