2022-08-09 23:48:33 +05:00
|
|
|
const { SlashCommandBuilder } = require("discord.js");
|
|
|
|
const BaseCommand = require("../../base/BaseCommand"),
|
|
|
|
tictactoe = require("../../helpers/tictactoe");
|
|
|
|
|
|
|
|
class TicTacToe extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("tictactoe")
|
2023-06-06 22:48:46 +05:00
|
|
|
.setDescription(client.translate("fun/tictactoe:DESCRIPTION"))
|
2023-06-15 19:46:27 +05:00
|
|
|
.setDescriptionLocalizations({
|
|
|
|
"uk": client.translate("fun/tictactoe:DESCRIPTION", null, "uk-UA"),
|
|
|
|
"ru": client.translate("fun/tictactoe:DESCRIPTION", null, "ru-RU"),
|
|
|
|
})
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDMPermission(false)
|
2022-08-09 23:48:33 +05:00
|
|
|
.addUserOption(option => option.setName("user")
|
|
|
|
.setDescription(client.translate("common:USER"))
|
2023-06-15 19:46:27 +05:00
|
|
|
.setDescriptionLocalizations({
|
|
|
|
"uk": client.translate("common:USER", null, "uk-UA"),
|
|
|
|
"ru": client.translate("common:USER", null, "ru-RU"),
|
|
|
|
})
|
2022-08-09 23:48:33 +05:00
|
|
|
.setRequired(true)),
|
|
|
|
aliases: [],
|
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: false,
|
2022-08-09 23:48:33 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
async onLoad() {
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
|
|
|
* @param {Object} data
|
|
|
|
*/
|
|
|
|
async execute(client, interaction) {
|
|
|
|
tictactoe(interaction, {
|
|
|
|
resultBtn: true,
|
|
|
|
embedColor: client.config.embed.color,
|
2022-12-15 21:02:38 +05:00
|
|
|
embedFoot: client.config.embed.footer,
|
2022-08-09 23:48:33 +05:00
|
|
|
}).then(async winner => {
|
|
|
|
const memberData = await client.findOrCreateMember({
|
|
|
|
id: winner.id,
|
2022-12-15 21:02:38 +05:00
|
|
|
guildId: interaction.guildId,
|
2022-08-09 23:48:33 +05:00
|
|
|
});
|
|
|
|
|
2022-10-09 14:26:22 +05:00
|
|
|
memberData.money += 100;
|
|
|
|
await memberData.save();
|
|
|
|
|
2022-08-09 23:48:33 +05:00
|
|
|
const info = {
|
|
|
|
user: interaction.translate("economy/transactions:TTT"),
|
|
|
|
amount: 100,
|
|
|
|
date: Date.now(),
|
2022-12-15 21:02:38 +05:00
|
|
|
type: "got",
|
2022-08-09 23:48:33 +05:00
|
|
|
};
|
|
|
|
memberData.transactions.push(info);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = TicTacToe;
|