mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-17 21:40:51 +02:00
Catch some stuff
This commit is contained in:
@@ -50,10 +50,14 @@ module.exports = class BanCommand extends Command {
|
||||
} catch (err) {
|
||||
await msg.say('Failed to send DM.');
|
||||
}
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason}`
|
||||
});
|
||||
try {
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason}`
|
||||
});
|
||||
} catch (err) {
|
||||
return msg.say(`Failed to ban ${member.user.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully banned ${member.user.tag}.`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ module.exports = class HackbanCommand extends Command {
|
||||
reason: `${msg.author.tag}: ${reason}`
|
||||
});
|
||||
} catch (err) {
|
||||
return msg.say(`Could not hackban the user: \`${err.message}\``);
|
||||
return msg.say(`Failed to hackban ${user.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully hackbanned ${user.tag}.`);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,11 @@ module.exports = class KickCommand extends Command {
|
||||
} catch (err) {
|
||||
await msg.say('Failed to send DM.');
|
||||
}
|
||||
await member.kick(`${msg.author.tag}: ${reason}`);
|
||||
try {
|
||||
await member.kick(`${msg.author.tag}: ${reason}`);
|
||||
} catch (err) {
|
||||
return msg.say(`Failed to kick ${member.user.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully kicked ${member.user.tag}.`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -50,11 +50,15 @@ module.exports = class SoftbanCommand extends Command {
|
||||
} 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');
|
||||
try {
|
||||
await member.ban({
|
||||
days: 7,
|
||||
reason: `${msg.author.tag}: ${reason} (Softban)`
|
||||
});
|
||||
await msg.guild.unban(member.user, 'Softban');
|
||||
} catch (err) {
|
||||
return msg.say(`Failed to softban ${member.user.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully softbanned ${member.user.tag}.`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -38,7 +38,11 @@ module.exports = class UnbanCommand extends Command {
|
||||
await msg.say(`Are you sure you want to unban ${member.tag} (${member.id})?`);
|
||||
const verification = await verify(msg.channel, msg.author);
|
||||
if (!verification) return msg.say('Aborting.');
|
||||
await msg.guild.unban(member, `${msg.author.tag}: ${reason}`);
|
||||
try {
|
||||
await msg.guild.unban(member, `${msg.author.tag}: ${reason}`);
|
||||
} catch (err) {
|
||||
return msg.say(`Failed to unban ${member.tag}: \`${err.message}\`.`);
|
||||
}
|
||||
return msg.say(`Successfully unbanned ${member.tag}.`);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user