Code Monkey home page Code Monkey logo

discord-tictactoe's People

Contributors

bestinspire avatar commanderroot avatar dependabot-preview[bot] avatar dependabot[bot] avatar gorniaky avatar imluckycraft avatar kaysil avatar komashifx avatar mrnothingslee-sudo avatar net-tech avatar nfytx avatar ninelel avatar pggamer2 avatar proxyping avatar putsbam avatar utarwyn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

discord-tictactoe's Issues

Not working in my bot

I added the same code as mentioned in my code. When I created a different bot it worked somehow. Help needed please.

Cant start Duel

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?

Switch from text command to slash command

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

Custom Command Handler

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?

New configuration values

I have just thinking about new values that can be configurable by server owners, like:

  • expiration time of a duel request (now = 60s)
  • expiration time of a player turn (now = 30s)
  • custom player emojis?

Do you have other ideas?

Language Setup

Hi! The bot works perfectly but, it is showing all messages in French. How do I change the language to English? Please help

Improve Docker image size

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!

Changing language after uploading on Heroku

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.

@everyone @here @role exploit #2

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!

make it a bit more better looking pls

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

Multi-player results in errors!

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!

Bot is not deploying slash commands

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.

Limit Game to Channel, German Translation

Hi,
i want to implement tic tac toe in my bot and it works as described. But I have some difficulties:

  1. I cant use my command handler to trigger the bot, i have to put the code in my main file
  2. I cant limit the usage to specific channels, meaning you can trigger tic tac toe in every channel. I tried to limit it by using an if statement, but this did not really work, because it just kinda ignored it.
  3. There isnt a german translation. I'd love to help with that

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.

feat: Message Delete

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)

Event system

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 :

  • When an user wins a game
  • When an user loses a game
  • When there is a tie

Others ideas of events by the way?

Cooldown, permission and prefix with space

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).

editing it to a .

Hi, is there anyway to make it so it doesnt edit the message to a . when someone accepts the game ?

Multiplayer

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' }

how

make a vid on how its done bec i cant run it for some reson

The bot cannot handle 2 games at once.

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.

Changing Time Values

I was wondering how to change cooldown times and request expire times. I tried changing the values in the source code itself and then restarting the bot, but that didn't seem to work

Screenshot 2021-05-04 at 11 46 08 AM

Adding this commando project.

I鈥檝e been unable to add this to my bot using the commando framework, is this possible or am I doing something wrong?

Spanish translation = es

{
  "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"
  }
}

Repeating tic tac toe message

If i run the command !ttt it repeats the game message 3 times.

image

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);

!ttt <user> causing problem

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

I cant install package, any ideas of what do i need to install extra, thanks

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:

Another @role exploit!

Do >ttt @ROLE or <@&roleid> and even if you dont have perms it will mention that role!
another exploit present
Screenshot_20210201-000028_Discord

Request a duel using buttons

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):
image

Only available in v3+.

Another @everyone @here vulnerability

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!

"Cannot send an empty message".

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.

Limit usage in specific channels

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"
  ],
}

Support for Discord.js V13

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.

*ttt @everyone is causing spam

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?

Simultaneous games

Based on @humblefool13's idea, there are two points to work on:

  1. There is a bug because games should be able to be started in different channels at the same time, but that does not work with the latest development version of the module.
  2. Add a new option to allow users to start multiple games in same channels simultaneously but we have to follow that rule : one user must not be able to play two games in same channel at same time irrespective of with AI or with other players.

Support custom commands to start a duel

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.

Some samples of how this could works:

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.

DiscordAPIError: Cannot send an empty message (node v14.15.2)

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.

Request an opening for the module to add retrieve some information about the game

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

using buttons

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.