2022-01-13 00:56:24 +05:00
|
|
|
const Command = require("../../base/Command"),
|
2022-01-01 00:50:09 +05:00
|
|
|
TTT = require("discord-tictactoe");
|
|
|
|
|
|
|
|
class TicTacToe extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
|
|
name: "tictactoe",
|
|
|
|
dirname: __dirname,
|
2022-01-04 21:16:52 +05:00
|
|
|
enabled: false,
|
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-01-13 00:26:23 +05:00
|
|
|
async run(message) {
|
|
|
|
const game = new TTT({ language: "ru" });
|
2022-01-01 00:50:09 +05:00
|
|
|
game.handleMessage(message);
|
2022-01-01 23:36:48 +05:00
|
|
|
|
2022-01-01 23:50:33 +05:00
|
|
|
game.on("win", async (data) => {
|
2022-01-02 14:01:18 +05:00
|
|
|
if (data.winner.id === "AI") return;
|
|
|
|
|
2022-01-01 23:45:20 +05:00
|
|
|
message.sendT("fun/number:WON", {
|
|
|
|
winner: data.winner.displayName
|
|
|
|
});
|
|
|
|
|
|
|
|
const userdata = await this.client.findOrCreateMember({
|
|
|
|
id: data.winner.id,
|
|
|
|
guildID: message.guild.id
|
|
|
|
});
|
|
|
|
|
2022-01-05 22:04:46 +05:00
|
|
|
const info = {
|
|
|
|
user: message.translate("economy/tictactoe:DESCRIPTION"),
|
|
|
|
amount: 100,
|
|
|
|
date: Date.now(),
|
|
|
|
type: "got"
|
|
|
|
};
|
|
|
|
|
|
|
|
data.memberData.transactions.push(info);
|
|
|
|
|
2022-01-01 23:45:20 +05:00
|
|
|
userdata.money = userdata.money + 100;
|
|
|
|
userdata.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
|
|
|
|
|
|
|
module.exports = TicTacToe;
|