Omr
Omr
DIAdiscord.js - Imagine an app
Created by Omr on 10/1/2024 in #djs-voice
Type 'InternalDiscordGatewayAdapterCreator' is not assignable to type 'DiscordGatewayAdapterCreator'
// package.json
"dependencies": {
"@discordjs/voice": "^0.17.0",
"@prisma/client": "^5.20.0",
"discord.js": "^14.16.3",
"dotenv": "^16.4.5",
"libsodium-wrappers": "^0.7.15",
"markov-strings": "^3.0.1",
"moment": "^2.30.1",
"mongodb": "^6.9.0"
},
"devDependencies": {
"nodemon": "^3.1.7",
"prettier": "^3.3.3",
"prisma": "^5.20.0",
"typescript": "^5.6.2"
}
// package.json
"dependencies": {
"@discordjs/voice": "^0.17.0",
"@prisma/client": "^5.20.0",
"discord.js": "^14.16.3",
"dotenv": "^16.4.5",
"libsodium-wrappers": "^0.7.15",
"markov-strings": "^3.0.1",
"moment": "^2.30.1",
"mongodb": "^6.9.0"
},
"devDependencies": {
"nodemon": "^3.1.7",
"prettier": "^3.3.3",
"prisma": "^5.20.0",
"typescript": "^5.6.2"
}
// join.ts
import {
GuildMember,
InteractionContextType,
SlashCommandBuilder,
} from 'discord.js';
import { joinVoiceChannel } from '@discordjs/voice';
import Command from '../interfaces/command';
import emojiMap from '../utils/emojiMap';

const join: Command = {
data: new SlashCommandBuilder()
.setName('join')
.setDescription('Join the voice channel.')
.setContexts(InteractionContextType.Guild),
usage: '/join',
execute: async interaction => {
if (!interaction.guild || !interaction.member) return;
const guildMember = interaction.member as GuildMember;
const voiceChannel = guildMember.voice.channel;

if (!voiceChannel) {
await interaction.reply(
`${emojiMap.error.cross} You are not in a voice channel.`,
);
return;
}

joinVoiceChannel({
channelId: voiceChannel.id,
guildId: interaction.guild.id,
selfDeaf: false,
selfMute: false,
adapterCreator: interaction.guild.voiceAdapterCreator,
});

await interaction.reply(
`${emojiMap.sound.normal} Joined the voice channel ${voiceChannel.name}`,
);
},
};

export default join;
// join.ts
import {
GuildMember,
InteractionContextType,
SlashCommandBuilder,
} from 'discord.js';
import { joinVoiceChannel } from '@discordjs/voice';
import Command from '../interfaces/command';
import emojiMap from '../utils/emojiMap';

const join: Command = {
data: new SlashCommandBuilder()
.setName('join')
.setDescription('Join the voice channel.')
.setContexts(InteractionContextType.Guild),
usage: '/join',
execute: async interaction => {
if (!interaction.guild || !interaction.member) return;
const guildMember = interaction.member as GuildMember;
const voiceChannel = guildMember.voice.channel;

if (!voiceChannel) {
await interaction.reply(
`${emojiMap.error.cross} You are not in a voice channel.`,
);
return;
}

joinVoiceChannel({
channelId: voiceChannel.id,
guildId: interaction.guild.id,
selfDeaf: false,
selfMute: false,
adapterCreator: interaction.guild.voiceAdapterCreator,
});

await interaction.reply(
`${emojiMap.sound.normal} Joined the voice channel ${voiceChannel.name}`,
);
},
};

export default join;
I'm getting an error that the InternalDiscordGatewayAdapterCreator is not assignable to the type DiscordGatewayAdapterCreator. I'm using discord.js v14.16.3 and @discordjs/voice v0.17.0 as shown in my package.json. The code still compiles and my bot can still join voice channels, its just giving me this error everytime I run tsc.
6 replies