josephistired / DiscordBot-v14

An open-source Discord bot that offers ultimate control and flexibility for your server. With this bot, you have the ability to host and run it yourself, ensuring that you have the latest updates and features. The bot comes equipped with a variety of commands, including moderation commands for enforcing rules and keeping your server organized, etc.
https://www.josephcarmosino.com/DiscordBot-v14
MIT License
47 stars 10 forks source link

improved code of ban.js and kick.js #153

Closed Saunakghosh10 closed 1 year ago

Saunakghosh10 commented 1 year ago

Improvements and fixes made in the code:

Renamed PermissionFlagsBits to Permissions for compatibility. Removed .setDMPermission(false) as it's unnecessary. Fixed the condition for checking role positions. Replaced EmbedBuilder with MessageEmbed for creating embeds. Fixed the use of interaction.reply() and added proper indentation.

Improvements made to the code:

Replaced PermissionFlagsBits.KickMembers with Permissions for compatibility. Removed .setDMPermission(false) as it's unnecessary. Changed .addStringOption() for "messages" to .addIntegerOption() since it expects an integer. Fixed the condition for checking role positions. Replaced EmbedBuilder with MessageEmbed for creating embeds. Simplified the property access for member.user.username and interaction.commandName. Removed unnecessary type conversion with parseInt(). Adjusted indentation and formatting for better readability.

josephistired commented 1 year ago

@Saunakghosh10 After carefully reviewing the updated code, I've noticed some opportunities for improvement. However, I wanted to inquire if you had conducted any testing on this code prior to creating the pull request?

  1. MessageEmbed is no longer a constructor and has been replaced with EmbedBuilder, so no idea why that was changed.
  2. .setDMPermission(false) is not unnecessary as it stops the command from being used in dms, in which why would /ban and /kick be used in dms? It causes errors in the console.
  3. /kick file throws an error now, and it doesn't work.
  4. Also, removing the default member permissions isn't necessary as it stops users who can't ban or kick a user to be able to see the command.
Saunakghosh10 commented 1 year ago

okay