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

fix(Interaction): update interaction methods #244

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shadyrajab
Copy link

@shadyrajab shadyrajab commented Dec 29, 2021

Updating the Interaction methods to the latest discord.js version

  • interaction.defer() -> interaction.deferReply()
  • interaction.get() -> interaction.getString()

Fixing the audio resource. The track was not being played and the parameters passed to ytdl() method was throwing an error, these parameters have been removed. Also, use probe.stream as parameter to createAudioResource makes the track don't be played, I changed this parameter to a ytdl method, imported from ytdl-core: await ytdla(this.url). These two modifications makes the bot work normally... (Sorry if I speak something wrong. I don't speak english very well =D)

@megatank58
Copy link

#174 fixes this and other improvements, perhaps the other changes could be suggested on that PR?

// Extract the video URL from the command
const url = interaction.options.get('song')!.value! as string;
const url = interaction.options.getString('song') as string;
Copy link

@imranbarbhuiya imranbarbhuiya Dec 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just add true as the 2nd parameter and it's type will be string

- const url = interaction.options.getString('song') as string;

+ const url = interaction.options.getString('song', true);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants