mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 13:14:58 +05:00
(4.1.6) Смотрите изменения тут https://github.com/JonnyBro/JaBa-logs
This commit is contained in:
parent
30dd0bd48e
commit
36b157cac5
7 changed files with 57 additions and 82 deletions
|
@ -1,4 +1,4 @@
|
||||||
const { SlashCommandBuilder, ActionRowBuilder, SelectMenuBuilder } = require("discord.js"),
|
const { SlashCommandBuilder } = require("discord.js"),
|
||||||
{ QueueRepeatMode } = require("discord-player-play-dl");
|
{ QueueRepeatMode } = require("discord-player-play-dl");
|
||||||
const BaseCommand = require("../../base/BaseCommand");
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
@ -11,7 +11,16 @@ class Loop extends BaseCommand {
|
||||||
super({
|
super({
|
||||||
command: new SlashCommandBuilder()
|
command: new SlashCommandBuilder()
|
||||||
.setName("loop")
|
.setName("loop")
|
||||||
.setDescription(client.translate("music/loop:DESCRIPTION")),
|
.setDescription(client.translate("music/loop:DESCRIPTION"))
|
||||||
|
.addStringOption(option => option.setName("option")
|
||||||
|
.setDescription(client.translate("economy/bank:OPTION"))
|
||||||
|
.setRequired(true)
|
||||||
|
.addChoices(
|
||||||
|
{ name: client.translate("music/loop:AUTOPLAY"), value: "3" },
|
||||||
|
{ name: client.translate("music/loop:QUEUE"), value: "2" },
|
||||||
|
{ name: client.translate("music/loop:TRACK"), value: "1" },
|
||||||
|
{ name: client.translate("music/loop:DISABLE"), value: "0" }
|
||||||
|
)),
|
||||||
aliases: [],
|
aliases: [],
|
||||||
dirname: __dirname,
|
dirname: __dirname,
|
||||||
guildOnly: true,
|
guildOnly: true,
|
||||||
|
@ -32,64 +41,23 @@ class Loop extends BaseCommand {
|
||||||
* @param {Object} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
|
||||||
|
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { edit: true });
|
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { edit: true });
|
||||||
const queue = client.player.getQueue(interaction.guildId);
|
const queue = client.player.getQueue(interaction.guildId);
|
||||||
if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { edit: true });
|
if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { edit: true });
|
||||||
|
|
||||||
const row = new ActionRowBuilder()
|
const type = interaction.options.getString("option");
|
||||||
.addComponents(
|
|
||||||
new SelectMenuBuilder()
|
|
||||||
.setCustomId("loop_select")
|
|
||||||
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
|
||||||
.addOptions([
|
|
||||||
{
|
|
||||||
label: client.translate("music/loop:AUTOPLAY"),
|
|
||||||
value: "3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: client.translate("music/loop:QUEUE"),
|
|
||||||
value: "2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: client.translate("music/loop:TRACK"),
|
|
||||||
value: "1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: client.translate("music/loop:DISABLE"),
|
|
||||||
value: "0"
|
|
||||||
}
|
|
||||||
])
|
|
||||||
);
|
|
||||||
|
|
||||||
await interaction.editReply({
|
|
||||||
content: interaction.translate("common:AVAILABLE_OPTIONS"),
|
|
||||||
components: [row]
|
|
||||||
});
|
|
||||||
|
|
||||||
const filter = i => i.user.id === interaction.user.id;
|
|
||||||
const collector = interaction.channel.createMessageComponentCollector({ filter, idle: (15 * 1000) });
|
|
||||||
|
|
||||||
collector.on("collect", async i => {
|
|
||||||
if (i.isSelectMenu() && i.customId === "loop_select") {
|
|
||||||
const type = i?.values[0];
|
|
||||||
const mode = type === "3" ? QueueRepeatMode.AUTOPLAY :
|
const mode = type === "3" ? QueueRepeatMode.AUTOPLAY :
|
||||||
type === "2" ? QueueRepeatMode.QUEUE :
|
type === "2" ? QueueRepeatMode.QUEUE :
|
||||||
type === "1" ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF;
|
type === "1" ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF;
|
||||||
|
|
||||||
queue.setRepeatMode(mode);
|
queue.setRepeatMode(mode);
|
||||||
return interaction.editReply({
|
|
||||||
content: interaction.translate(`music/loop:${
|
interaction.success(`music/loop:${
|
||||||
type === "3" ? "AUTOPLAY_ENABLED" :
|
type === "3" ? "AUTOPLAY_ENABLED" :
|
||||||
type === "2" ? "QUEUE_ENABLED" :
|
type === "2" ? "QUEUE_ENABLED" :
|
||||||
type === "1" ? "TRACK_ENABLED" : "LOOP_DISABLED"
|
type === "1" ? "TRACK_ENABLED" : "LOOP_DISABLED"
|
||||||
}`),
|
}`);
|
||||||
components: []
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
### JaBa v4.1.6
|
||||||
|
* Изменения
|
||||||
|
* Изменён способ указания типа повтора в *loop*. Теперь вы указываете тип аргументом (подсказки имеются), а не из выпадающего списка в отдельном сообщении. Это одновременно удобно, быстро и меньше кода =)
|
||||||
|
|
||||||
|
* Исправления
|
||||||
|
* Фиксы в *tictactoe*.
|
||||||
|
|
||||||
### JaBa v4.1.5
|
### JaBa v4.1.5
|
||||||
* Изменения
|
* Изменения
|
||||||
* Более подробные сообщения в *remindme*.
|
* Более подробные сообщения в *remindme*.
|
||||||
|
|
|
@ -68,7 +68,7 @@ async function tictactoe(interaction, options = {}) {
|
||||||
|
|
||||||
const acceptEmbed = new EmbedBuilder()
|
const acceptEmbed = new EmbedBuilder()
|
||||||
.setTitle(interaction.translate("economy/tictactoe:REQUEST_WAIT", {
|
.setTitle(interaction.translate("economy/tictactoe:REQUEST_WAIT", {
|
||||||
user: opponent.tag
|
user: opponent.id
|
||||||
}))
|
}))
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: (interaction.user ? interaction.user : interaction.author).tag,
|
name: (interaction.user ? interaction.user : interaction.author).tag,
|
||||||
|
@ -113,7 +113,7 @@ async function tictactoe(interaction, options = {}) {
|
||||||
}
|
}
|
||||||
const collector = m.createMessageComponentCollector({
|
const collector = m.createMessageComponentCollector({
|
||||||
componentType: ComponentType.Button,
|
componentType: ComponentType.Button,
|
||||||
time: 30000
|
time: 5000
|
||||||
});
|
});
|
||||||
collector.on("collect", async button => {
|
collector.on("collect", async button => {
|
||||||
if (button.user.id !== opponent.id)
|
if (button.user.id !== opponent.id)
|
||||||
|
@ -203,7 +203,7 @@ async function tictactoe(interaction, options = {}) {
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
interaction.translate("economy/tictactoe:WAITING", {
|
interaction.translate("economy/tictactoe:WAITING", {
|
||||||
user: `<@${Args.userid}>`,
|
user: Args.userid,
|
||||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -214,7 +214,7 @@ async function tictactoe(interaction, options = {}) {
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
interaction.translate("economy/tictactoe:WAITING", {
|
interaction.translate("economy/tictactoe:WAITING", {
|
||||||
user: `<@${Args.userid}>`,
|
user: Args.userid,
|
||||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -341,7 +341,7 @@ async function tictactoe(interaction, options = {}) {
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: interaction.translate("economy/tictactoe:WON", {
|
content: interaction.translate("economy/tictactoe:WON", {
|
||||||
winner: `<@${fighters[1]}>`,
|
winner: fighters[1],
|
||||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
}),
|
}),
|
||||||
components: buttons,
|
components: buttons,
|
||||||
|
@ -349,7 +349,7 @@ async function tictactoe(interaction, options = {}) {
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
interaction.translate("economy/tictactoe:WON", {
|
interaction.translate("economy/tictactoe:WON", {
|
||||||
winner: `<@${fighters[1]}>`,
|
winner: fighters[1],
|
||||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -362,14 +362,14 @@ async function tictactoe(interaction, options = {}) {
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: interaction.translate("economy/tictactoe:WON", {
|
content: interaction.translate("economy/tictactoe:WON", {
|
||||||
winner: `<@${fighters[1]}>`,
|
winner: fighters[1],
|
||||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
}),
|
}),
|
||||||
|
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`${interaction.translate("economy/tictactoe:WON", {
|
`${interaction.translate("economy/tictactoe:WON", {
|
||||||
winner: `<@${fighters[1]}>`,
|
winner: fighters[1],
|
||||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
})}\n\`\`\`\n${Args.a1.emoji
|
})}\n\`\`\`\n${Args.a1.emoji
|
||||||
.replace(o_emoji, "⭕")
|
.replace(o_emoji, "⭕")
|
||||||
|
@ -529,14 +529,14 @@ async function tictactoe(interaction, options = {}) {
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: interaction.translate("economy/tictactoe:WON", {
|
content: interaction.translate("economy/tictactoe:WON", {
|
||||||
winner: `<@${fighters[1]}>`,
|
winner: fighters[1],
|
||||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
}),
|
}),
|
||||||
components: buttons,
|
components: buttons,
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
interaction.translate("economy/tictactoe:WON", {
|
interaction.translate("economy/tictactoe:WON", {
|
||||||
winner: `<@${fighters[1]}>`,
|
winner: fighters[1],
|
||||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -549,13 +549,13 @@ async function tictactoe(interaction, options = {}) {
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: interaction.translate("economy/tictactoe:WON", {
|
content: interaction.translate("economy/tictactoe:WON", {
|
||||||
winner: `<@${fighters[1]}>`,
|
winner: fighters[1],
|
||||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
}),
|
}),
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`${interaction.translate("economy/tictactoe:WON", {
|
`${interaction.translate("economy/tictactoe:WON", {
|
||||||
winner: `<@${fighters[1]}>`,
|
winner: fighters[1],
|
||||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
})}\n\`\`\`\n${Args.a1.emoji
|
})}\n\`\`\`\n${Args.a1.emoji
|
||||||
.replace(o_emoji, "⭕")
|
.replace(o_emoji, "⭕")
|
||||||
|
@ -661,7 +661,7 @@ async function tictactoe(interaction, options = {}) {
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
interaction.translate("economy/tictactoe:WAITING", {
|
interaction.translate("economy/tictactoe:WAITING", {
|
||||||
user: `<@${Args.userid}>`,
|
user: Args.userid,
|
||||||
emoji: Args.user == 0 ? `${client.emojis.cache.get(o_emoji) || "⭕"}` : `${client.emojis.cache.get(x_emoji) || "❌"}`
|
emoji: Args.user == 0 ? `${client.emojis.cache.get(o_emoji) || "⭕"}` : `${client.emojis.cache.get(x_emoji) || "❌"}`
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -672,7 +672,7 @@ async function tictactoe(interaction, options = {}) {
|
||||||
const collector = m.createMessageComponentCollector({
|
const collector = m.createMessageComponentCollector({
|
||||||
componentType: ComponentType.Button,
|
componentType: ComponentType.Button,
|
||||||
max: 1,
|
max: 1,
|
||||||
time: 30000
|
time: 5000
|
||||||
});
|
});
|
||||||
|
|
||||||
collector.on("collect", b => {
|
collector.on("collect", b => {
|
||||||
|
@ -826,7 +826,7 @@ async function tictactoe(interaction, options = {}) {
|
||||||
if (collected.size === 0 && reason == "time")
|
if (collected.size === 0 && reason == "time")
|
||||||
m.edit({
|
m.edit({
|
||||||
content: interaction.translate("economy/tictactoe:NO_ANSWER", {
|
content: interaction.translate("economy/tictactoe:NO_ANSWER", {
|
||||||
user: `<@${Args.userid}>`
|
user: Args.userid
|
||||||
}),
|
}),
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
|
@ -847,7 +847,7 @@ async function tictactoe(interaction, options = {}) {
|
||||||
.setFooter(foot)
|
.setFooter(foot)
|
||||||
.setTimestamp()
|
.setTimestamp()
|
||||||
.setDescription(interaction.translate("economy/tictactoe:TIMES_UP"));
|
.setDescription(interaction.translate("economy/tictactoe:TIMES_UP"));
|
||||||
m.edit({
|
m.interaction.editReply({
|
||||||
content: interaction.translate("economy/tictactoe:NOT_ANSWERED", {
|
content: interaction.translate("economy/tictactoe:NOT_ANSWERED", {
|
||||||
user: opponent.id
|
user: opponent.id
|
||||||
}),
|
}),
|
||||||
|
@ -868,7 +868,7 @@ async function tictactoe(interaction, options = {}) {
|
||||||
.setDescription(interaction.translate("economy/tictactoe:CANCELED_DESC", {
|
.setDescription(interaction.translate("economy/tictactoe:CANCELED_DESC", {
|
||||||
user: opponent.id
|
user: opponent.id
|
||||||
}));
|
}));
|
||||||
m.edit({
|
m.interaction.editReply({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
|
|
2
index.js
2
index.js
|
@ -20,4 +20,4 @@ client.on("disconnect", () => client.logger.log("Bot is disconnecting...", "warn
|
||||||
.on("reconnecting", () => client.logger.log("Bot reconnecting...", "warn"))
|
.on("reconnecting", () => client.logger.log("Bot reconnecting...", "warn"))
|
||||||
.on("warn", warn => client.logger.log(warn, "warn"))
|
.on("warn", warn => client.logger.log(warn, "warn"))
|
||||||
.on("error", e => client.logger.log(`${e.message}\n${e.stack}`, "error"));
|
.on("error", e => client.logger.log(`${e.message}\n${e.stack}`, "error"));
|
||||||
process.on("unhandledRejection", e => console.error(e));
|
process.on("unhandledRejection", e => client.logger.log(e, "error"));
|
|
@ -5,17 +5,17 @@
|
||||||
"BOT_USER": "Вы не можете играть против бота!",
|
"BOT_USER": "Вы не можете играть против бота!",
|
||||||
"YOURSELF": "Вы не можете играть с самим собой!",
|
"YOURSELF": "Вы не можете играть с самим собой!",
|
||||||
"INVITE_USER": "<@{{opponent}}>, вам предложили сыграть в крестики-нолики!",
|
"INVITE_USER": "<@{{opponent}}>, вам предложили сыграть в крестики-нолики!",
|
||||||
"REQUEST_SEND": "Запрос отправлен {{opponent}}",
|
"REQUEST_SEND": "Запрос отправлен <@{{opponent}}>",
|
||||||
"REQUEST_WAIT": "Ожидаю ответа {{user}}",
|
"REQUEST_WAIT": "Ожидаю ответа <@{{user}}>",
|
||||||
"WAITING": "Ожидаю ход | {{user}}, Ваш эмодзи: {{emoji}}",
|
"WAITING": "Ожидаю ход | <@{{user}}>, Ваш эмодзи: {{emoji}}",
|
||||||
"WON": "{{winner}} ({{emoji}}) выиграл!",
|
"WON": "<@{{winner}}> ({{emoji}}) выиграл!",
|
||||||
"CANT_PLAY": "Сейчас не ваш ход!",
|
"CANT_PLAY": "Сейчас не ваш ход!",
|
||||||
"TIE": "Ничья",
|
"TIE": "Ничья",
|
||||||
"TIE_DESC": "Никто не выиграл!",
|
"TIE_DESC": "Никто не выиграл!",
|
||||||
"NO_ANSWER": "{{user}} не ответил вовремя!",
|
"NO_ANSWER": "<@{{user}}> не ответил вовремя!",
|
||||||
"NO_ANSWER_TITLE": "Запрос не принят вовремя",
|
"NO_ANSWER_TITLE": "Запрос не принят вовремя",
|
||||||
"NOT_ANSWERED": "{{user}} не принял запрос!",
|
"NOT_ANSWERED": "<@{{user}}> не принял запрос!",
|
||||||
"CANCELED": "Игра отменена!",
|
"CANCELED": "Игра отменена!",
|
||||||
"CANCELED_DESC": "{{user}} отказался от игры!",
|
"CANCELED_DESC": "<@{{user}}> отказался от игры!",
|
||||||
"TIMES_UP": "Время вышло! Лимит: 30 секунд"
|
"TIMES_UP": "Время вышло! Лимит: 30 секунд"
|
||||||
}
|
}
|
|
@ -7,7 +7,7 @@
|
||||||
"TRACK": "Текущий трек",
|
"TRACK": "Текущий трек",
|
||||||
"DISABLE": "Отключить",
|
"DISABLE": "Отключить",
|
||||||
"AUTOPLAY_ENABLED": "Автовоспроизведение **включено**",
|
"AUTOPLAY_ENABLED": "Автовоспроизведение **включено**",
|
||||||
"QUEUE_ENABLED": "Повтор очереди **включён**!",
|
"QUEUE_ENABLED": "Повтор очереди **включён**",
|
||||||
"TRACK_ENABLED": "Повтор текущего трека **включён**!",
|
"TRACK_ENABLED": "Повтор текущего трека **включён**",
|
||||||
"LOOP_DISABLED": "Повтор **отключён**!"
|
"LOOP_DISABLED": "Повтор **отключён**"
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "jaba",
|
"name": "jaba",
|
||||||
"version": "4.1.5",
|
"version": "4.1.6",
|
||||||
"description": "My Discord Bot",
|
"description": "My Discord Bot",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|
Loading…
Reference in a new issue