2022-01-13 00:56:24 +05:00
|
|
|
const Command = require("../../base/Command"),
|
2022-02-02 23:54:06 +05:00
|
|
|
tictactoe = require("../../helpers/tictactoe");
|
2022-01-01 00:50:09 +05:00
|
|
|
|
|
|
|
class TicTacToe extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
|
|
name: "tictactoe",
|
|
|
|
dirname: __dirname,
|
2022-02-02 23:54:06 +05:00
|
|
|
enabled: true,
|
2022-01-01 00:50:09 +05:00
|
|
|
guildOnly: false,
|
|
|
|
aliases: ["ttt"],
|
|
|
|
memberPermissions: [],
|
|
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
|
|
|
cooldown: 2000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-02-02 23:54:06 +05:00
|
|
|
async run(message, args, data) {
|
|
|
|
tictactoe(message, {
|
2022-02-03 12:11:51 +05:00
|
|
|
resultBtn: true,
|
2022-02-02 23:54:06 +05:00
|
|
|
embedColor: data.config.embed.color,
|
|
|
|
embedFoot: data.config.embed.footer
|
|
|
|
}).then(async (winner) => {
|
|
|
|
const memberData = await this.client.findOrCreateMember({
|
|
|
|
id: winner.id,
|
2022-01-01 23:45:20 +05:00
|
|
|
guildID: message.guild.id
|
|
|
|
});
|
|
|
|
|
2022-01-05 22:04:46 +05:00
|
|
|
const info = {
|
2022-02-03 12:11:51 +05:00
|
|
|
user: message.translate("economy/transactions:TTT"),
|
2022-01-05 22:04:46 +05:00
|
|
|
amount: 100,
|
|
|
|
date: Date.now(),
|
|
|
|
type: "got"
|
|
|
|
};
|
|
|
|
|
2022-02-02 23:54:06 +05:00
|
|
|
memberData.transactions.push(info);
|
2022-01-05 22:04:46 +05:00
|
|
|
|
2022-02-03 12:11:51 +05:00
|
|
|
memberData.money += 100;
|
2022-02-02 23:54:06 +05:00
|
|
|
memberData.save();
|
2022-01-01 23:36:48 +05:00
|
|
|
});
|
2022-01-01 00:50:09 +05:00
|
|
|
}
|
2022-01-13 00:26:23 +05:00
|
|
|
}
|
2022-01-01 00:50:09 +05:00
|
|
|
|
2022-02-02 23:54:06 +05:00
|
|
|
module.exports = TicTacToe;
|
|
|
|
|
|
|
|
// const game = new TTT({ language: "ru" });
|
|
|
|
// game.handleMessage(message);
|
|
|
|
|
|
|
|
// game.on("win", async (data) => {
|
|
|
|
// if (data.winner.id === "AI") return;
|
|
|
|
|
|
|
|
// message.sendT("fun/number:WON", {
|
|
|
|
// winner: data.winner.displayName
|
|
|
|
// });
|
|
|
|
|
|
|
|
// const userdata = await this.client.findOrCreateMember({
|
|
|
|
// id: data.winner.id,
|
|
|
|
// guildID: message.guild.id
|
|
|
|
// });
|
|
|
|
|
|
|
|
// const info = {
|
|
|
|
// user: message.translate("economy/tictactoe:DESCRIPTION"),
|
|
|
|
// amount: 100,
|
|
|
|
// date: Date.now(),
|
|
|
|
// type: "got"
|
|
|
|
// };
|
|
|
|
|
|
|
|
// data.memberData.transactions.push(info);
|
|
|
|
|
|
|
|
// userdata.money = userdata.money + 100;
|
|
|
|
// userdata.save();
|
|
|
|
// });
|