diff --git a/commands/Administration/automod.js b/commands/Administration/automod.js index 222d8efd..45d3caed 100644 --- a/commands/Administration/automod.js +++ b/commands/Administration/automod.js @@ -38,8 +38,8 @@ class Automod extends BaseCommand { * @param {Object} data */ async execute(client, interaction, data) { - const state = interaction.options.getBoolean("state"); - const channel = interaction.options.getChannel("channel"); + const state = interaction.options.getBoolean("state"), + channel = interaction.options.getChannel("channel"); if (state) { data.guildData.plugins.automod = { @@ -48,12 +48,14 @@ class Automod extends BaseCommand { }; data.guildData.markModified("plugins.automod"); await data.guildData.save(); + return interaction.success("administration/automod:ENABLED"); } else { if (channel) { data.guildData.plugins.automod.ignored.push(channel); data.guildData.markModified("plugins.automod"); await data.guildData.save(); + interaction.success("administration/automod:DISABLED_CHANNEL", { channel: channel.toString(), }); @@ -64,6 +66,7 @@ class Automod extends BaseCommand { }; data.guildData.markModified("plugins.automod"); await data.guildData.save(); + interaction.success("administration/automod:DISABLED"); } } diff --git a/commands/Administration/config.js b/commands/Administration/config.js index 76304520..45ca1225 100644 --- a/commands/Administration/config.js +++ b/commands/Administration/config.js @@ -132,9 +132,9 @@ class Config extends BaseCommand { ephemeral: true, }); } else { - const setting = interaction.options.getString("setting"); - const state = interaction.options.getBoolean("state"); - const channel = interaction.options.getChannel("channel"); + const setting = interaction.options.getString("setting"), + state = interaction.options.getBoolean("state"), + channel = interaction.options.getChannel("channel"); await changeSetting(interaction, setting, state, channel); } @@ -154,6 +154,7 @@ async function changeSetting(interaction, setting, state, channel) { interaction.guild.data.plugins[setting] = null; interaction.guild.data.markModified(`plugins.${setting}`); await interaction.guild.data.save(); + return interaction.reply({ content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:DISABLED")}**`, ephemeral: true, @@ -163,6 +164,7 @@ async function changeSetting(interaction, setting, state, channel) { interaction.guild.data.plugins[setting] = channel.id; interaction.guild.data.markModified(`plugins.${setting}`); await interaction.guild.data.save(); + return interaction.reply({ content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`, ephemeral: true, diff --git a/commands/Administration/goodbye.js b/commands/Administration/goodbye.js index 98da6a5b..eb2d3587 100644 --- a/commands/Administration/goodbye.js +++ b/commands/Administration/goodbye.js @@ -51,7 +51,8 @@ class Goodbye extends BaseCommand { if (command === "test") { client.emit("guildMemberRemove", interaction.member); - return interaction.success("administration/goodbye:TEST_SUCCESS", null, { ephemeral: true }); + + interaction.success("administration/goodbye:TEST_SUCCESS", null, { ephemeral: true }); } else { const state = interaction.options.getBoolean("state"); diff --git a/commands/Administration/selectroles.js b/commands/Administration/selectroles.js index d93f32af..3e9f6d8f 100644 --- a/commands/Administration/selectroles.js +++ b/commands/Administration/selectroles.js @@ -85,9 +85,10 @@ class Selectroles extends BaseCommand { }, { edit: true }); }); } else if (command === "addrole") { - const channel = interaction.options.getChannel("channel"); - const message_id = interaction.options.getString("message_id"); - const message = await channel.messages.fetch(message_id); + const channel = interaction.options.getChannel("channel"), + message_id = interaction.options.getString("message_id"), + message = await channel.messages.fetch(message_id); + if (!message || message.author.id !== client.user.id) return interaction.error("administration/selectroles:MESSAGE_ROLE", null, { edit: true }); const role = interaction.options.getRole("role"); diff --git a/commands/Administration/set.js b/commands/Administration/set.js index aa024faf..88e40bbd 100644 --- a/commands/Administration/set.js +++ b/commands/Administration/set.js @@ -47,14 +47,15 @@ class Set extends BaseCommand { * @param {Object} data */ async execute(client, interaction) { - const type = interaction.options.getString("type"); - const member = interaction.options.getMember("user"); + const type = interaction.options.getString("type"), + member = interaction.options.getMember("user"); if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true }); const memberData = await client.findOrCreateMember({ id: member.id, guildId: interaction.guildId, }); + const int = interaction.options.getInteger("int"); if (int < 0) return interaction.error("administration/set:INVALID_NUMBER", null, { ephemeral: true }); diff --git a/commands/Administration/setlang.js b/commands/Administration/setlang.js index 4afed238..59001fe2 100644 --- a/commands/Administration/setlang.js +++ b/commands/Administration/setlang.js @@ -39,8 +39,8 @@ class Setlang extends BaseCommand { * @param {Object} data */ async execute(client, interaction, data) { - const lang = interaction.options.getString("language"); - const language = client.languages.find(l => l.name === lang); + const lang = interaction.options.getString("language"), + language = client.languages.find(l => l.name === lang); data.guildData.language = language.name; await data.guildData.save(); diff --git a/commands/Administration/stealemoji.js b/commands/Administration/stealemoji.js index 82c33121..f3f2bf66 100644 --- a/commands/Administration/stealemoji.js +++ b/commands/Administration/stealemoji.js @@ -35,8 +35,8 @@ class Stealemoji extends BaseCommand { * @param {Object} data */ async execute(client, interaction) { - const parsedEmoji = parseEmoji(interaction.options.getString("emoji")); - const ext = parsedEmoji.animated ? "gif" : "png"; + const parsedEmoji = parseEmoji(interaction.options.getString("emoji")), + ext = parsedEmoji.animated ? "gif" : "png"; interaction.guild.emojis .create({ diff --git a/commands/Administration/welcome.js b/commands/Administration/welcome.js index 1b1c40f0..39f2999c 100644 --- a/commands/Administration/welcome.js +++ b/commands/Administration/welcome.js @@ -51,7 +51,8 @@ class Welcome extends BaseCommand { if (command === "test") { client.emit("guildMemberAdd", interaction.member); - return interaction.success("administration/goodbye:TEST_SUCCESS", null, { ephemeral: true }); + + interaction.success("administration/goodbye:TEST_SUCCESS", null, { ephemeral: true }); } else { const state = interaction.options.getBoolean("state"); diff --git a/commands/Economy/achievements.js b/commands/Economy/achievements.js index 59c45243..6cf515eb 100644 --- a/commands/Economy/achievements.js +++ b/commands/Economy/achievements.js @@ -35,6 +35,7 @@ class Achievements extends BaseCommand { async execute(client, interaction, data) { const user = interaction.options.getUser("user") || interaction.member; if (user.bot) return interaction.error("economy/profile:BOT_USER"); + const userData = (user.id === interaction.user.id ? data.userData : await client.findOrCreateUser({ id: user.id, })); diff --git a/commands/Economy/birthdate.js b/commands/Economy/birthdate.js index cdaf95b9..d45274cb 100644 --- a/commands/Economy/birthdate.js +++ b/commands/Economy/birthdate.js @@ -54,9 +54,9 @@ class Birthdate extends BaseCommand { * @param {Object} data */ async execute(client, interaction, data) { - const day = interaction.options.getInteger("day"); - const month = interaction.options.getInteger("month"); - const year = interaction.options.getInteger("year"); + const day = interaction.options.getInteger("day"), + month = interaction.options.getInteger("month"), + year = interaction.options.getInteger("year"); const d = new Date(year, month - 1, day); if (!(day == d.getDate() && month - 1 == d.getMonth() && year == d.getFullYear())) return interaction.error("economy/birthdate:INVALID_DATE"); diff --git a/commands/Economy/leaderboard.js b/commands/Economy/leaderboard.js index 59e43dcd..1c145ef0 100644 --- a/commands/Economy/leaderboard.js +++ b/commands/Economy/leaderboard.js @@ -69,8 +69,8 @@ class Leaderboard extends BaseCommand { membersLeaderboard.sort((a, b) => b.money - a.money); if (membersLeaderboard.length > 20) membersLeaderboard.length = 20; - let userNames = ""; - let money = ""; + let userNames = "", + money = ""; for (let i = 0; i < membersLeaderboard.length; i++) { const data = membersLeaderboard[i]; @@ -113,9 +113,9 @@ class Leaderboard extends BaseCommand { membersLeaderboard.sort((a, b) => b.level - a.level); if (membersLeaderboard.length > 20) membersLeaderboard.length = 20; - const userNames = []; - const level = []; - const xp = []; + const userNames = [], + level = [], + xp = []; for (let i = 0; i < membersLeaderboard.length; i++) { const data = membersLeaderboard[i]; @@ -166,8 +166,8 @@ class Leaderboard extends BaseCommand { usersLeaderboard.sort((a, b) => b.rep - a.rep); if (usersLeaderboard.length > 20) usersLeaderboard.length = 20; - let userNames = ""; - let rep = ""; + let userNames = "", + rep = ""; for (let i = 0; i < usersLeaderboard.length; i++) { const data = usersLeaderboard[i]; diff --git a/commands/Economy/marry.js b/commands/Economy/marry.js index 1d520a81..286b764e 100644 --- a/commands/Economy/marry.js +++ b/commands/Economy/marry.js @@ -36,9 +36,11 @@ class Marry extends BaseCommand { */ async execute(client, interaction, data) { if (data.userData.lover) return interaction.error("economy/marry:ALREADY_MARRIED"); + const member = interaction.options.getMember("user"); if (member.user.bot) return interaction.error("economy/marry:BOT_USER"); if (member.id === interaction.member.id) return interaction.error("economy/marry:YOURSELF"); + const userData = await client.findOrCreateUser({ id: member.id, }); diff --git a/commands/Economy/pay.js b/commands/Economy/pay.js index 6bbbf422..871482fc 100644 --- a/commands/Economy/pay.js +++ b/commands/Economy/pay.js @@ -40,10 +40,9 @@ class Pay extends BaseCommand { const member = interaction.options.getMember("user"); if (member.user.bot) return interaction.error("economy/pay:BOT_USER"); if (member.id === interaction.member.id) return interaction.error("economy/pay:YOURSELF"); + const amount = interaction.options.getInteger("amount"); if (amount <= 0) return interaction.error("misc:MORE_THAN_ZERO"); - - if (amount > data.memberData.money) return interaction.error("economy/pay:ENOUGH_MONEY", { amount: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDITS:1"), interaction.translate("misc:NOUNS:CREDITS:2"), interaction.translate("misc:NOUNS:CREDITS:5"))}`, }); diff --git a/commands/Economy/profile.js b/commands/Economy/profile.js index 1513cebf..d8ba96a6 100644 --- a/commands/Economy/profile.js +++ b/commands/Economy/profile.js @@ -50,6 +50,7 @@ class Profile extends BaseCommand { id: member.id, guildId: interaction.guildId, })); + const userData = (member.id === interaction.user.id ? data.userData : await client.findOrCreateUser({ id: member.id, })); diff --git a/commands/Economy/rep.js b/commands/Economy/rep.js index 463fea7f..84e90ffe 100644 --- a/commands/Economy/rep.js +++ b/commands/Economy/rep.js @@ -47,6 +47,7 @@ class Rep extends BaseCommand { const toWait = Date.now() + 21600000; // 12 hours if (!data.userData.cooldowns) data.userData.cooldowns = {}; + data.userData.cooldowns.rep = toWait; data.userData.markModified("cooldowns"); await data.userData.save(); diff --git a/commands/Economy/rob.js b/commands/Economy/rob.js index 5a304078..d48b6c40 100644 --- a/commands/Economy/rob.js +++ b/commands/Economy/rob.js @@ -40,6 +40,7 @@ class Rob extends BaseCommand { const member = interaction.options.getMember("user"); if (member.user.bot) return interaction.error("economy/pay:BOT_USER"); if (member.id === interaction.member.id) return interaction.error("economy/rob:YOURSELF"); + const amount = interaction.options.getInteger("amount"); if (amount <= 0) return interaction.error("misc:MORE_THAN_ZERO"); @@ -63,29 +64,36 @@ class Rob extends BaseCommand { const itsAWon = Math.floor(client.functions.randomNum(0, 100) < 25); if (itsAWon) { - const toWait = Date.now() + (6 * 60 * 60 * 1000); + const toWait = Date.now() + (6 * 60 * 60 * 1000), + randomNum = client.functions.randomNum(1, 2); + memberData.cooldowns.rob = toWait; memberData.markModified("cooldowns"); await memberData.save(); - const randomNum = client.functions.randomNum(1, 2); + interaction.replyT("economy/rob:ROB_WON_" + randomNum, { money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, user: member.toString(), }); + data.memberData.money += amount; memberData.money -= amount; + await memberData.save(); await data.memberData.save(); } else { - const won = Math.floor(amount * 0.9); - const randomNum = client.functions.randomNum(1, 2); + const won = Math.floor(amount * 0.9), + randomNum = client.functions.randomNum(1, 2); + interaction.replyT("economy/rob:ROB_LOSE_" + randomNum, { fine: `**${potentiallyLose}** ${client.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, offset: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, user: member.toString(), }); + data.memberData.money -= potentiallyLose; memberData.money += won; + await memberData.save(); await data.memberData.save(); } diff --git a/commands/Fun/lovecalc.js b/commands/Fun/lovecalc.js index 9caf92b9..075c5c45 100644 --- a/commands/Fun/lovecalc.js +++ b/commands/Fun/lovecalc.js @@ -39,11 +39,11 @@ class Lovecalc extends BaseCommand { * @param {Object} data */ async execute(client, interaction) { - const firstMember = interaction.options.getMember("first_member"); - const secondMember = interaction.options.getMember("second_member") || interaction.member; + const firstMember = interaction.options.getMember("first_member"), + secondMember = interaction.options.getMember("second_member") || interaction.member; - const members = [firstMember, secondMember].sort((a, b) => parseInt(a.id, 10) - parseInt(b.id, 10)); - const hash = md5(`${members[0].id}${members[1].user.username}${members[0].user.username}${members[1].id}`); + const members = [firstMember, secondMember].sort((a, b) => parseInt(a.id, 10) - parseInt(b.id, 10)), + hash = md5(`${members[0].id}${members[1].user.username}${members[0].user.username}${members[1].id}`); const string = hash .split("") diff --git a/commands/General/report.js b/commands/General/report.js index 9a895da9..e96b4174 100644 --- a/commands/General/report.js +++ b/commands/General/report.js @@ -91,7 +91,7 @@ class Report extends BaseCommand { interaction.success("general/report:SUCCESS", { channel: repChannel.toString(), - }); + }, { ephemeral: true }); } } diff --git a/commands/General/suggest.js b/commands/General/suggest.js index dc01678b..dd6dc015 100644 --- a/commands/General/suggest.js +++ b/commands/General/suggest.js @@ -78,7 +78,7 @@ class Suggest extends BaseCommand { interaction.success("general/suggest:SUCCESS", { channel: suggChannel.toString(), - }); + }, { ephemeral: true }); } } diff --git a/commands/Moderation/clearwarns.js b/commands/Moderation/clearwarns.js index e4c1e88a..c8d1f871 100644 --- a/commands/Moderation/clearwarns.js +++ b/commands/Moderation/clearwarns.js @@ -44,6 +44,7 @@ class Clearwarns extends BaseCommand { memberData.sanctions = []; memberData.save(); + interaction.success("moderation/clearwarns:SUCCESS", { username: member.user.tag, }); diff --git a/commands/Moderation/unban.js b/commands/Moderation/unban.js index 4d79e33e..e28953c3 100644 --- a/commands/Moderation/unban.js +++ b/commands/Moderation/unban.js @@ -35,11 +35,12 @@ class Unban extends BaseCommand { * @param {Object} data */ async execute(client, interaction) { - const id = interaction.options.getString("user_id"); - const banned = await interaction.guild.bans.fetch(); + const id = interaction.options.getString("user_id"), + banned = await interaction.guild.bans.fetch(); + if (!banned.find(u => u.user.id === id)) return interaction.error("moderation/unban:NOT_BANNED", { id }); - interaction.guild.bans.remove(id); + await interaction.guild.bans.remove(id); interaction.success("moderation/unban:UNBANNED", { id, diff --git a/commands/Moderation/warn.js b/commands/Moderation/warn.js index 756ff4ae..2bcbf219 100644 --- a/commands/Moderation/warn.js +++ b/commands/Moderation/warn.js @@ -32,9 +32,10 @@ class Warn extends BaseCommand { * @param {Object} data */ async execute(client, interaction, data) { - const member = interaction.targetMember; - const memberPosition = member.roles.highest.position; - const moderationPosition = interaction.member.roles.highest.position; + const member = interaction.targetMember, + memberPosition = member.roles.highest.position, + moderationPosition = interaction.member.roles.highest.position; + if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true }); if (member.id === interaction.member.id) return interaction.error("moderation/warn:YOURSELF", null, { ephemeral: true }); if (interaction.guild.ownerId !== interaction.member.id && !(moderationPosition > memberPosition)) return interaction.error("moderation/ban:SUPERIOR", null, { ephemeral: true }); @@ -51,6 +52,9 @@ class Warn extends BaseCommand { const reasonInput = new TextInputBuilder() .setCustomId("warn_reason") .setLabel(interaction.translate("moderation/warn:MODAL_REASON")) + .setMinLength(5) + .setMaxLength(200) + .setRequired(true) .setStyle(TextInputStyle.Short); modal.addComponents(new ActionRowBuilder().addComponents(reasonInput)); @@ -58,14 +62,19 @@ class Warn extends BaseCommand { await interaction.showModal(modal); const submitted = await interaction.awaitModalSubmit({ - time: 120000, + time: (2 * 60 * 1000), filter: i => i.user.id === interaction.member.id && i.customId === "warn_modal", + }).catch(() => { + interaction.followUp({ + content: interaction.translate("misc:TIMED_OUT"), + ephemeral: true, + }); }); if (submitted) { const reason = submitted.fields.getTextInputValue("warn_reason"); - const sanctions = memberData.sanctions.filter((s) => s.type === "warn").length; + const sanctions = memberData.sanctions.filter(s => s.type === "warn").length; const banCount = data.guildData.plugins.warnsSanctions.ban; const kickCount = data.guildData.plugins.warnsSanctions.kick; @@ -113,9 +122,11 @@ class Warn extends BaseCommand { .setColor(client.config.embed.color); interaction.guild.members.ban(member).catch(() => {}); - interaction.success("moderation/setwarns:AUTO_BAN", { - username: member.user.tag, - count: `${banCount} ${client.getNoun(banCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}`, + interaction.followUp({ + content: interaction.translate("moderation/setwarns:AUTO_BAN", { + username: member.user.tag, + count: `${banCount} ${client.getNoun(banCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}`, + }), }); } } @@ -140,9 +151,11 @@ class Warn extends BaseCommand { .setColor(client.config.embed.color); member.kick().catch(() => {}); - interaction.success("moderation/setwarns:AUTO_KICK", { - username: member.user.tag, - count: `${kickCount} ${client.getNoun(kickCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}`, + interaction.followUp({ + content: interaction.translate("moderation/setwarns:AUTO_KICK", { + username: member.user.tag, + count: `${kickCount} ${client.getNoun(kickCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}`, + }), }); } } @@ -156,20 +169,12 @@ class Warn extends BaseCommand { }), }); - caseInfo.type = "warn"; embed .setAuthor({ name: interaction.translate("moderation/warn:WARN"), }) .setColor(client.config.embed.color); - submitted.reply({ - content: interaction.translate("moderation/warn:WARNED", { - user: member.toString(), - reason, - }), - }); - memberData.sanctions.push(caseInfo); memberData.save(); @@ -181,6 +186,13 @@ class Warn extends BaseCommand { embeds: [embed], }); } + + return submitted.reply({ + content: interaction.translate("moderation/warn:WARNED", { + user: member.toString(), + reason, + }), + }); } } } diff --git a/commands/Moderation/warns.js b/commands/Moderation/warns.js index 6419a96a..63b12df0 100644 --- a/commands/Moderation/warns.js +++ b/commands/Moderation/warns.js @@ -69,7 +69,7 @@ class Warns extends BaseCommand { memberData.sanctions.forEach(sanction => { embed.addFields([ { - name: sanction.type + " | #" + sanction.case, + name: sanction.type, value: `${interaction.translate("common:MODERATOR")}: <@${sanction.moderator}>\n${interaction.translate("common:REASON")}: ${sanction.reason}`, inline: true, }, diff --git a/commands/Music/back.js b/commands/Music/back.js index e404e43a..b2414936 100644 --- a/commands/Music/back.js +++ b/commands/Music/back.js @@ -33,6 +33,7 @@ class Back extends BaseCommand { async execute(client, interaction) { const voice = interaction.member.voice.channel; if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { ephemeral: true }); + const queue = client.player.getQueue(interaction.guildId); if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { ephemeral: true }); if (!queue.previousTracks[0]) return interaction.error("music/back:NO_PREV_SONG", null, { ephemeral: true }); diff --git a/commands/Music/clips.js b/commands/Music/clips.js index f8f7c551..11f67000 100644 --- a/commands/Music/clips.js +++ b/commands/Music/clips.js @@ -156,6 +156,7 @@ class Clips extends BaseCommand { } else { const voice = interaction.member.voice.channel; if (!voice) return interaction.editReply({ content: interaction.translate("music/play:NO_VOICE_CHANNEL") }); + const queue = client.player.getQueue(interaction.guild.id); if (queue) return interaction.editReply({ content: interaction.translate("music/clips:ACTIVE_QUEUE") }); if (getVoiceConnection(interaction.guild.id)) return interaction.editReply({ content: interaction.translate("music/clips:ACTIVE_CLIP") }); diff --git a/commands/Music/loop.js b/commands/Music/loop.js index 7815a129..9660881e 100644 --- a/commands/Music/loop.js +++ b/commands/Music/loop.js @@ -43,13 +43,14 @@ class Loop extends BaseCommand { async execute(client, interaction) { const voice = interaction.member.voice.channel; if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { edit: true }); + const queue = client.player.getQueue(interaction.guildId); if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { edit: true }); - const type = interaction.options.getString("option"); - const mode = type === "3" ? QueueRepeatMode.AUTOPLAY : - type === "2" ? QueueRepeatMode.QUEUE : - type === "1" ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF; + const type = interaction.options.getString("option"), + mode = type === "3" ? QueueRepeatMode.AUTOPLAY : + type === "2" ? QueueRepeatMode.QUEUE : + type === "1" ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF; queue.setRepeatMode(mode); diff --git a/commands/Music/nowplaying.js b/commands/Music/nowplaying.js index 464ec4fc..27ab4983 100644 --- a/commands/Music/nowplaying.js +++ b/commands/Music/nowplaying.js @@ -36,8 +36,8 @@ class Nowplaying extends BaseCommand { const queue = client.player.getQueue(interaction.guildId); if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { edit: true }); - const progressBar = queue.createProgressBar(); - const track = queue.current; + const progressBar = queue.createProgressBar(), + track = queue.current; const embed = new EmbedBuilder() .setAuthor({ diff --git a/commands/Music/play.js b/commands/Music/play.js index 3e01403c..86584046 100644 --- a/commands/Music/play.js +++ b/commands/Music/play.js @@ -36,9 +36,10 @@ class Play extends BaseCommand { async execute(client, interaction) { await interaction.deferReply(); - const voice = interaction.member.voice.channel; + const query = interaction.options.getString("query"), + voice = interaction.member.voice.channel; if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { edit: true }); - const query = interaction.options.getString("query"); + const perms = voice.permissionsFor(client.user); if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.error("music/play:VOICE_CHANNEL_CONNECT", null, { edit: true }); diff --git a/commands/Music/seek.js b/commands/Music/seek.js index d15732f1..f7c2db66 100644 --- a/commands/Music/seek.js +++ b/commands/Music/seek.js @@ -33,11 +33,12 @@ class Seek extends BaseCommand { * @param {Object} data */ async execute(client, interaction) { - const voice = interaction.member.voice.channel; + const time = interaction.options.getInteger("time"), + voice = interaction.member.voice.channel; if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL"); + const queue = client.player.getQueue(interaction.guildId); if (!queue) return interaction.error("music/play:NOT_PLAYING"); - const time = interaction.options.getInteger("time"); queue.seek(time * 1000); interaction.success("music/seek:SUCCESS", { diff --git a/commands/Music/shuffle.js b/commands/Music/shuffle.js index 19cf207f..a74c6348 100644 --- a/commands/Music/shuffle.js +++ b/commands/Music/shuffle.js @@ -33,6 +33,7 @@ class Shuffle extends BaseCommand { async execute(client, interaction) { const voice = interaction.member.voice.channel; if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { ephemeral: true }); + const queue = client.player.getQueue(interaction.guildId); if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { ephemeral: true }); diff --git a/commands/Music/skip.js b/commands/Music/skip.js index 5da884e1..06e32650 100644 --- a/commands/Music/skip.js +++ b/commands/Music/skip.js @@ -33,6 +33,7 @@ class Skip extends BaseCommand { async execute(client, interaction) { const voice = interaction.member.voice.channel; if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL"); + const queue = client.player.getQueue(interaction.guildId); if (!queue) return interaction.error("music/play:NOT_PLAYING"); diff --git a/commands/Music/skipto.js b/commands/Music/skipto.js index 74b9b2a7..ceb4e5cc 100644 --- a/commands/Music/skipto.js +++ b/commands/Music/skipto.js @@ -35,12 +35,13 @@ class Skipto extends BaseCommand { */ async execute(client, interaction) { const voice = interaction.member.voice.channel; - const queue = client.player.getQueue(interaction.guildId); - const position = interaction.options.getInteger("position"); - if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL"); + + const queue = client.player.getQueue(interaction.guildId); if (!queue) return interaction.error("music/play:NOT_PLAYING"); - if (position < 0) return interaction.error("music/skipto:NO_PREV_SONG"); + + const position = interaction.options.getInteger("position"); + if (position <= 0) return interaction.error("music/skipto:NO_PREV_SONG"); if (queue.tracks[position - 1]) { queue.skipTo(queue.tracks[position - 1]); diff --git a/commands/Music/stop.js b/commands/Music/stop.js index 8ae602e3..5cb77015 100644 --- a/commands/Music/stop.js +++ b/commands/Music/stop.js @@ -33,6 +33,7 @@ class Stop extends BaseCommand { async execute(client, interaction) { const voice = interaction.member.voice.channel; if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL"); + const queue = client.player.getQueue(interaction.guildId); if (!queue) return interaction.error("music/play:NOT_PLAYING"); diff --git a/commands/Owner/announcement.js b/commands/Owner/announcement.js index 76afb569..ab4ecb69 100644 --- a/commands/Owner/announcement.js +++ b/commands/Owner/announcement.js @@ -54,6 +54,7 @@ class Announcement extends BaseCommand { client.guilds.cache.forEach(async guild => { if (guild.id === "568120814776614924") return; + const channel = guild.channels.cache.get(guild?.data.plugins.news); await channel.send({ content: `${interaction.options.getBoolean("tag") ? "||@everyone|| " : ""}ВАЖНОЕ ОБЪЯВЛЕНИЕ!`, diff --git a/commands/Owner/debug.js b/commands/Owner/debug.js index 748be66b..93348c12 100644 --- a/commands/Owner/debug.js +++ b/commands/Owner/debug.js @@ -72,17 +72,20 @@ class Debug extends BaseCommand { const command = interaction.options.getSubcommand(); if (command === "set") { - const type = interaction.options.getString("type"); + const type = interaction.options.getString("type"), + int = interaction.options.getInteger("int"); + const member = interaction.options.getMember("user"); if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true }); + const userData = await client.findOrCreateUser({ - id: member.id, - }); - const memberData = await client.findOrCreateMember({ - id: member.id, - guildId: interaction.guildId, - }); - const int = interaction.options.getInteger("int"); + id: member.id, + }), + memberData = await client.findOrCreateMember({ + id: member.id, + guildId: interaction.guildId, + }); + switch (type) { case "level": { @@ -131,17 +134,19 @@ class Debug extends BaseCommand { } } } else { - const type = interaction.options.getString("type"); + const type = interaction.options.getString("type"), + int = interaction.options.getInteger("int"); + const member = interaction.options.getMember("target"); if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true }); + const userData = await client.findOrCreateUser({ - id: member.id, - }); - const memberData = await client.findOrCreateMember({ - id: member.id, - guildId: interaction.guildId, - }); - const int = interaction.options.getInteger("int"); + id: member.id, + }), + memberData = await client.findOrCreateMember({ + id: member.id, + guildId: interaction.guildId, + }); switch (type) { case "level": { diff --git a/commands/Owner/eval.js b/commands/Owner/eval.js index 600a9ce4..48151d56 100644 --- a/commands/Owner/eval.js +++ b/commands/Owner/eval.js @@ -42,16 +42,16 @@ class Eval extends BaseCommand { return result.then(output => { if (typeof output != "string") output = require("util").inspect(output, { depth: 0 }); - if (output.includes(client.token)) output = output.replace(client.token, "T0K3N"); + interaction.editReply({ content: "```js\n" + output + "```", }); }).catch(err => { - console.error(err); + console.log(err); err = err.toString(); - if (err.includes(client.token)) err = err.replace(client.token, "T0K3N"); + interaction.editReply({ content: "```js\n" + err + "```", }); diff --git a/commands/Owner/reload.js b/commands/Owner/reload.js index 09e83133..33e149af 100644 --- a/commands/Owner/reload.js +++ b/commands/Owner/reload.js @@ -36,8 +36,8 @@ class Reload extends BaseCommand { * @param {Object} data */ async execute(client, interaction) { - const command = interaction.options.getString("command"); - const cmd = client.commands.get(command); + const command = interaction.options.getString("command"), + cmd = client.commands.get(command); if (!cmd) return interaction.error("owner/reload:NOT_FOUND", { command }, { ephemeral: true }); await client.unloadCommand(`../commands/${cmd.category}`, cmd.command.name); diff --git a/commands/Owner/say.js b/commands/Owner/say.js index 92b5fad4..43d950ec 100644 --- a/commands/Owner/say.js +++ b/commands/Owner/say.js @@ -37,8 +37,9 @@ class Say extends BaseCommand { */ async execute(client, interaction) { await interaction.deferReply({ ephemeral: true }); - const message = interaction.options.getString("message"); - const channel = interaction.options.getChannel("channel"); + + const message = interaction.options.getString("message"), + channel = interaction.options.getChannel("channel"); if (!channel) { interaction.channel.sendTyping(); diff --git a/dashboard/public/docs/updates.md b/dashboard/public/docs/updates.md index 4bc4b6a9..3d9ebe6b 100644 --- a/dashboard/public/docs/updates.md +++ b/dashboard/public/docs/updates.md @@ -1,3 +1,10 @@ +### JaBa v4.1.19 +* Изменения + * Мелкие внутренние изменения. + +* Исправления + * Ошибки *warn*. + ### JaBa v4.1.18 * Изменения * Обновление зависимостей. diff --git a/helpers/tictactoe.js b/helpers/tictactoe.js index 5ac7b37c..4b70b7c5 100644 --- a/helpers/tictactoe.js +++ b/helpers/tictactoe.js @@ -110,7 +110,7 @@ async function tictactoe(interaction, options = {}) { const collector = m.createMessageComponentCollector({ componentType: ComponentType.Button, - time: 5000, + time: (5 * 1000), }); collector.on("collect", async button => { if (button.user.id !== opponent.id) @@ -664,7 +664,7 @@ async function tictactoe(interaction, options = {}) { const collector = m.createMessageComponentCollector({ componentType: ComponentType.Button, max: 1, - time: 5000, + time: (5 * 1000), }); collector.on("collect", b => { @@ -838,7 +838,7 @@ async function tictactoe(interaction, options = {}) { .setColor(options.timeoutEmbedColor || "#C90000") .setFooter(foot) .setTimestamp() - .setDescription(interaction.translate("economy/tictactoe:TIMES_UP")); + .setDescription(interaction.translate("misc:TIMED_OUT")); m.interaction.editReply({ content: interaction.translate("economy/tictactoe:NOT_ANSWERED", { user: opponent.id, diff --git a/languages/ru-RU/economy/tictactoe.json b/languages/ru-RU/economy/tictactoe.json index c1c3dbfb..69a0b9c1 100644 --- a/languages/ru-RU/economy/tictactoe.json +++ b/languages/ru-RU/economy/tictactoe.json @@ -16,6 +16,5 @@ "NO_ANSWER_TITLE": "Запрос не принят вовремя", "NOT_ANSWERED": "<@{{user}}> не принял запрос!", "CANCELED": "Игра отменена!", - "CANCELED_DESC": "<@{{user}}> отказался от игры!", - "TIMES_UP": "Время вышло! Лимит: 30 секунд" + "CANCELED_DESC": "<@{{user}}> отказался от игры!" } \ No newline at end of file diff --git a/languages/ru-RU/misc.json b/languages/ru-RU/misc.json index 28151728..9ad4053b 100644 --- a/languages/ru-RU/misc.json +++ b/languages/ru-RU/misc.json @@ -12,7 +12,7 @@ "OWNER_ONLY": "Данную команду может использовать только владелец бота!", "SELECT_CANCELED": "Выбор отменён...", "STATS_FOOTER": "● [Панель управления]({{dashboardLink}})\n● [Документация]({{docsLink}})\n● [Пригласить JaBa на свой сервер]({{inviteLink}})\n● [Поддержать]({{donateLink}}) (укажите ваш Discord тэг для выдачи ачивки, для других способов поддержки пишите в ЛС <@{{owner}}>)", - "TIMES_UP": "Время вышло! Используйте команду снова!", + "TIMED_OUT": "Время вышло!", "JUMP_TO_PAGE": "Укажите страницу к которой хотите перейти (максимум **{{length}}**):", "PERMISSIONS": { diff --git a/languages/uk-UA/misc.json b/languages/uk-UA/misc.json index 80d08142..691ab622 100644 --- a/languages/uk-UA/misc.json +++ b/languages/uk-UA/misc.json @@ -12,7 +12,7 @@ "OWNER_ONLY": "Цю команду може використовувати тільки власник бота!", "SELECT_CANCELED": "Вибір скасовано...", "STATS_FOOTER": "● [Панель керування]({{dashboardLink}})\n● [Документація]({{docsLink}})\n● [Запросити JaBa на свій сервер]({{inviteLink}})\n● [Підтримати]({{donateLink}}) (вкажіть ваш Discord тег для видачі ачивки, для інших способів підтримки пишіть в ЛЗ <@{{owner}}>)", - "TIMES_UP": "Час вийшов! Використовуйте команду знову!", + "TIMES_UP": "Час вийшов!", "JUMP_TO_PAGE": "Вкажіть сторінку, до якої хочете перейти (максимум **{{length}}**):", "PERMISSIONS": { diff --git a/package-lock.json b/package-lock.json index 1895d706..04356d0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "jaba", - "version": "4.1.18", + "version": "4.1.19", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "jaba", - "version": "4.1.18", + "version": "4.1.19", "license": "ISC", "dependencies": { "@discord-player/extractor": "^3.0.2", diff --git a/package.json b/package.json index 7d029c04..22455882 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jaba", - "version": "4.1.18", + "version": "4.1.19", "description": "My Discord Bot", "main": "index.js", "private": true,