apiweiser/discord_js-13-to-14
discord.js 13 to 14: builders, addFields, GatewayIntentBits, Partials, ChannelType and PermissionFlagsBits
# discord_js-13-to-14
Mechanical part of the discord.js 13 → 14 migration
([guide](https://discordjs.guide/additional-info/changes-in-v14.html)):
- builders: `MessageEmbed` → `EmbedBuilder`, `MessageActionRow` → `ActionRowBuilder`,
`MessageButton` → `ButtonBuilder`, `MessageSelectMenu` → `StringSelectMenuBuilder`,
`Modal` → `ModalBuilder`, `TextInputComponent` → `TextInputBuilder`,
`MessageAttachment` → `AttachmentBuilder`
- `embed.addField(name, value, inline)` → `embed.addFields({ name, value, inline })`
- `Intents.FLAGS.GUILD_MESSAGES` → `GatewayIntentBits.GuildMessages`,
`Permissions.FLAGS.MANAGE_ROLES` → `PermissionFlagsBits.ManageRoles`
- `partials: ['MESSAGE']` → `partials: [Partials.Message]`
- `channel.type === 'GUILD_TEXT'` → `channel.type === ChannelType.GuildText`
- `setStyle('PRIMARY')` → `setStyle(ButtonStyle.Primary)` (and `TextInputStyle`)
Works with `require` and `import`, destructured or through a namespace
(`Discord.MessageEmbed`); names the new code needs are added to the file's
discord.js import.
Not handled: interaction type guards (`isCommand()` now matches every command
type), the privileged `MessageContent` intent, enum values passed in option
objects (`channels.create(name, { type: 'GUILD_TEXT' })`), and snapshot tests
of embed objects, whose shape changes. Run the tests.
```sh
npx codemod run @apiweiser/discord_js-13-to-14 --target .
```