Фиксыыыы

This commit is contained in:
JonnyBro 2022-02-15 01:40:18 +05:00
parent 744b4e1f01
commit 84868cfe64
6 changed files with 17 additions and 12 deletions

View file

@ -22,10 +22,8 @@ class Announcement extends Command {
if (!text) return message.error("moderation/announcement:MISSING_TEXT");
if (text.length > 1030) return message.error("moderation/announcement:TOO_LONG");
message.delete().catch(() => {});
let mention = null;
const msg = await message.sendT("moderation/announcement:MENTION_PROMPT");
const msg = await message.channel.send(message.translate("moderation/announcement:MENTION_PROMPT"));
const filter = m => m.author.id === message.author.id;
const collector = new Discord.MessageCollector(message.channel, {
@ -38,12 +36,14 @@ class Announcement extends Command {
tmsg.delete();
msg.delete();
collector.stop(true);
message.delete();
}
if (tmsg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) {
tmsg.delete();
msg.delete();
const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT");
const tmsg1 = await message.channel.send(message.translate("moderation/announcement:MENTION_TYPE_PROMPT"));
const filter = m => m.author.id === message.author.id;
const c = new Discord.MessageCollector(message.channel, {
@ -65,9 +65,12 @@ class Announcement extends Command {
c.stop(true);
}
});
c.on("end", (collected, reason) => {
if (reason === "time") return message.error("misc:TIMES_UP");
});
message.delete();
}
});

View file

@ -58,12 +58,12 @@ class Ban extends Command {
reason
}).then(() => {
// Send a success message in the current channel
message.sendT("moderation/ban:BANNED", {
message.channel.send(message.translate("moderation/ban:BANNED", {
username: user.tag,
server: message.guild.name,
moderator: message.author.tag,
reason
});
}));
const caseInfo = {
channel: message.channel.id,

View file

@ -18,7 +18,8 @@ class Clear extends Command {
async run(message, args) {
if (args[0] === "all") {
message.sendT("moderation/clear:ALL_CONFIRM");
message.channel.send(message.translate("moderation/clear:ALL_CONFIRM"));
await message.channel.awaitMessages((m) => (m.author.id === message.author.id) && (m.content === "confirm"), {
max: 1,
time: 20000,
@ -26,6 +27,7 @@ class Clear extends Command {
}).catch(() => {
return message.error("misc:TIMES_UP");
});
const position = message.channel.position;
const newChannel = await message.channel.clone();
await message.channel.delete();

View file

@ -47,12 +47,12 @@ class Kick extends Command {
// Kick the user
member.kick(reason).then(() => {
// Send a success message in the current channel
message.sendT("moderation/kick:KICKED", {
message.channel.send(message.translate("moderation/kick:KICKED", {
username: member.user.tag,
server: message.guild.name,
moderator: message.author.tag,
reason
});
}));
data.guild.casesCount++;
data.guild.save();

View file

@ -22,7 +22,7 @@ class Poll extends Command {
if (!question) return message.error("moderation/poll:MISSING_QUESTION");
let mention = null;
const msg = await message.sendT("moderation/announcement:MENTION_PROMPT");
const msg = await message.channel.send(message.translate("moderation/announcement:MENTION_PROMPT"));
const filter = m => m.author.id === message.author.id;
const collector = new Discord.MessageCollector(message.channel, {
@ -42,7 +42,7 @@ class Poll extends Command {
if (tmsg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) {
tmsg.delete();
msg.delete();
const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT");
const tmsg1 = await message.channel.send(message.translate("moderation/announcement:MENTION_TYPE_PROMPT"));
const filter = m => m.author.id === message.author.id;
const c = new Discord.MessageCollector(message.channel, {

View file

@ -200,7 +200,7 @@ module.exports = class {
try {
cmd.run(message, args, data);
if (cmd.help.category === "Moderation" && data.guild.autoDeleteModCommands) message.delete();
if (cmd.help.category === "Moderation" && data.guild.autoDeleteModCommands) setTimeout(() => message.delete(), 3000);
} catch (e) {
console.error(e);
return message.error("misc:ERR_OCCURRED");