Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

Commit fb58763

Browse files
authored
chore(Deps): update discord.js dep in music bot example (#114)
1 parent e0fd0f7 commit fb58763

3 files changed

Lines changed: 8 additions & 79 deletions

File tree

examples/music-bot/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"dependencies": {
1717
"@discordjs/opus": "^0.5.0",
1818
"discord-api-types": "^0.18.1",
19-
"discord.js": "^13.0.0-dev.dec191aa1e4f22690285ca06c6eee7e6086b2930",
19+
"discord.js": "^13.0.0-dev.c6aeebb18d6b969f7c8bdb1b719883d4384dd03e",
2020
"libsodium-wrappers": "^0.7.9",
2121
"ytdl-core-discord": "^1.3.0"
2222
},

examples/music-bot/src/bot.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
joinVoiceChannel,
77
VoiceConnectionStatus,
88
} from '@discordjs/voice';
9-
import { createDiscordJSAdapter } from './music/adapter';
109
import { Track } from './music/track';
1110
import { MusicSubscription } from './music/subscription';
1211

@@ -86,7 +85,7 @@ client.on('interaction', async (interaction: Interaction) => {
8685
joinVoiceChannel({
8786
channelId: channel.id,
8887
guildId: channel.guild.id,
89-
adapterCreator: createDiscordJSAdapter(channel),
88+
adapterCreator: channel.guild.voiceAdapterCreator,
9089
}),
9190
);
9291
subscription.voiceConnection.on('error', console.warn);
@@ -113,14 +112,14 @@ client.on('interaction', async (interaction: Interaction) => {
113112
// Attempt to create a Track from the user's video URL
114113
const track = await Track.from(url, {
115114
onStart() {
116-
interaction.followUp('Now playing!', { ephemeral: true }).catch(console.warn);
115+
interaction.followUp({ content: 'Now playing!', ephemeral: true }).catch(console.warn);
117116
},
118117
onFinish() {
119-
interaction.followUp('Now finished!', { ephemeral: true }).catch(console.warn);
118+
interaction.followUp({ content: 'Now finished!', ephemeral: true }).catch(console.warn);
120119
},
121120
onError(error) {
122121
console.warn(error);
123-
interaction.followUp(`Error: ${error.message}`, { ephemeral: true }).catch(console.warn);
122+
interaction.followUp({ content: `Error: ${error.message}`, ephemeral: true }).catch(console.warn);
124123
},
125124
});
126125
// Enqueue the track and reply a success message to the user
@@ -160,22 +159,22 @@ client.on('interaction', async (interaction: Interaction) => {
160159
} else if (interaction.commandName === 'pause') {
161160
if (subscription) {
162161
subscription.audioPlayer.pause();
163-
await interaction.reply(`Paused!`, { ephemeral: true });
162+
await interaction.reply({ content: `Paused!`, ephemeral: true });
164163
} else {
165164
await interaction.reply('Not playing in this server!');
166165
}
167166
} else if (interaction.commandName === 'resume') {
168167
if (subscription) {
169168
subscription.audioPlayer.unpause();
170-
await interaction.reply(`Unpaused!`, { ephemeral: true });
169+
await interaction.reply({ content: `Unpaused!`, ephemeral: true });
171170
} else {
172171
await interaction.reply('Not playing in this server!');
173172
}
174173
} else if (interaction.commandName === 'leave') {
175174
if (subscription) {
176175
subscription.voiceConnection.destroy();
177176
subscriptions.delete(interaction.guildID);
178-
await interaction.reply(`Left channel!`, { ephemeral: true });
177+
await interaction.reply({ content: `Left channel!`, ephemeral: true });
179178
} else {
180179
await interaction.reply('Not playing in this server!');
181180
}

examples/music-bot/src/music/adapter.ts

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)