mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 22:32:50 +02:00
Fix Everything
This commit is contained in:
@@ -24,11 +24,8 @@ module.exports = class SoftbanCommand 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 'Reason must be under 140 characters.';
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -38,9 +35,7 @@ module.exports = class SoftbanCommand extends Command {
|
||||
async run(msg, args) {
|
||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||
const { member, reason } = args;
|
||||
if (!member.bannable) {
|
||||
return msg.say('This member is not softbannable. Perhaps they have a higher role than me?');
|
||||
}
|
||||
if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
try {
|
||||
await msg.say(`Are you sure you want to softban ${member.user.tag} (${member.id})?`);
|
||||
const collected = await msg.channel.awaitMessages((res) => res.author.id === msg.author.id, {
|
||||
@@ -48,44 +43,41 @@ module.exports = class SoftbanCommand extends Command {
|
||||
time: 15000,
|
||||
errors: ['time']
|
||||
});
|
||||
if (['y', 'yes'].includes(collected.first().content.toLowerCase())) {
|
||||
try {
|
||||
await member.user.send(stripIndents`
|
||||
You were softbanned from ${msg.guild.name}!
|
||||
Reason: ${reason}
|
||||
`);
|
||||
} catch (err) {
|
||||
await msg.say('Failed to Send DM.');
|
||||
}
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason} (Softban)`
|
||||
});
|
||||
await msg.guild.unban(member.user, 'Softban');
|
||||
await msg.say(`Successfully softbanned ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the softban 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 Softban.');
|
||||
try {
|
||||
await member.user.send(stripIndents`
|
||||
You were softbanned from ${msg.guild.name}!
|
||||
Reason: ${reason}
|
||||
`);
|
||||
} catch (err) {
|
||||
await msg.say('Failed to Send DM.');
|
||||
}
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason} (Softban)`
|
||||
});
|
||||
await msg.guild.unban(member.user, 'Softban');
|
||||
await msg.say(`Successfully softbanned ${member.user.tag}.`);
|
||||
if (!modlogs || !modlogs.permissionsFor(this.client.user.has('SEND_MESSAGES'))) {
|
||||
return msg.say('Could not log the softban 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:** Softban
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFF4500)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Softban
|
||||
**Reason:** ${reason}
|
||||
**Moderator:** ${msg.author.tag}
|
||||
`);
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||
.setColor(0xFF4500)
|
||||
.setTimestamp()
|
||||
.setDescription(stripIndents`
|
||||
**Member:** ${member.user.tag} (${member.id})
|
||||
**Action:** Softban
|
||||
**Reason:** ${reason}
|
||||
`);
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} else {
|
||||
return msg.say('Aborting Softban.');
|
||||
return modlogs.send({ embed });
|
||||
}
|
||||
} catch (err) {
|
||||
return msg.say('Aborting Softban.');
|
||||
|
||||
Reference in New Issue
Block a user