`TextChannel.send` function has wrong types for the `components` parameter
See original GitHub issueWhich package is this bug report for?
builders
Issue description
Seems like the types are wrong and send
doesn’t accept ActionRowBuilder
as a component. I know that the docs are outdated at the moment, maybe I’m doing something wrong? If I cast row
to any
, the code actually compiles and works as intended.
Steps to reproduce:
- Run the sample code through
tsc
- Get the compilation error
Code sample
function test(channel: TextChannel) {
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setCustomId('approve')
.setLabel('Approve')
.setStyle(ButtonStyle.Success)
)
return channel.send({
content: 'sample',
components: [row],
})
}
Package version
14.0.3
Node.js version
17.3.0
Operating system
linux, mac os
Priority this issue should have
Medium (should be fixed soon)
Which partials do you have configured?
Channel
Which gateway intents are you subscribing to?
GuildMessages
I have tested this issue on a development release
96b62b6.0
Issue Analytics
- State:
- Created a year ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
channel.send is not a function discord.js - Stack Overflow
PS: Your first error was TypeError: channel.send is not a function , so it seems that it was not a text channel.
Read more >ChannelManager has wrong type parameter #6935 - GitHub
You can't send messages to voice channels nor categories. The issue is that the Cache Manager doesn't hold / yield instances of the...
Read more >Updating from v12 to v13 - discord.js Guide
Channel types are now uppercase and align with Discord's naming conventions. - if(channel.type === 'text') channel.send('Content'); ...
Read more >API Reference - Discord.py
This class is used to interact with the Discord WebSocket and API. ... Control how the client handles mentions by default on every...
Read more >TextChannel | Eris 0.17.1 - Abal.moe
The type of component - If 1, it is a collection and a components array (nested) is required; if 2, it is a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This can be remedied with a factory function instead of using the class constructor ie createActionRow<T>(). Dunno if the maintainers would want to include that in the library though.
https://github.com/discordjs/discord.js/pull/8271 but it was closed without specifying any reason.