mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
v4.1.19 - https://github.com/JonnyBro/JaBa-logs
This commit is contained in:
parent
0ae13edd23
commit
d16b36687a
45 changed files with 165 additions and 108 deletions
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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 });
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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,
|
||||
}));
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
|
@ -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"))}`,
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
}));
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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("")
|
||||
|
|
|
@ -91,7 +91,7 @@ class Report extends BaseCommand {
|
|||
|
||||
interaction.success("general/report:SUCCESS", {
|
||||
channel: repChannel.toString(),
|
||||
});
|
||||
}, { ephemeral: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class Suggest extends BaseCommand {
|
|||
|
||||
interaction.success("general/suggest:SUCCESS", {
|
||||
channel: suggChannel.toString(),
|
||||
});
|
||||
}, { ephemeral: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ class Clearwarns extends BaseCommand {
|
|||
|
||||
memberData.sanctions = [];
|
||||
memberData.save();
|
||||
|
||||
interaction.success("moderation/clearwarns:SUCCESS", {
|
||||
username: member.user.tag,
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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", {
|
||||
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", {
|
||||
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,
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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 });
|
||||
|
|
|
@ -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") });
|
||||
|
|
|
@ -43,11 +43,12 @@ 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 :
|
||||
const type = interaction.options.getString("option"),
|
||||
mode = type === "3" ? QueueRepeatMode.AUTOPLAY :
|
||||
type === "2" ? QueueRepeatMode.QUEUE :
|
||||
type === "1" ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF;
|
||||
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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 });
|
||||
|
||||
|
|
|
@ -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", {
|
||||
|
|
|
@ -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 });
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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|| " : ""}ВАЖНОЕ ОБЪЯВЛЕНИЕ!`,
|
||||
|
|
|
@ -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({
|
||||
}),
|
||||
memberData = await client.findOrCreateMember({
|
||||
id: member.id,
|
||||
guildId: interaction.guildId,
|
||||
});
|
||||
const int = interaction.options.getInteger("int");
|
||||
|
||||
|
||||
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({
|
||||
}),
|
||||
memberData = await client.findOrCreateMember({
|
||||
id: member.id,
|
||||
guildId: interaction.guildId,
|
||||
});
|
||||
const int = interaction.options.getInteger("int");
|
||||
|
||||
switch (type) {
|
||||
case "level": {
|
||||
|
|
|
@ -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 + "```",
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
### JaBa v4.1.19
|
||||
* Изменения
|
||||
* Мелкие внутренние изменения.
|
||||
|
||||
* Исправления
|
||||
* Ошибки *warn*.
|
||||
|
||||
### JaBa v4.1.18
|
||||
* Изменения
|
||||
* Обновление зависимостей.
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -16,6 +16,5 @@
|
|||
"NO_ANSWER_TITLE": "Запрос не принят вовремя",
|
||||
"NOT_ANSWERED": "<@{{user}}> не принял запрос!",
|
||||
"CANCELED": "Игра отменена!",
|
||||
"CANCELED_DESC": "<@{{user}}> отказался от игры!",
|
||||
"TIMES_UP": "Время вышло! Лимит: 30 секунд"
|
||||
"CANCELED_DESC": "<@{{user}}> отказался от игры!"
|
||||
}
|
|
@ -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": {
|
||||
|
|
|
@ -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": {
|
||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -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",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "jaba",
|
||||
"version": "4.1.18",
|
||||
"version": "4.1.19",
|
||||
"description": "My Discord Bot",
|
||||
"main": "index.js",
|
||||
"private": true,
|
||||
|
|
Loading…
Reference in a new issue