mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 13:14:58 +05:00
Фиксы, поддержка локализации для TTT
This commit is contained in:
parent
c3c886ad38
commit
1aa62d135e
6 changed files with 174 additions and 108 deletions
|
@ -19,20 +19,17 @@ class TicTacToe extends Command {
|
||||||
|
|
||||||
async run(message, args, data) {
|
async run(message, args, data) {
|
||||||
tictactoe(message, {
|
tictactoe(message, {
|
||||||
|
resultBtn: true,
|
||||||
embedColor: data.config.embed.color,
|
embedColor: data.config.embed.color,
|
||||||
embedFoot: data.config.embed.footer
|
embedFoot: data.config.embed.footer
|
||||||
}).then(async (winner) => {
|
}).then(async (winner) => {
|
||||||
message.sendT("economy/number:WON", {
|
|
||||||
winner: winner.username
|
|
||||||
});
|
|
||||||
|
|
||||||
const memberData = await this.client.findOrCreateMember({
|
const memberData = await this.client.findOrCreateMember({
|
||||||
id: winner.id,
|
id: winner.id,
|
||||||
guildID: message.guild.id
|
guildID: message.guild.id
|
||||||
});
|
});
|
||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
user: message.translate("economy/tictactoe:DESCRIPTION"),
|
user: message.translate("economy/transactions:TTT"),
|
||||||
amount: 100,
|
amount: 100,
|
||||||
date: Date.now(),
|
date: Date.now(),
|
||||||
type: "got"
|
type: "got"
|
||||||
|
@ -40,7 +37,7 @@ class TicTacToe extends Command {
|
||||||
|
|
||||||
memberData.transactions.push(info);
|
memberData.transactions.push(info);
|
||||||
|
|
||||||
memberData.money = memberData.money + 100;
|
memberData.money += 100;
|
||||||
memberData.save();
|
memberData.save();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,61 +35,63 @@ async function tictactoe(message, options = []) {
|
||||||
opponent = message.options.getUser(options.userSlash || "user");
|
opponent = message.options.getUser(options.userSlash || "user");
|
||||||
|
|
||||||
if (!opponent)
|
if (!opponent)
|
||||||
return message.followUp({
|
return message.reply({
|
||||||
content: "Укажите пользователя!",
|
content: message.translate("economy/tictactoe:NO_USER"),
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (opponent.bot)
|
if (opponent.bot)
|
||||||
return message.followUp({
|
return message.reply({
|
||||||
content: "Вы не можете играть против ботов!",
|
content: message.translate("economy/tictactoe:BOT_USER"),
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (opponent.id == (message.user ? message.user : message.author).id)
|
if (opponent.id == (message.user ? message.user : message.author).id)
|
||||||
return message.followUp({
|
return message.reply({
|
||||||
content: "Вы не можете играть с самим собой!",
|
content: message.translate("economy/tictactoe:YOURSELF"),
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
} else if (!message.commandId) {
|
} else if (!message.commandId) {
|
||||||
opponent = message.mentions.members.first()?.user;
|
opponent = message.mentions.members.first()?.user;
|
||||||
|
|
||||||
if (!opponent)
|
if (!opponent)
|
||||||
return message.channel.send({
|
return message.reply({
|
||||||
content: "Укажите пользователя!"
|
content: message.translate("economy/tictactoe:NO_USER")
|
||||||
});
|
});
|
||||||
|
|
||||||
if (opponent.bot)
|
if (opponent.bot)
|
||||||
return message.followUp({
|
return message.reply({
|
||||||
content: "Вы не можете играть против ботов!",
|
content: message.translate("economy/tictactoe:BOT_USER"),
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (opponent.id === message.member.id)
|
if (opponent.id === message.member.id)
|
||||||
return message.channel.send({
|
return message.reply({
|
||||||
content:
|
content: message.translate("economy/tictactoe:YOURSELF")
|
||||||
"Вы не можете играть с самим собой!"
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const foot = { text: options.embedFoot } || { text: "Удачи =)" };
|
const foot = options.embedFoot ? { text: options.embedFoot } : { text: "Удачи =)" };
|
||||||
|
|
||||||
const acceptEmbed = new Discord.MessageEmbed()
|
const acceptEmbed = new Discord.MessageEmbed()
|
||||||
.setTitle(`Ожидаю ответа ${opponent.tag}!`)
|
.setTitle(message.translate("economy/tictactoe:REQUEST_WAIT", {
|
||||||
|
user: opponent.tag
|
||||||
|
}))
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: (message.user ? message.user : message.author).tag,
|
name: (message.user ? message.user : message.author).tag,
|
||||||
iconURL: (message.user ? message.user : message.author).displayAvatarURL()
|
iconURL: (message.user ? message.user : message.author).displayAvatarURL()
|
||||||
})
|
})
|
||||||
.setColor(options.embedColor || "#075FFF")
|
.setColor(options.embedColor || "#075FFF")
|
||||||
.setFooter(foot);
|
.setFooter(foot)
|
||||||
|
.setTimestamp();
|
||||||
|
|
||||||
const accept = new Discord.MessageButton()
|
const accept = new Discord.MessageButton()
|
||||||
.setLabel("Принять")
|
.setLabel(message.translate("economy/tictactoe:ACCEPT"))
|
||||||
.setStyle("SUCCESS")
|
.setStyle("SUCCESS")
|
||||||
.setCustomId("acceptttt");
|
.setCustomId("acceptttt");
|
||||||
|
|
||||||
const decline = new Discord.MessageButton()
|
const decline = new Discord.MessageButton()
|
||||||
.setLabel("Отказаться")
|
.setLabel(message.translate("economy/tictactoe:DECLINE"))
|
||||||
.setStyle("DANGER")
|
.setStyle("DANGER")
|
||||||
.setCustomId("declinettt");
|
.setCustomId("declinettt");
|
||||||
|
|
||||||
|
@ -101,14 +103,18 @@ async function tictactoe(message, options = []) {
|
||||||
let m;
|
let m;
|
||||||
|
|
||||||
if (message.commandId) {
|
if (message.commandId) {
|
||||||
m = await message.followUp({
|
m = await message.reply({
|
||||||
content: "Хей, <@" + opponent.id + ">, вам предложили сыграть в крестики-нолики",
|
content: message.translate("economy/tictactoe:INVITE_USER", {
|
||||||
|
opponent: opponent.id
|
||||||
|
}),
|
||||||
embeds: [acceptEmbed],
|
embeds: [acceptEmbed],
|
||||||
components: [accep]
|
components: [accep]
|
||||||
});
|
});
|
||||||
} else if (!message.commandId) {
|
} else if (!message.commandId) {
|
||||||
m = await message.reply({
|
m = await message.reply({
|
||||||
content: "Хей, <@" + opponent.id + ">, вам предложили сыграть в крестики-нолики",
|
content: message.translate("economy/tictactoe:INVITE_USER", {
|
||||||
|
opponent: opponent.id
|
||||||
|
}),
|
||||||
embeds: [acceptEmbed],
|
embeds: [acceptEmbed],
|
||||||
components: [accep]
|
components: [accep]
|
||||||
});
|
});
|
||||||
|
@ -120,7 +126,9 @@ async function tictactoe(message, options = []) {
|
||||||
collector.on("collect", async (button) => {
|
collector.on("collect", async (button) => {
|
||||||
if (button.user.id !== opponent.id)
|
if (button.user.id !== opponent.id)
|
||||||
return button.reply({
|
return button.reply({
|
||||||
content: `Запрос отправлен <@${opponent.id}>.`,
|
content: message.translate("economy/tictactoe:REQUEST_SEND", {
|
||||||
|
opponent: opponent.id
|
||||||
|
}),
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -129,9 +137,7 @@ async function tictactoe(message, options = []) {
|
||||||
return collector.stop("decline");
|
return collector.stop("decline");
|
||||||
} else if (button.customId == "acceptttt") {
|
} else if (button.customId == "acceptttt") {
|
||||||
collector.stop();
|
collector.stop();
|
||||||
if (message.commandId) {
|
if (message.commandId) button.message.delete();
|
||||||
button.message.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
const fighters = [
|
const fighters = [
|
||||||
(message.user ? message.user : message.author).id,
|
(message.user ? message.user : message.author).id,
|
||||||
|
@ -194,19 +200,20 @@ async function tictactoe(message, options = []) {
|
||||||
const { MessageActionRow, MessageButton } = require("discord.js");
|
const { MessageActionRow, MessageButton } = require("discord.js");
|
||||||
|
|
||||||
const epm = new Discord.MessageEmbed()
|
const epm = new Discord.MessageEmbed()
|
||||||
.setTitle("Крестики-нолики")
|
.setTitle(message.translate("economy/tictactoe:DESCRIPTION"))
|
||||||
.setColor(options.embedColor || "#075FFF")
|
.setColor(options.embedColor || "#075FFF")
|
||||||
.setFooter(foot)
|
.setFooter(foot)
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
let msg;
|
let msg;
|
||||||
if (message.commandId) {
|
if (message.commandId) {
|
||||||
msg = await message.followUp({
|
msg = await message.reply({
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`Ожидаю ход | <@!${Args.userid}>, Ваш эмодзи: ${
|
message.translate("economy/tictactoe:WAITING", {
|
||||||
client.emojis.cache.get(o_emoji) || "⭕"
|
user: Args.userid,
|
||||||
}`
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
})
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
@ -214,9 +221,10 @@ async function tictactoe(message, options = []) {
|
||||||
msg = await button.message.edit({
|
msg = await button.message.edit({
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`Ожидаю ход | <@!${Args.userid}>, Ваш эмодзи: ${
|
message.translate("economy/tictactoe:WAITING", {
|
||||||
client.emojis.cache.get(o_emoji) || "⭕"
|
user: Args.userid,
|
||||||
}`
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
})
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
@ -340,16 +348,18 @@ async function tictactoe(message, options = []) {
|
||||||
if (options.resultBtn === true)
|
if (options.resultBtn === true)
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: `<@${fighters[1]}> (${
|
content: message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(o_emoji) || "⭕"
|
winner: fighters[1],
|
||||||
}) выиграл`,
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
}),
|
||||||
components: buttons,
|
components: buttons,
|
||||||
|
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`<@!${fighters[1]}> (${
|
message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(o_emoji) || "⭕"
|
winner: fighters[1],
|
||||||
}) выиграл.`
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
})
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@ -359,15 +369,17 @@ async function tictactoe(message, options = []) {
|
||||||
else if (!options.resultBtn || options.resultBtn === false)
|
else if (!options.resultBtn || options.resultBtn === false)
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: `<@${fighters[1]}> (${
|
content: message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(o_emoji) || "⭕"
|
winner: fighters[1],
|
||||||
}) выиграл`,
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
}),
|
||||||
|
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`<@!${fighters[1]}> (${
|
`${message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(o_emoji) || "⭕"
|
winner: fighters[1],
|
||||||
}) выиграл\n\`\`\`\n${Args.a1.emoji
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
})}\n\`\`\`\n${Args.a1.emoji
|
||||||
.replace(o_emoji, "⭕")
|
.replace(o_emoji, "⭕")
|
||||||
.replace(x_emoji, "❌")} | ${Args.a2.emoji
|
.replace(x_emoji, "❌")} | ${Args.a2.emoji
|
||||||
.replace(o_emoji, "⭕")
|
.replace(o_emoji, "⭕")
|
||||||
|
@ -405,15 +417,17 @@ async function tictactoe(message, options = []) {
|
||||||
if (options.resultBtn === true)
|
if (options.resultBtn === true)
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: `<@${fighters[0]}> (${
|
content: message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(o_emoji) || "⭕"
|
winner: fighters[0],
|
||||||
}) выиграл`,
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
}),
|
||||||
components: buttons,
|
components: buttons,
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`<@!${fighters[0]}> (${
|
message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(o_emoji) || "⭕"
|
winner: fighters[0],
|
||||||
}) выиграл`
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
})
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@ -423,15 +437,17 @@ async function tictactoe(message, options = []) {
|
||||||
else if (!options.resultBtn || options.resultBtn === false)
|
else if (!options.resultBtn || options.resultBtn === false)
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: `<@${fighters[0]}> (${
|
content: message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(o_emoji) || "⭕"
|
winner: fighters[0],
|
||||||
}) выиграл`,
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
}),
|
||||||
|
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`<@!${fighters[0]}> (${
|
`${message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(o_emoji) || "⭕"
|
winner: fighters[0],
|
||||||
}) выиграл\n\`\`\`\n${Args.a1.emoji
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
})}\n\`\`\`\n${Args.a1.emoji
|
||||||
.replace(o_emoji, "⭕")
|
.replace(o_emoji, "⭕")
|
||||||
.replace(x_emoji, "❌")} | ${Args.a2.emoji
|
.replace(x_emoji, "❌")} | ${Args.a2.emoji
|
||||||
.replace(o_emoji, "⭕")
|
.replace(o_emoji, "⭕")
|
||||||
|
@ -520,15 +536,17 @@ async function tictactoe(message, options = []) {
|
||||||
if (options.resultBtn === true)
|
if (options.resultBtn === true)
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: `<@${fighters[1]}> (${
|
content: message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(x_emoji) || "❌"
|
winner: fighters[1],
|
||||||
}) выиграл`,
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
}),
|
||||||
components: buttons,
|
components: buttons,
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`<@!${fighters[1]}> (${
|
message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(x_emoji) || "❌"
|
winner: fighters[1],
|
||||||
}) выиграл`
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
})
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@ -538,14 +556,16 @@ async function tictactoe(message, options = []) {
|
||||||
else if (!options.resultBtn || options.resultBtn === false)
|
else if (!options.resultBtn || options.resultBtn === false)
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: `<@${fighters[1]}> (${
|
content: message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(x_emoji) || "❌"
|
winner: fighters[1],
|
||||||
}) выиграл`,
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
}),
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`<@!${fighters[1]}> (${
|
`${message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(x_emoji) || "❌"
|
winner: fighters[1],
|
||||||
}) выиграл\n\`\`\`\n${Args.a1.emoji
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
})}\n\`\`\`\n${Args.a1.emoji
|
||||||
.replace(o_emoji, "⭕")
|
.replace(o_emoji, "⭕")
|
||||||
.replace(x_emoji, "❌")} | ${Args.a2.emoji
|
.replace(x_emoji, "❌")} | ${Args.a2.emoji
|
||||||
.replace(o_emoji, "⭕")
|
.replace(o_emoji, "⭕")
|
||||||
|
@ -583,15 +603,17 @@ async function tictactoe(message, options = []) {
|
||||||
if (options.resultBtn === true)
|
if (options.resultBtn === true)
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: `<@${fighters[0]}> (${
|
content: message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(x_emoji) || "❌"
|
winner: fighters[0],
|
||||||
}) выиграл`,
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
}),
|
||||||
components: buttons,
|
components: buttons,
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`<@!${fighters[0]}> (${
|
message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(x_emoji) || "❌"
|
winner: fighters[0],
|
||||||
}) выиграл`
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
})
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@ -601,14 +623,16 @@ async function tictactoe(message, options = []) {
|
||||||
else
|
else
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: `<@${fighters[0]}> (${
|
content: message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(x_emoji) || "❌"
|
winner: fighters[0],
|
||||||
}) выиграл`,
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
}),
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`<@!${fighters[0]}> (${
|
`${message.translate("economy/tictactoe:WON", {
|
||||||
client.emojis.cache.get(x_emoji) || "❌"
|
winner: fighters[0],
|
||||||
}) выиграл\n\`\`\`\n${Args.a1.emoji
|
emoji: client.emojis.cache.get(o_emoji) || "⭕"
|
||||||
|
})}\n\`\`\`\n${Args.a1.emoji
|
||||||
.replace(o_emoji, "⭕")
|
.replace(o_emoji, "⭕")
|
||||||
.replace(x_emoji, "❌")} | ${Args.a2.emoji
|
.replace(x_emoji, "❌")} | ${Args.a2.emoji
|
||||||
.replace(o_emoji, "⭕")
|
.replace(o_emoji, "⭕")
|
||||||
|
@ -644,11 +668,10 @@ async function tictactoe(message, options = []) {
|
||||||
content: `<@${Args.userid}>`,
|
content: `<@${Args.userid}>`,
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`Ожидаю ход | <@!${Args.userid}> | Ваш эмодзи: ${
|
message.translate("economy/tictactoe:WAITING", {
|
||||||
Args.user == 0
|
user: Args.userid,
|
||||||
? `${client.emojis.cache.get(o_emoji) || "⭕"}`
|
emoji: Args.user == 0 ? `${client.emojis.cache.get(o_emoji) || "⭕"}` : `${client.emojis.cache.get(x_emoji) || "❌"}`
|
||||||
: `${client.emojis.cache.get(x_emoji) || "❌"}`
|
})
|
||||||
}`
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
components: [a, b, c]
|
components: [a, b, c]
|
||||||
|
@ -663,7 +686,7 @@ async function tictactoe(message, options = []) {
|
||||||
collector.on("collect", (b) => {
|
collector.on("collect", (b) => {
|
||||||
if (b.user.id !== Args.userid) {
|
if (b.user.id !== Args.userid) {
|
||||||
b.reply({
|
b.reply({
|
||||||
content: "Вы не можете играть сейчас!",
|
content: message.translate("economy/tictactoe:CANT_PLAY"),
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -690,8 +713,7 @@ async function tictactoe(message, options = []) {
|
||||||
(prev, [key, value]) => ({
|
(prev, [key, value]) => ({
|
||||||
...prev,
|
...prev,
|
||||||
[key]: fun(key, value)
|
[key]: fun(key, value)
|
||||||
}),
|
}), {}
|
||||||
{}
|
|
||||||
);
|
);
|
||||||
const objectFilter = (obj, predicate) =>
|
const objectFilter = (obj, predicate) =>
|
||||||
Object.keys(obj)
|
Object.keys(obj)
|
||||||
|
@ -760,8 +782,8 @@ async function tictactoe(message, options = []) {
|
||||||
if (options.resultBtn === true)
|
if (options.resultBtn === true)
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: "Ничья",
|
content: message.translate("economy/tictactoe:TIE"),
|
||||||
embeds: [epm.setDescription("Это ничья!")]
|
embeds: [epm.setDescription(message.translate("economy/tictactoe:TIE_DESC"))]
|
||||||
})
|
})
|
||||||
.then((m) => {
|
.then((m) => {
|
||||||
m.react(dashmoji);
|
m.react(dashmoji);
|
||||||
|
@ -769,10 +791,10 @@ async function tictactoe(message, options = []) {
|
||||||
else
|
else
|
||||||
return m
|
return m
|
||||||
.edit({
|
.edit({
|
||||||
content: "Ничья",
|
content: message.translate("economy/tictactoe:TIE"),
|
||||||
embeds: [
|
embeds: [
|
||||||
epm.setDescription(
|
epm.setDescription(
|
||||||
`Это ничья!\n\`\`\`\n${Args.a1.emoji
|
`${message.translate("economy/tictactoe:TIE_DESC")}!\n\`\`\`\n${Args.a1.emoji
|
||||||
.replace(o_emoji, "⭕")
|
.replace(o_emoji, "⭕")
|
||||||
.replace(x_emoji, "❌")} | ${Args.a2.emoji
|
.replace(x_emoji, "❌")} | ${Args.a2.emoji
|
||||||
.replace(o_emoji, "⭕")
|
.replace(o_emoji, "⭕")
|
||||||
|
@ -811,7 +833,9 @@ async function tictactoe(message, options = []) {
|
||||||
collector.on("end", (collected, reason) => {
|
collector.on("end", (collected, reason) => {
|
||||||
if (collected.size === 0 && reason == "time")
|
if (collected.size === 0 && reason == "time")
|
||||||
m.edit({
|
m.edit({
|
||||||
content: `<@!${Args.userid}> не ответил вовремя! (30с)`,
|
content: message.translate("economy/tictactoe:NO_ANSWER", {
|
||||||
|
user: Args.userid
|
||||||
|
}),
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -822,30 +846,36 @@ async function tictactoe(message, options = []) {
|
||||||
collector.on("end", (collected, reason) => {
|
collector.on("end", (collected, reason) => {
|
||||||
if (reason == "time") {
|
if (reason == "time") {
|
||||||
const embed = new Discord.MessageEmbed()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setTitle("Запрос не принят вовремя")
|
.setTitle(message.translate("economy/tictactoe:NO_ANSWER_TITLE"))
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: (message.user ? message.user : message.author).tag,
|
name: (message.user ? message.user : message.author).tag,
|
||||||
iconURL: (message.user ? message.user : message.author).displayAvatarURL()
|
iconURL: (message.user ? message.user : message.author).displayAvatarURL()
|
||||||
})
|
})
|
||||||
.setColor(options.timeoutEmbedColor || "#C90000")
|
.setColor(options.timeoutEmbedColor || "#C90000")
|
||||||
.setFooter(foot)
|
.setFooter(foot)
|
||||||
.setDescription("Время вышло!\nЛимит: 30с");
|
.setTimestamp()
|
||||||
|
.setDescription(message.translate("economy/tictactoe:TIMES_UP"));
|
||||||
m.edit({
|
m.edit({
|
||||||
content: "<@" + opponent.id + "> не принял запрос",
|
content: message.translate("economy/tictactoe:NOT_ANSWERED", {
|
||||||
|
user: opponent.id
|
||||||
|
}),
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (reason == "decline") {
|
if (reason == "decline") {
|
||||||
const embed = new Discord.MessageEmbed()
|
const embed = new Discord.MessageEmbed()
|
||||||
.setTitle("Игра отменена!")
|
.setTitle(message.translate("economy/tictactoe:CANCELED"))
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: (message.user ? message.user : message.author).tag,
|
name: (message.user ? message.user : message.author).tag,
|
||||||
iconURL: (message.user ? message.user : message.author).displayAvatarURL()
|
iconURL: (message.user ? message.user : message.author).displayAvatarURL()
|
||||||
})
|
})
|
||||||
.setColor(options.timeoutEmbedColor || "#C90000")
|
.setColor(options.timeoutEmbedColor || "#C90000")
|
||||||
.setFooter(foot)
|
.setFooter(foot)
|
||||||
.setDescription(`${opponent.user.tag} отказался от игры!`);
|
.setTimestamp()
|
||||||
|
.setDescription(message.translate("economy/tictactoe:NO_ANSWER", {
|
||||||
|
user: opponent.user.tag
|
||||||
|
}));
|
||||||
m.edit({
|
m.edit({
|
||||||
embeds: [embed],
|
embeds: [embed],
|
||||||
components: []
|
components: []
|
||||||
|
@ -853,7 +883,7 @@ async function tictactoe(message, options = []) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(`tictactoe | Ошибка: ${err.stack}`);
|
console.log(`tictactoe | ERROR: ${err.stack}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,24 @@
|
||||||
{
|
{
|
||||||
"DESCRIPTION": "Крестики-нолики!",
|
"DESCRIPTION": "Крестики-нолики!",
|
||||||
"USAGE": "{{prefix}}tictactoe",
|
"USAGE": "{{prefix}}tictactoe",
|
||||||
"EXAMPLES": "{{prefix}}tictactoe"
|
"EXAMPLES": "{{prefix}}tictactoe",
|
||||||
|
"NO_USER": "Укажите пользователя!",
|
||||||
|
"BOT_USER": "Вы не можете играть против бота!",
|
||||||
|
"YOURSELF": "Вы не можете играть с самим собой!",
|
||||||
|
"ACCEPT": "Принять",
|
||||||
|
"DECLINE": "Отказаться",
|
||||||
|
"INVITE_USER": "Хей, <@!{{opponent}}>, вам предложили сыграть в крестики-нолики",
|
||||||
|
"REQUEST_SEND": "Запрос отправлен <@!{{opponent}}>",
|
||||||
|
"REQUEST_WAIT": "Ожидаю ответа {{user}}",
|
||||||
|
"WAITING": "Ожидаю ход | <@!{{user}}>, Ваш эмодзи: {{emoji}}",
|
||||||
|
"WON": "<@!{{winner}}> ({{emoji}}) выиграл!",
|
||||||
|
"CANT_PLAY": "Сейчас не ваш ход!",
|
||||||
|
"TIE": "Ничья",
|
||||||
|
"TIE_DESC": "Никто не выиграл, это ничья!",
|
||||||
|
"NO_ANSWER": "<@!{{user}}> не ответил вовремя! (30с)",
|
||||||
|
"NO_ANSWER_TITLE": "Запрос не принят вовремя",
|
||||||
|
"NOT_ANSWERED": "<@{{user}}> не принял запрос!",
|
||||||
|
"CANCELED": "Игра отменена!",
|
||||||
|
"CANCELED_DESC": "{{user}} отказался от игры!",
|
||||||
|
"TIMES_UP": "Время вышло! Лимит: 30 секунд"
|
||||||
}
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
"WORDS": "Угадай слово",
|
"WORDS": "Угадай слово",
|
||||||
"NUMBERS": "Угадай число",
|
"NUMBERS": "Угадай число",
|
||||||
"HORSERACE": "Конные скачки",
|
"HORSERACE": "Конные скачки",
|
||||||
|
"TTT": "Крестики-нолики",
|
||||||
"T_GOT": "Пополнение",
|
"T_GOT": "Пополнение",
|
||||||
"T_SEND": "Списание",
|
"T_SEND": "Списание",
|
||||||
"T_USER_GOT": "Источник",
|
"T_USER_GOT": "Источник",
|
||||||
|
|
|
@ -1,5 +1,23 @@
|
||||||
{
|
{
|
||||||
"DESCRIPTION": "Крестики-нолики!",
|
"DESCRIPTION": "Крестики-нолики!",
|
||||||
"USAGE": "{{prefix}}tictactoe",
|
"USAGE": "{{prefix}}tictactoe",
|
||||||
"EXAMPLES": "{{prefix}}tictactoe"
|
"EXAMPLES": "{{prefix}}tictactoe",
|
||||||
|
"NO_USER": "Укажите пользователя!",
|
||||||
|
"BOT_USER": "Вы не можете играть против бота!",
|
||||||
|
"YOURSELF": "Вы не можете играть с самим собой",
|
||||||
|
"ACCEPT": "Принять",
|
||||||
|
"DECLINE": "Отказаться",
|
||||||
|
"INVITE_USER": "Хей, <@!{{opponent}}>, вам предложили сыграть в крестики-нолики",
|
||||||
|
"REQUEST_SEND": "Запрос отправлен <@!{{opponent}}>.",
|
||||||
|
"WAITING": "Ожидаю ход | <@!{{user}}>, Ваш эмодзи: {{emoji}}",
|
||||||
|
"WON": "выиграл",
|
||||||
|
"CANT_PLAY": "Вы не можете играть сейчас!",
|
||||||
|
"TIE": "Ничья",
|
||||||
|
"TIE_DESC": "Никто не выиграл, это ничья!",
|
||||||
|
"NO_ANSWER": "<@!{{user}}> не ответил вовремя! (30с)",
|
||||||
|
"NO_ANSWER_TITLE": "Запрос не принят вовремя",
|
||||||
|
"NOT_ANSWERED": "<@{{user}}> не принял запрос!",
|
||||||
|
"CANCELED": "Игра отменена!",
|
||||||
|
"CANCELED_DESC": "{{user}} отказался от игры!",
|
||||||
|
"TIMES_UP": "Время вышло! Лимит: 30 секунд"
|
||||||
}
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
"WORDS": "Угадай слово",
|
"WORDS": "Угадай слово",
|
||||||
"NUMBERS": "Угадай число",
|
"NUMBERS": "Угадай число",
|
||||||
"HORSERACE": "Конные скачки",
|
"HORSERACE": "Конные скачки",
|
||||||
|
"TTT": "Крестики-нолики",
|
||||||
"T_GOT": "Пополнение",
|
"T_GOT": "Пополнение",
|
||||||
"T_SEND": "Списание",
|
"T_SEND": "Списание",
|
||||||
"T_USER_GOT": "Источник",
|
"T_USER_GOT": "Источник",
|
||||||
|
|
Loading…
Reference in a new issue