utarwyn / discord-tictactoe Goto Github PK
View Code? Open in Web Editor NEWHighly customizable innovative Discord Bot for playing Tic-Tac-Toe 馃幃馃弲
Home Page: https://npmjs.com/package/discord-tictactoe
License: Apache License 2.0
Highly customizable innovative Discord Bot for playing Tic-Tac-Toe 馃幃馃弲
Home Page: https://npmjs.com/package/discord-tictactoe
License: Apache License 2.0
I added the same code as mentioned in my code. When I created a different bot it worked somehow. Help needed please.
I can't seem to get a duel to start. I can play against the AI but when I use !ttt and then the users @ nothing works. Could anyone help me out?
As Discord is evolving months after months, a new feature has been added to use slash commands instead of text commands [1]. This improves accessibility for Discord users. That's why I thinking of moving the module in that way and deprecate text commands.
Also to support users privacy, a change wiil be made next year to Discord API to limit certified bots to use message contents [2]. I think it's a good decision and I would like to do the same for the module.
Feel free to give your feedbacks about that idea 馃槃
[1] Discord.js article about the subject: https://blog.discord.com/slash-commands-are-here-8db0a385d9e6
[2] Modifications on Discord.js API : https://support-dev.discord.com/hc/en-us/articles/4404772028055
My code is:
const Discord = require('discord.js');
const client = new Discord.Client();
const game = new TicTacToe({ language: 'en' })
module.exports = {
name: "ttt",
run: async(client, message, args) => {
client.on('message', message => {
if (message.content.startsWith('-ttt')) {
game.handleMessage(message);
}
});
}
};
Im looking to use this as a command instead of using it as a Client.On because I would like to pass through the guild prefix as my bot has custom prefixes. Is there anyway of doing this or is it only available to do through Clinent.On?
I have just thinking about new values that can be configurable by server owners, like:
Do you have other ideas?
Hi! The bot works perfectly but, it is showing all messages in French. How do I change the language to English? Please help
I just discovered that the Docker build also includes dev dependencies used to build the module. So the uncompressed size is:
utarwyn/discord-tictactoe latest 9d89756407d8 13 months ago 261MB
There are useless in production mode so I can remove them from final container to create a more lightweight image size.
It's with these small actions that we will all make modules more green IT!
Good morning, today I found your package for a game of tic-tac-toe and I really liked it. The only problem is that I would like to be able to play in Polish. After creating the "pl.json" file in the languages folder and translating the whole file, I encountered a problem with uploading it to heroku, because heroku downloads the package directly from npmjs.com, instead of using the files uploaded to "node_modules", so the game is automatically in English, is it possible to add Polish in this case?
Thank you in advance and best regards.
Hey! I noticed there was the exact same exploit previously "fixed". However I have found that changing your nickname to: @everyone @here or <@&ROLEID> or <@!USERID> will mention successfully. This is excitable and I have no way to fix the issue. I love your npm but cannot use it in my bot as a result of this exploit!
pls make it so that the buttons get disabled when someone/the ai places and the idle buttons get disabled if someone wins. also use ephemeral messages to tell others they cannot play the game/this is not their turn. ty if u add this
When I try to play with multiplayer, i always result in errors. Im using discord.js 11.6.4 (not 12..X) and im getting the following :
TypeError: Cannot read property 'client' of undefined
at new MessageEmbed (C:\My Documents\CE1DBOT\node_modules\discord-tictactoe
node_modules\discord.js\src\structures\MessageEmbed.js:13:60)
at DuelRequestMessage.createEmbed (C:\My Documents\CE1DBOT\node_modules\disc
ord-tictactoe\dist\src\bot\channel\DuelRequestMessage.js:65:16)
at DuelRequestMessage. (C:\My Documents\CE1DBOT\node_modules\disc
ord-tictactoe\dist\src\bot\channel\DuelRequestMessage.js:25:65)
at Generator.next ()
at C:\My Documents\CE1DBOT\node_modules\discord-tictactoe\dist\src\bot\chann
el\DuelRequestMessage.js:8:71
at new Promise ()
at __awaiter (C:\My Documents\CE1DBOT\node_modules\discord-tictactoe\dist\sr
c\bot\channel\DuelRequestMessage.js:4:12)
at DuelRequestMessage.send (C:\My Documents\CE1DBOT\node_modules\discord-tic
tactoe\dist\src\bot\channel\DuelRequestMessage.js:24:16)
at GameChannel. (C:\My Documents\CE1DBOT\node_modules\discord-tic
tactoe\dist\src\bot\channel\GameChannel.js:35:27)
at Generator.next ()
in the server, i get no messages back (except if i use the Ai) did it on 2 bots, and that 1 bot is already in 5 servers. Please fix!
Whenever I try to deploy slash commands, the bot doesn't respond at all. I'm guild admin but when I type ?tttdeploy
, nothing happens.
The code I'm using is:
new TicTacToe({ language: 'en' })
.login('my token is here')
.then(() => console.log('TicTacToe bot is ready to be used.'));
Console does log TicTacToe bot is ready to be used.
but nothing happens when I try to deploy. Any help would be much appreciated.
Hi,
i want to implement tic tac toe in my bot and it works as described. But I have some difficulties:
A feature to restrict tic tac toe to specific channels would really help me, because otherwise i had to modify my other commands and mess around with dc channel permissions themselves.
I hope the above does not sound rude, it sometimes happens that people say my english sounds a bit arrogant. But that's really not intended.
I would love to hear from you.
Don't delete the message instantly after a game has finished, make an option for this (the contructor options) for duration of message delete (given as null if message should not be deleted maybe)
Some server owners may need to perform specific actions when a user wins or loses a game. That's why a simple event system can be very useful.
Events I've been thinking about :
Others ideas of events by the way?
This can be very nice to add in the tictactoe a functionality to set a cooldown for person who make the command.
I also want a fonctionality to make only people with the grade "Premium" can execute the command (but he can dual a person without the grade.
And I have a problem when I made a command with space (like "ac tictactoe", my bot have a space in the prefix so I cannot use the command with the good prefix).
Hi, is there anyway to make it so it doesnt edit the message to a . when someone accepts the game ?
Hi there
How can I do multiplayer command ?
When I use the command !ttt @user
in console I get this error
DiscordAPIError: Cannot send an empty message at C:\Users\mdamm\Alpha_1\Alpha_2\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15 at C:\Users\mdamm\Alpha_1\Alpha_2\node_modules\snekfetch\src\index.js:215:21 at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:97:5) { path: '/api/v7/channels/708303949945634900/messages', code: 50006, method: 'POST' }
make a vid on how its done bec i cant run it for some reson
Hello, when i install using npm it seems to use [email protected] could you make the npm package have djs v13 ?
How to add own emojis
Using Slash Commands, custom handler.
When there is already a game, and someone executes the slash command, it doesn't work.
I suppose the bot cannot handle more than one games at once and this should be fixed.
ive never seen a bot in index.ts usually i just do node index.js, sorry im an amateur
Allow us to choose text support or slash command support
I鈥檝e been unable to add this to my bot using the commando framework, is this possible or am I doing something wrong?
{
"duel": {
"title": "Nuevo desaf铆o de duelo",
"challenge": "{invited}, **{initier}** te desafi贸 a un duelo!",
"action": "Reacciona a este mensaje para aceptar o rechazar el duelo.",
"expire": "**{invited}** no se puso a la altura del desaf铆o.",
"reject": "**{invited}** ha rechazado el duelo.",
"unknown-user": "No pudiste desafiar a **{username}**. Por favor mencione otro usuario."
},
"game": {
"title": ":game_die: {player1} **VS** {player2}",
"action": "{player}, seleccione su movimiento:",
"load": "Las reacciones se est谩n cargando, espere ...",
"end": "Nadie gan贸 el juego, 隆es un empate! 驴Intentemoslo de nuevo?",
"win": "{player} ha ganado el juego! :tada:",
"expire": "El juego ha **caducado**... quiz谩s debido a la inactividad de un usuario.",
"waiting-ai": "La IA est谩 jugando, por favor espere...",
"ai": "La IA"
}
}
If i run the command !ttt it repeats the game message 3 times.
this is my code, maybe there is something wrong with that:
=================================================================================
const TicTacToe = require('discord-tictactoe');
const Discord = require('discord.js');
const client = new Discord.Client();
const token = ;
new TicTacToe({
language: 'en',
command: '!ttt'
}, client);
client.login(token);
is it possible to win vs the ki and how? can anyone explain me?
When I do !ttt {user} I get this error, this happens only when I mention them:
]: DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (/app/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
method: 'post',
path: '/channels/775272137673408532/messages',
code: 50006,
httpStatus: 400
: }
I tried mentioning them by using ID, username, username and tag but its says "You could not challenge {user}. Please mention another user."
But when I do !ttt only it works very great
This is the error that shows me
npm WARN [email protected] requires a peer of @discordjs/uws@^10.149.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path --/node_modules/discord-tictactoe/dist/bin/tictactoe.js
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '---/node_modules/discord-tictactoe/dist/bin/tictactoe.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
Do >ttt @ROLE or <@&roleid> and even if you dont have perms it will mention that role!
another exploit present
Hello, would it be possible to provide personalized emoji?
Just to go even further than the idea detailed in issue #51: it can also be a good idea to request a duel using Discord buttons. I think that is has to be the default behavior (but there should always be a way to get back to the reactions).
Current message sent when requesting a duel (v2.2.0):
Only available in v3+.
Hey there! Your module is really amazing and I do not want to replace it with any other ones. At the moment I have observed an @everyone vulnerability where if the person's nickname is @everyone ... It is simply going to ping @ everyone ...
I made small changes to your package on my fork - but I am unable to build it on my discord bot for some reason. Using my discord fork link in the package.json file gives plenty errors.
If you could help me with either by fixing the vulnerability or buy getting my fork to work - that'd be really really appreciated.
Thanks!
Hi. I installed the discord-tictactoe game and used the costom command handler. So far it works fine, but it's only possible to play against the AI.
When I mention an user to play the game with, I get the error; "cannot send an empty message".
I can not find the problem. I did not change anything in the code, and just exactly followed the steps in "READ ME". Did I forgot something or did something wrong?
I have basic knowledge about coding bots for discord, so I am still kinda new to this.
As explained by @Boschman21 in issue #27, it could be a nice feature to configure a list of channels in which the bot will be able to be used (kind of limitation). By default the bot will be usable in all channels (current behavior). Configuration example:
{
"command": "-tictactoe",
"language": "en",
"allowedChannelIds": [
"123456789123456",
"654321987654321"
],
}
Any plans for making this compatible with discord.js version 13 that is currently in development? When I try to react to the message, nothing happens.
When a particular user uses *ttt @everyone
or *ttt @here
the bot replies and tags @everyone
or @here
. It causes spam as the user then deletes his message. Could you fix that? So it should reply saying You can't mention that
or something like that?
Based on @humblefool13's idea, there are two points to work on:
Can i translate it to other language and push to heroku?
As mentioned in issue #20, some servers owners are using a custom command handling system.
Even if this module can handle the duel command on its own, it could be nice to also support custom commands handling.
To create an independant tictactoe instance (with internal command handling):
This method will be used by the Docker image.
const TicTacToe = require('discord-tictactoe');
new TicTacToe({ command: '!ttt' })
.login(token);
To attach TicTacToe module to Discord Client (with internal command handling):
const Discord = require('discord.js');
const TicTacToe = require('discord-tictactoe');
const customClient = new Discord.Client();
new TicTacToe({ language: 'en', command: '-ttt' })
.attach(customClient);
customClient.login(token);
To handle a custom duel message (internal command handling disabled):
const Discord = require('discord.js');
const TicTacToe = require('discord-tictactoe');
const customClient = new Discord.Client();
const bot = new TicTacToe({ language: 'fr' });
// Your custom command handling system here
customClient.on('message', message => {
if (command.content.startsWith('-tictactoe')) {
bot.handleMessage(message);
}
});
customClient.login(token);
What do you think of that?
We will have to use static methods instead of new TicTacToe()
because I think its more explicit.
Legacy way of enabling tictactoe module will be deprecated.
I can't update node's version and each time I try to use the Player vs Player command it sends this
DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (/rbd/pnpm-volume/04410727-134b-45fc-bd85-405c5d9cfcc1/node_modules/discord.js/src/rest/RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async RequestHandler.push (/rbd/pnpm-volume/04410727-134b-45fc-bd85-405c5d9cfcc1/node_modules/discord.js/src/rest/RequestHandler.js:39:14) {
method: 'post',
path: '/channels/807041758205837312/messages',
code: 50006,
httpStatus: 400
}
What can I do to solve this? I'm actually using Glitch.
Hello. I would like to ask you something. If it's not too hard. It is possible to have an opening on the module to retrieve certain data such as: if the player is playing against the bot, if he has won or lost against the bot. If the player is playing against another player which of the players won and which lost and which of the winners and loser. It's to put on a data base. I will be using Quick.db as my database. Thank you
hello , since discord.js V13 is out officially and works great , I would like you to use buttons for the game , the AI is wonderful literally not a single human was able to beat the AI , I dont think changing to buttons will be too much work , but if you do that gonna align the package and bots using the package to latest features available and also buttons can be more easy to use and play in .
I mean something like this - https://cdn.discordapp.com/attachments/852679547199422497/875216094309253180/unknown.png
thank you so much!
also in one server the bot can operate one game at a time I would like you to look into that and make it possible for multiple games simultaneously but of course not for same users , i dont know if its just with me or with everyone
I keep getting this message if i invite someone to duel with me:
You could not challenge [username]. Please mention another user.
Could you please fix this
A declarative, efficient, and flexible JavaScript library for building user interfaces.
馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google 鉂わ笍 Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.