question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in text voice channels with a creating a collector

See original GitHub issue

Which package is this bug report for?

discord.js

Issue description

Discord seems to have rolled out a beta feature to some servers which seems to be a text channel connected to a voice channel. https://www.reddit.com/r/discordapp/comments/thuyy1/so_now_voice_channel_is_mixed_with_a_text_channel/

My bots create ButtonInteractions and attach a MessageComponentCollector to them to wait for a response. The first error I get is when the MessageComponentCollector is called on the channel I get an error saying the function doesn’t exist. Capture

Which is fair enough and easy for me to ignore the error until the feature is fully supported.

The real problem is when someone clicks the button. I am getting a TypeError from the Discord.js library that is crashing the program. It seems to occur during the MessageComponentInteraction creation. Capture

Because the issue is on the Discord.js side it makes it hard to deal with on my end. And while I understand the feature is experimental on Discord I cannot really have it crashing my bot every time someone clicks a button in those channels.

Code sample

let channel;
try
{
       channel = await this.interaction.client.channels.fetch(this.interaction.channelId);
}
catch(error)
{
        console.error(error);
        return;
}
        
this.collector = channel.createMessageComponentCollector(
       {
            filter,
            time: minToMilli(14)
        });
// TypeError: channel.createMessageComponentCollector is not a function

Package version

discord.js@13.6.0

Node.js version

v18.0.0

Operating system

Debian 4.19.132-1 (2020-07-24) x86_64

Priority this issue should have

High (immediate attention needed)

Which partials do you have configured?

No Partials

Which gateway intents are you subscribing to?

Guilds, DirectMessages

I have tested this issue on a development release

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Mirai-Mikicommented, May 22, 2022

Thanks for the info. Because of how many guilds the bots are in I will leave it at the current stable and they will just have to do without until v14. Thanks again.

0reactions
kyranetcommented, May 22, 2022

Yeah, that’s most likely caused by TiV being a voice channel, and therefore the method not existing.

Because VC#isText() is false, https://github.com/discordjs/discord.js/blob/v13/src/client/actions/MessageCreate.js#L14 will return no message, which consequently will make discord.js not emit the message (since v13 has no way to handle it).

Therefore, your error should not longer happen again.

Note If you want to support TiV before we release a stable version supporting it, you can update to v14/dev.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Collectors - discord.js Guide
If you don't provide a filter all messages in the channel the collector was started on will be collected.
Read more >
Discord adds text chat directly inside your voice channels
Discord's new Text Chat in Voice Channels finally lets you type messages to everyone within a voice channel. The feature is rolling out...
Read more >
Discord Text & Voice Channels COMBINED - YouTube
Discord currently has a new feature for Community servers. You can enable Text in Voice to combine voice and text channels into one...
Read more >
How to Enable Text Chat in Discord Voice Channels RIGHT ...
Quick tutorial on how to Enable the new Text Chat in every Discord Voice Chat Channel. So you no longer have to create...
Read more >
How to overwritePermissions for voice channel?
The code creates no errors but the permissions do not change. Does anyone know why? Here is my code: if(reaction.emoji.name === '✓') {...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found