discord-tictactoe
discord-tictactoe copied to clipboard
Working around message contents which is now a privileged intent
While trying to test the discord.js v14 support added by PR #276, I noticed that the ?tttdeploy
and ?tttdelete
text commands were not working anymore. I learned that this is a limitation at the initiative of Discord.
Discord article: https://support-dev.discord.com/hc/en-us/articles/4404772028055 Quoting: "on August 31, 2022, access to message content will become a Privileged Intent".
Also:
The textual command to start a game is also affected by this limitation. Soon you will not be able to start a game using it. In order to fix that, I will work on new releases of versions 2 and 3 before this date. These versions will require you to add the privileged intent MESSAGE CONTENT
to your bot to use the text command.
And for the future? I understand the policy of Discord and I follow their principes. Messages should no longer be used to start a game, commands are the norm. Version 2 of the module will be deprecated as of August 31, 2022, and no more feature will be added on text commands as of this date on versions 3+ of the module.
Module version: 3.0.0 Discord.js version: 14.0.3
Do you have any idea on how to register slash commands without using messages? I do not want to force the usage of the privileged intent, only for admin commands. Thank you!
According to the rules of discord's new intent, when mentioning the bot or botrole of it, the content of the message is loaded, even if it's without the intent, I've been using this in mine as an alternative for a while, so try to use it too.
Take a look at the code below which is from my bot. https://github.com/Raccoons-Code/Konan/blob/main/src/events/MessageCreate.ts#L20
Super interesting idea! Thank you, I will work on this :+1: (this is explained in the Discord article.. I didn't read enough seriously...)
Versions 2 and 3 of the module are using Discord API v6 and v9, so I do not have specific action to do in the module source code. More info on the Discord documentation: https://discord.com/developers/docs/topics/gateway#gateway-intents
But I will update the wiki to explicit the need of the privilged intent MESSAGE_CONTENT
and discourage using text commands.
Starting from v4 of the module, an error will be thrown with an explicit message when you configure a text command without the privileged intent enabled:
Error: You must enable Message Content intent to use the text command.
at TicTacToe.<anonymous> (<anonymous>\discord-tictactoe\dist\src\index.js:48:27)
at Generator.throw (<anonymous>)
at rejected (<anonymous>\discord-tictactoe\dist\src\index.js:6:65)
Version 4.0.0 of the module is now out with the support of discord.js v14 👍 More info on the release here: https://github.com/utarwyn/discord-tictactoe/releases/tag/v4.0.0