-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🚧 Updating Distube #157
🚧 Updating Distube #157
Conversation
Reviewer's Guide by SourceryThis pull request updates the Distube music bot implementation, focusing on code simplification, error handling improvements, and the addition of new plugins. The changes primarily affect the music command handling, event listeners, and the main bot configuration. File-Level Changes
Tips
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Drlanderf - I've reviewed your changes - here's some feedback:
Overall Comments:
- The code cleanup is appreciated, but please review the removed error handling to ensure no critical functionality is lost.
- Consider maintaining consistency in module imports. The switch from require() to import in index.js might cause issues if the rest of the project uses CommonJS.
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
ephemeral: true, | ||
}); | ||
embed.setDescription("Vous devez être dans un salon vocal pour utiliser cette commande."); | ||
return interaction.reply({embeds: [embed], ephemeral: true,}); | ||
} | ||
if (!member.voice.channelId === guild.members.me.voice.channelId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Incorrect condition in voice channel check
The condition for checking if the member is in the same voice channel as the bot is incorrect. The current negation will always evaluate to a boolean, making the comparison meaningless. Consider changing it to if (member.voice.channelId !== guild.members.me.voice.channelId)
.
emitNewSongOnly: true, | ||
leaveOnFinish: true, | ||
emitAddSongWhenCreatingQueue: false, | ||
client.distube = new Distube.default(client, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (typo): Potential typo in Distube initialization
There seems to be a typo in the Distube initialization. It should be DisTube
(with a capital 'T') instead of Distube
. This could lead to runtime errors if not corrected.
if (channel) | ||
channel.send( | ||
`⛔ | An error encountered: ${e.toString().slice(0, 1974)}` | ||
); | ||
channel.send(`⛔ | An error encountered: ${e.toString().slice(0, 1974)}`); | ||
else console.error(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code-quality): Use block braces for ifs, whiles, etc. (use-braces
)
if (channel) | |
channel.send( | |
`⛔ | An error encountered: ${e.toString().slice(0, 1974)}` | |
); | |
channel.send(`⛔ | An error encountered: ${e.toString().slice(0, 1974)}`); | |
else console.error(e); | |
if (channel) { | |
channel.send(`⛔ | An error encountered: ${e.toString().slice(0, 1974)}`); | |
} else console.error(e); | |
Explanation
It is recommended to always use braces and create explicit statement blocks.Using the allowed syntax to just write a single statement can lead to very confusing
situations, especially where subsequently a developer might add another statement
while forgetting to add the braces (meaning that this wouldn't be included in the condition).
Summary by Sourcery
Refactor the music command and Distube event listeners to simplify code and improve error handling. Enhance the Distube client with additional plugins for SoundCloud, Spotify, and YouTube, and update configuration settings for improved functionality.
Enhancements: