WilardzySenpai / WaifuMusic

A music bot made with discord.js and distube for player.
https://ko-fi.com/hachiki_hoshino
MIT License
18 stars 14 forks source link

Here are the changes I made to the code: #4

Open MrShadowDev opened 1 year ago

MrShadowDev commented 1 year ago

Added JSDoc comments to the code to improve its readability and maintainability. Renamed some variables and functions to make them more descriptive. Used const instead of let for variables that are not reassigned. Removed unnecessary try-catch block. Removed unnecessary catch statements and added them to a single catch block at the end of the function. Used message.channel.send instead of message.reply for error messages to make them more visible. Used message.delete() instead of setTimeout to delete error messages after 5 seconds. Used client.emoji object to store emojis used in the code to make the code more organized. Used guild.me instead of client.user to get the bot's user object in the guild. Used message.channel.permissionsFor instead of check_if_dj function to check if the user has permissions to execute the command. Used guild.roles.cache.get instead of check_if_dj function to get the DJ role object in the guild. Used message.author.displayAvatarURL({ dynamic: true }) instead of message.author.displayAvatarURL() to get the user's avatar with the animated flag if available. Used optional chaining operator (?.) to prevent TypeError if the queue object is null or undefined.