TaidaTaida

Audio Troubles

Mar 19th, 2025 (edited)
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. //Imports; GatewayIntent GuildVoiceStates is already included
  2. const { getVoiceConnection, createAudioPlayer, createAudioResource, AudioPlayerStatus } = require('@discordjs/voice');
  3.  
  4.  
  5. //Connecting and subscribing
  6. const connection = getVoiceConnection(interaction.guild.id);
  7. const filepath = '../../utilityFiles/soundbite.mp3';
  8. const audioPlayer = createAudioPlayer();
  9. const audioResource = createAudioResource(filepath, {inlineVolume: true});
  10.  
  11. audioResource.volume.setVolume(1.0);
  12. audioPlayer.play(audioResource);
  13. connection.subscribe(audioPlayer);
  14.  
  15.  
  16. //Test to see if audioPlayer's playing, which the console says it has.
  17. audioPlayer.on(AudioPlayerStatus.Playing, () => {
  18. console.log('The audio player has started playing!');
  19. });
  20.  
  21.  
  22. // Dependency Report
  23.  
  24. --------------------------------------------------
  25. Core Dependencies
  26. - @discordjs/voice: 0.18.0
  27. - prism-media: 1.3.5
  28.  
  29. Opus Libraries
  30. - @discordjs/opus: 0.10.0
  31. - opusscript: 0.0.8
  32. Encryption Libraries
  33. - sodium-native: not found
  34. - sodium: not found
  35. - @stablelib/xchacha20poly1305: not found
  36. - @noble/ciphers: not found
  37.  
  38. FFmpeg
  39. - version: 6.0-essentials_build-www.gyan.dev
  40. - libopus: yes
  41. --------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment