3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-14 05:57:18 +00:00

Move verbose errors

This commit is contained in:
Dark 2020-11-20 02:13:37 +01:00
parent 8b1d6a0ba0
commit 2e521aadd7

View file

@ -155,23 +155,34 @@ export const VcmoveAllCmd = utilityCmd({
return; return;
} }
let moveAmt = 0; // Cant leave null, otherwise we get an assignment error in the catch
let currMember = msg.member;
const moveAmt = args.oldChannel.voiceMembers.size;
try { try {
for (const memberWithId of args.oldChannel.voiceMembers) { for (const memberWithId of args.oldChannel.voiceMembers) {
moveAmt++; currMember = memberWithId[1];
memberWithId[1].edit({
currMember.edit({
channelID: channel.id, channelID: channel.id,
}); });
pluginData.state.logs.log(LogType.VOICE_CHANNEL_FORCE_MOVE, { pluginData.state.logs.log(LogType.VOICE_CHANNEL_FORCE_MOVE, {
mod: stripObjectToScalars(msg.author), mod: stripObjectToScalars(msg.author),
member: stripObjectToScalars(memberWithId[1], ["user", "roles"]), member: stripObjectToScalars(currMember, ["user", "roles"]),
oldChannel: stripObjectToScalars(args.oldChannel), oldChannel: stripObjectToScalars(args.oldChannel),
newChannel: stripObjectToScalars(channel), newChannel: stripObjectToScalars(channel),
}); });
} }
} catch (e) { } catch (e) {
msg.channel.createMessage(errorMessage(`Failed to move the ${moveAmt} member we tried to move.`)); if (msg.member.id === currMember.id) {
sendErrorMessage(pluginData, msg.channel, "Unknown error when trying to move members");
return;
}
sendErrorMessage(
pluginData,
msg.channel,
`Failed to move ${currMember.username}#${currMember.discriminator} (${currMember.id})`,
);
return; return;
} }