utarwyn / discord-tictactoe

Highly customizable innovative Discord Bot for playing Tic-Tac-Toe 🎮🏅
https://npmjs.com/package/discord-tictactoe
Apache License 2.0
100 stars 35 forks source link

Cant start Duel #18

Closed Tman0560 closed 3 years ago

Tman0560 commented 3 years ago

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?

anjannair commented 3 years ago

@Tman0560 have you followed steps mentioned in README?

Tman0560 commented 3 years ago

Yes I have. I used the “use it as a independent bot” instructions in the Read Me

anjannair commented 3 years ago

@Tman0560 no console errors? Bot token is valid? If still error then could you please share your code

Tman0560 commented 3 years ago

No console errors. Bot Token is Valid. The bot works against the AI but it does nothing when doing !ttt @user. I wrote the script in Visual Studio Code.

anjannair commented 3 years ago

@Tman0560 attack a screenshot of the code if possible? So I can have look at it

Tman0560 commented 3 years ago

main js - Discord Bot - Visual Studio Code 12_16_2020 12_04_45 PM main js - Discord Bot - Visual Studio Code 12_16_2020 12_04_32 PM main js - Discord Bot - Visual Studio Code 12_16_2020 12_04_28 PM main js - Discord Bot - Visual Studio Code 12_16_2020 12_04_21 PM

Sure

utarwyn commented 3 years ago

Hello @Tman0560, which version of Node do you use? I will try to reproduce the bug to fix it. Sounds weird because you should have either an error message in your text channel or a fatal error with the stack trace in your console. Also, the mentionned member must validate those conditions to start a duel with it : https://github.com/utarwyn/discord-tictactoe/blob/37f936092bfa37801b52cb9c4b40322c40701175/src/bot/commands/StartCommand.ts#L67-L70

Otherwise a warning message is sent by the bot in the same channel, do you see it? The only case when a message is neither printed in the console nor in the text channel is when the command is not handled or a game is already running in it. Or a permission problem.

Tman0560 commented 3 years ago

I use Node version 15.4, Also I use a raspberry pi 3 to run the bot. It’s a 32 bit system so do you think that affects it? The Bot also has the proper permissions for the server. Like you said it doesn’t give me a error in the code or in the text chat.

Tman0560 commented 3 years ago

@utarwyn @anjannair With some messing around I managed to have it give me an error code. Here's the error code...

/usr/bin/node ./main.js null: TypeError: fields.flat is not a function at Function.normalizeFields (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/MessageEmbed.js:450:8) at MessageEmbed.setup (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/MessageEmbed.js:78:91) at new MessageEmbed (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/MessageEmbed.js:18:10) at embedLikes.map.e (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/APIMessage.js:166:40) at Array.map () at APIMessage.resolveData (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/APIMessage.js:166:31) at TextChannel.send (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:166:62) at DuelRequestMessage. (/home/pi/Desktop/discordbot/node_modules/discord-tictactoe/dist/src/bot/channel/DuelRequestMessage.js:25:55) at Generator.next () at /home/pi/Desktop/discordbot/node_modules/discord-tictactoe/dist/src/bot/channel/DuelRequestMessage.js:8:71 {stack: 'TypeError: fields.flat is not a function …st/src/bot/channel/DuelRequestMessage.js:8:71', message: 'fields.flat is not a function'} arg0: TypeError: fields.flat is not a function at Function.normalizeFields (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/MessageEmbed.js:450:8) at MessageEmbed.setup (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/MessageEmbed.js:78:91) at new MessageEmbed (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/MessageEmbed.js:18:10) at embedLikes.map.e (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/APIMessage.js:166:40) at Array.map () at APIMessage.resolveData (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/APIMessage.js:166:31) at TextChannel.send (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:166:62) at DuelRequestMessage. (/home/pi/Desktop/discordbot/node_modules/discord-tictactoe/dist/src/bot/channel/DuelRequestMessage.js:25:55) at Generator.next () at /home/pi/Desktop/discordbot/node_modules/discord-tictactoe/dist/src/bot/channel/DuelRequestMessage.js:8:71 {stack: 'TypeError: fields.flat is not a function …st/src/bot/channel/DuelRequestMessage.js:8:71', message: 'fields.flat is not a function'} : _tickCallback @ internal/process/next_tick.js:68:7 null: TypeError: fields.flat is not a function at Function.normalizeFields (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/MessageEmbed.js:450:8) at MessageEmbed.setup (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/MessageEmbed.js:78:91) at new MessageEmbed (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/MessageEmbed.js:18:10) at embedLikes.map.e (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/APIMessage.js:166:40) at Array.map () at APIMessage.resolveData (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/APIMessage.js:166:31) at TextChannel.send (/home/pi/Desktop/discordbot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:166:62) at DuelRequestMessage. (/home/pi/Desktop/discordbot/node_modules/discord-tictactoe/dist/src/bot/channel/DuelRequestMessage.js:25:55) at Generator.next () at /home/pi/Desktop/discordbot/node_modules/discord-tictactoe/dist/src/bot/channel/DuelRequestMessage.js:8:71 {stack: 'TypeError: fields.flat is not a function …st/src/bot/channel/DuelRequestMessage.js:8:71', message: 'fields.flat is not a function'}

utarwyn commented 3 years ago

Oh.. it seems to be a Discord.js problem. Like that issue on their repository: discordjs/discord.js#3913 They are all saying to upgrade Node to at least v12+ or v14+. So check your node version with node -version and upgrade it if needed. This is not a problem with my bot I think.

Tman0560 commented 3 years ago

Okay cool I will do some investigating then on that I will let you know if it was the node version

Tman0560 commented 3 years ago

It was the node version and nothing wrong with your bot. Thank you so much for your help!

utarwyn commented 3 years ago

Great news! Thank you for the feedback, enjoy the bot :smile: