ban&unban bug fix, err embed now del after 15s
This commit is contained in:
parent
a0f9dff2bf
commit
49e5bee0d4
3 changed files with 45 additions and 25 deletions
|
@ -18,7 +18,26 @@ module.exports = {
|
||||||
let reason = args.slice(1).join(" ") || "No reason provided";
|
let reason = args.slice(1).join(" ") || "No reason provided";
|
||||||
if (!target) {
|
if (!target) {
|
||||||
try {
|
try {
|
||||||
target = await client.users.fetch(args[0]);
|
const one = await client.users.fetch(args[0]);
|
||||||
|
if (one.id === message.author.id)
|
||||||
|
return client.err(message, "Moderation", "ban", 2);
|
||||||
|
if (reason.length > 1024) reason = reason.slice(0, 1021) + "...";
|
||||||
|
const embed = new MessageEmbed()
|
||||||
|
.setTitle("User Banned")
|
||||||
|
.addField("**Moderator**", message.author.tag, true)
|
||||||
|
.addField("**User**", one.tag, true)
|
||||||
|
.addField("**Reason**", reason, true)
|
||||||
|
.setFooter(
|
||||||
|
message.member.displayName || message.author.username,
|
||||||
|
message.author.displayAvatarURL({ dynamic: true })
|
||||||
|
)
|
||||||
|
.setThumbnail(client.user.displayAvatarURL())
|
||||||
|
.setColor(client.color)
|
||||||
|
.setTimestamp();
|
||||||
|
message.inlineReply(embed);
|
||||||
|
await message.guild.members.ban(one.id, {
|
||||||
|
reason: reason,
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
return client.err(message, "Moderation", "ban", 1);
|
return client.err(message, "Moderation", "ban", 1);
|
||||||
|
@ -32,28 +51,29 @@ module.exports = {
|
||||||
message.guild.me.roles.highest.position < target.roles.highest.position
|
message.guild.me.roles.highest.position < target.roles.highest.position
|
||||||
)
|
)
|
||||||
return client.err(message, "Moderation", "ban", 9);
|
return client.err(message, "Moderation", "ban", 9);
|
||||||
}
|
|
||||||
if (reason.length > 1024) reason = reason.slice(0, 1021) + "...";
|
if (reason.length > 1024) reason = reason.slice(0, 1021) + "...";
|
||||||
try {
|
try {
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setTitle("User Banned")
|
.setTitle("User Banned")
|
||||||
.addField("**Moderator**", message.author.tag, true)
|
.addField("**Moderator**", message.author.tag, true)
|
||||||
.addField("**User**", target.user.tag, true)
|
.addField("**User**", target.user.tag, true)
|
||||||
.addField("**Reason**", reason, true)
|
.addField("**Reason**", reason, true)
|
||||||
.setFooter(
|
.setFooter(
|
||||||
message.member.displayName || message.author.username,
|
message.member.displayName || message.author.username,
|
||||||
message.author.displayAvatarURL({ dynamic: true })
|
message.author.displayAvatarURL({ dynamic: true })
|
||||||
)
|
)
|
||||||
.setThumbnail(client.user.displayAvatarURL())
|
.setThumbnail(client.user.displayAvatarURL())
|
||||||
.setColor(client.color)
|
.setColor(client.color)
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
message.inlineReply(embed);
|
message.inlineReply(embed);
|
||||||
await message.guild.members.ban(target.id, {
|
await message.guild.members.ban(target.id, {
|
||||||
reason: reason,
|
reason: reason,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
return client.err(message, "Moderation", "ban", 999);
|
return client.err(message, "Moderation", "ban", 999);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,7 @@ module.exports = {
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setTitle("User Unbanned")
|
.setTitle("User Unbanned")
|
||||||
.addField("**Moderator**", message.author.tag, true)
|
.addField("**Moderator**", message.author.tag, true)
|
||||||
.addField("**User**", user.user.tag, true)
|
.addField("**User**", user.tag, true)
|
||||||
.setFooter(
|
.setFooter(
|
||||||
message.member.displayName || message.author.username,
|
message.member.displayName || message.author.username,
|
||||||
message.author.displayAvatarURL({ dynamic: true })
|
message.author.displayAvatarURL({ dynamic: true })
|
||||||
|
|
|
@ -203,5 +203,5 @@ module.exports = async (message, dir, file, err) => {
|
||||||
.setThumbnail(client.user.displayAvatarURL({ dynamic: false }))
|
.setThumbnail(client.user.displayAvatarURL({ dynamic: false }))
|
||||||
.setURL(client.web)
|
.setURL(client.web)
|
||||||
.setFooter(`Made by ${client.author}`);
|
.setFooter(`Made by ${client.author}`);
|
||||||
message.inlineReply(embed).then(msg => msg.delete({ timeout: 10000 }));
|
message.inlineReply(embed).then(msg => msg.delete({ timeout: 15000 }));
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue