JaBa/commands/Fun/tictactoe.js

42 lines
895 B
JavaScript
Raw Normal View History

const Command = require("../../base/Command.js"),
TTT = require("discord-tictactoe");
class TicTacToe extends Command {
constructor(client) {
super(client, {
name: "tictactoe",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["ttt"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args) {
const game = new TTT({ language: "ru" })
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;
message.sendT("fun/number:WON", {
winner: data.winner.displayName
});
const userdata = await this.client.findOrCreateMember({
id: data.winner.id,
guildID: message.guild.id
});
userdata.money = userdata.money + 100;
userdata.save();
2022-01-01 23:36:48 +05:00
});
}
};
module.exports = TicTacToe;