mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-21 20:54: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");
|
||||
const BaseCommand = require("../../base/BaseCommand");
|
||||
|
||||
|
@ -11,7 +11,16 @@ class Loop extends BaseCommand {
|
|||
super({
|
||||
command: new SlashCommandBuilder()
|
||||
.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: [],
|
||||
dirname: __dirname,
|
||||
guildOnly: true,
|
||||
|
@ -32,64 +41,23 @@ class Loop extends BaseCommand {
|
|||
* @param {Object} data
|
||||
*/
|
||||
async execute(client, interaction) {
|
||||
await interaction.deferReply();
|
||||
|
||||
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 row = new ActionRowBuilder()
|
||||
.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"
|
||||
}
|
||||
])
|
||||
);
|
||||
const type = interaction.options.getString("option");
|
||||
const mode = type === "3" ? QueueRepeatMode.AUTOPLAY :
|
||||
type === "2" ? QueueRepeatMode.QUEUE :
|
||||
type === "1" ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF;
|
||||
|
||||
await interaction.editReply({
|
||||
content: interaction.translate("common:AVAILABLE_OPTIONS"),
|
||||
components: [row]
|
||||
});
|
||||
queue.setRepeatMode(mode);
|
||||
|
||||
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 :
|
||||
type === "2" ? QueueRepeatMode.QUEUE :
|
||||
type === "1" ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF;
|
||||
|
||||
queue.setRepeatMode(mode);
|
||||
return interaction.editReply({
|
||||
content: interaction.translate(`music/loop:${
|
||||
type === "3" ? "AUTOPLAY_ENABLED" :
|
||||
type === "2" ? "QUEUE_ENABLED" :
|
||||
type === "1" ? "TRACK_ENABLED" : "LOOP_DISABLED"
|
||||
}`),
|
||||
components: []
|
||||
});
|
||||
}
|
||||
});
|
||||
interaction.success(`music/loop:${
|
||||
type === "3" ? "AUTOPLAY_ENABLED" :
|
||||
type === "2" ? "QUEUE_ENABLED" :
|
||||
type === "1" ? "TRACK_ENABLED" : "LOOP_DISABLED"
|
||||
}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
### JaBa v4.1.6
|
||||
* Изменения
|
||||
* Изменён способ указания типа повтора в *loop*. Теперь вы указываете тип аргументом (подсказки имеются), а не из выпадающего списка в отдельном сообщении. Это одновременно удобно, быстро и меньше кода =)
|
||||
|
||||
* Исправления
|
||||
* Фиксы в *tictactoe*.
|
||||
|
||||
### JaBa v4.1.5
|
||||
* Изменения
|
||||
* Более подробные сообщения в *remindme*.
|
||||
|
|
|
@ -68,7 +68,7 @@ async function tictactoe(interaction, options = {}) {
|
|||
|
||||
const acceptEmbed = new EmbedBuilder()
|
||||
.setTitle(interaction.translate("economy/tictactoe:REQUEST_WAIT", {
|
||||
user: opponent.tag
|
||||
user: opponent.id
|
||||
}))
|
||||
.setAuthor({
|
||||
name: (interaction.user ? interaction.user : interaction.author).tag,
|
||||
|
@ -113,7 +113,7 @@ async function tictactoe(interaction, options = {}) {
|
|||
}
|
||||
const collector = m.createMessageComponentCollector({
|
||||
componentType: ComponentType.Button,
|
||||
time: 30000
|
||||
time: 5000
|
||||
});
|
||||
collector.on("collect", async button => {
|
||||
if (button.user.id !== opponent.id)
|
||||
|
@ -203,7 +203,7 @@ async function tictactoe(interaction, options = {}) {
|
|||
embeds: [
|
||||
epm.setDescription(
|
||||
interaction.translate("economy/tictactoe:WAITING", {
|
||||
user: `<@${Args.userid}>`,
|
||||
user: Args.userid,
|
||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||
})
|
||||
)
|
||||
|
@ -214,7 +214,7 @@ async function tictactoe(interaction, options = {}) {
|
|||
embeds: [
|
||||
epm.setDescription(
|
||||
interaction.translate("economy/tictactoe:WAITING", {
|
||||
user: `<@${Args.userid}>`,
|
||||
user: Args.userid,
|
||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||
})
|
||||
)
|
||||
|
@ -341,7 +341,7 @@ async function tictactoe(interaction, options = {}) {
|
|||
return m
|
||||
.edit({
|
||||
content: interaction.translate("economy/tictactoe:WON", {
|
||||
winner: `<@${fighters[1]}>`,
|
||||
winner: fighters[1],
|
||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||
}),
|
||||
components: buttons,
|
||||
|
@ -349,7 +349,7 @@ async function tictactoe(interaction, options = {}) {
|
|||
embeds: [
|
||||
epm.setDescription(
|
||||
interaction.translate("economy/tictactoe:WON", {
|
||||
winner: `<@${fighters[1]}>`,
|
||||
winner: fighters[1],
|
||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||
})
|
||||
)
|
||||
|
@ -362,14 +362,14 @@ async function tictactoe(interaction, options = {}) {
|
|||
return m
|
||||
.edit({
|
||||
content: interaction.translate("economy/tictactoe:WON", {
|
||||
winner: `<@${fighters[1]}>`,
|
||||
winner: fighters[1],
|
||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||
}),
|
||||
|
||||
embeds: [
|
||||
epm.setDescription(
|
||||
`${interaction.translate("economy/tictactoe:WON", {
|
||||
winner: `<@${fighters[1]}>`,
|
||||
winner: fighters[1],
|
||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||
})}\n\`\`\`\n${Args.a1.emoji
|
||||
.replace(o_emoji, "⭕")
|
||||
|
@ -529,14 +529,14 @@ async function tictactoe(interaction, options = {}) {
|
|||
return m
|
||||
.edit({
|
||||
content: interaction.translate("economy/tictactoe:WON", {
|
||||
winner: `<@${fighters[1]}>`,
|
||||
winner: fighters[1],
|
||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||
}),
|
||||
components: buttons,
|
||||
embeds: [
|
||||
epm.setDescription(
|
||||
interaction.translate("economy/tictactoe:WON", {
|
||||
winner: `<@${fighters[1]}>`,
|
||||
winner: fighters[1],
|
||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||
})
|
||||
)
|
||||
|
@ -549,13 +549,13 @@ async function tictactoe(interaction, options = {}) {
|
|||
return m
|
||||
.edit({
|
||||
content: interaction.translate("economy/tictactoe:WON", {
|
||||
winner: `<@${fighters[1]}>`,
|
||||
winner: fighters[1],
|
||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||
}),
|
||||
embeds: [
|
||||
epm.setDescription(
|
||||
`${interaction.translate("economy/tictactoe:WON", {
|
||||
winner: `<@${fighters[1]}>`,
|
||||
winner: fighters[1],
|
||||
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||
})}\n\`\`\`\n${Args.a1.emoji
|
||||
.replace(o_emoji, "⭕")
|
||||
|
@ -661,7 +661,7 @@ async function tictactoe(interaction, options = {}) {
|
|||
embeds: [
|
||||
epm.setDescription(
|
||||
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) || "❌"}`
|
||||
})
|
||||
)
|
||||
|
@ -672,7 +672,7 @@ async function tictactoe(interaction, options = {}) {
|
|||
const collector = m.createMessageComponentCollector({
|
||||
componentType: ComponentType.Button,
|
||||
max: 1,
|
||||
time: 30000
|
||||
time: 5000
|
||||
});
|
||||
|
||||
collector.on("collect", b => {
|
||||
|
@ -826,7 +826,7 @@ async function tictactoe(interaction, options = {}) {
|
|||
if (collected.size === 0 && reason == "time")
|
||||
m.edit({
|
||||
content: interaction.translate("economy/tictactoe:NO_ANSWER", {
|
||||
user: `<@${Args.userid}>`
|
||||
user: Args.userid
|
||||
}),
|
||||
components: []
|
||||
});
|
||||
|
@ -847,7 +847,7 @@ async function tictactoe(interaction, options = {}) {
|
|||
.setFooter(foot)
|
||||
.setTimestamp()
|
||||
.setDescription(interaction.translate("economy/tictactoe:TIMES_UP"));
|
||||
m.edit({
|
||||
m.interaction.editReply({
|
||||
content: interaction.translate("economy/tictactoe:NOT_ANSWERED", {
|
||||
user: opponent.id
|
||||
}),
|
||||
|
@ -868,7 +868,7 @@ async function tictactoe(interaction, options = {}) {
|
|||
.setDescription(interaction.translate("economy/tictactoe:CANCELED_DESC", {
|
||||
user: opponent.id
|
||||
}));
|
||||
m.edit({
|
||||
m.interaction.editReply({
|
||||
embeds: [embed],
|
||||
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("warn", warn => client.logger.log(warn, "warn"))
|
||||
.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": "Вы не можете играть против бота!",
|
||||
"YOURSELF": "Вы не можете играть с самим собой!",
|
||||
"INVITE_USER": "<@{{opponent}}>, вам предложили сыграть в крестики-нолики!",
|
||||
"REQUEST_SEND": "Запрос отправлен {{opponent}}",
|
||||
"REQUEST_WAIT": "Ожидаю ответа {{user}}",
|
||||
"WAITING": "Ожидаю ход | {{user}}, Ваш эмодзи: {{emoji}}",
|
||||
"WON": "{{winner}} ({{emoji}}) выиграл!",
|
||||
"REQUEST_SEND": "Запрос отправлен <@{{opponent}}>",
|
||||
"REQUEST_WAIT": "Ожидаю ответа <@{{user}}>",
|
||||
"WAITING": "Ожидаю ход | <@{{user}}>, Ваш эмодзи: {{emoji}}",
|
||||
"WON": "<@{{winner}}> ({{emoji}}) выиграл!",
|
||||
"CANT_PLAY": "Сейчас не ваш ход!",
|
||||
"TIE": "Ничья",
|
||||
"TIE_DESC": "Никто не выиграл!",
|
||||
"NO_ANSWER": "{{user}} не ответил вовремя!",
|
||||
"NO_ANSWER": "<@{{user}}> не ответил вовремя!",
|
||||
"NO_ANSWER_TITLE": "Запрос не принят вовремя",
|
||||
"NOT_ANSWERED": "{{user}} не принял запрос!",
|
||||
"NOT_ANSWERED": "<@{{user}}> не принял запрос!",
|
||||
"CANCELED": "Игра отменена!",
|
||||
"CANCELED_DESC": "{{user}} отказался от игры!",
|
||||
"CANCELED_DESC": "<@{{user}}> отказался от игры!",
|
||||
"TIMES_UP": "Время вышло! Лимит: 30 секунд"
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
"TRACK": "Текущий трек",
|
||||
"DISABLE": "Отключить",
|
||||
"AUTOPLAY_ENABLED": "Автовоспроизведение **включено**",
|
||||
"QUEUE_ENABLED": "Повтор очереди **включён**!",
|
||||
"TRACK_ENABLED": "Повтор текущего трека **включён**!",
|
||||
"LOOP_DISABLED": "Повтор **отключён**!"
|
||||
"QUEUE_ENABLED": "Повтор очереди **включён**",
|
||||
"TRACK_ENABLED": "Повтор текущего трека **включён**",
|
||||
"LOOP_DISABLED": "Повтор **отключён**"
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "jaba",
|
||||
"version": "4.1.5",
|
||||
"version": "4.1.6",
|
||||
"description": "My Discord Bot",
|
||||
"main": "index.js",
|
||||
"private": true,
|
||||
|
|
Loading…
Reference in a new issue