
Cler
Cler Discord multipurpose bot
Cler is a Discord bot to manage your server, it has multiple commands such as administration, utility and fun.

Latest Version and What's New
v4.7.20
(Asynchronous Transfer Mode)
- Use the prefix.
c!
or the Slash/
for moderation commands - Bot in Discord.js v14.16.2
P.S.: If I abandoned this project it's because I got bored or made a better version.

💻 Installation
To install and run Cler locally, follow these steps:
-
Clone the repository:
#BASH1git clone git@github.com:aiskoa/Cler.git 2
-
Navigate to the project directory:
#BASH1cd Cler 2
-
Create a .env configuration file inside the directory:
#BASH1BOT_TOKEN=YOUR_BOT_TOKEN 2CLIENT_ID=YOUR_CLIENT_ID 3GUILD_ID=YOUR_GUILD_ID 4PREFIX='YOUR_PREFIX' 5COLOR='0x5e10f8' 6OWNER=YOUR_DISCORD_ID 7
-
Install the dependencies:
#BASH1npm install 2
-
Run the global load command:
#BASH1npm deploy-commands.js 2
-
Run the start command:
#BASH1npm start 2
Go to your discord server where you invited your bot and run the /help command.
Commands
Full list of commands in Documentation
Structure and Diagramming in Github Repository
Admin / Mod
/mute <@member> <reason>
Mutes the tagged member./unmute <@member> <reason>
Unmutes the tagged member./set_mute <@rol>
Defines the Mute role on the server Important./ban <@member> <reason>
Permanently bans the tagged member from the server./unban <@member>
Revokes the ban from the previous command./kick <@member> <reason>
Kicks the tagged member from the server./softban <@member> <reason>
Temporarily kicks the tagged member from the server for 7 days./warn <@member> <reason>
Warns the selected member
Full list of commands in Documentation
Contextual commands
View Avatar
Sends a user's avatar Gif / Image.
Full list of commands in Documentation
COMMAND WARN SLASH AND PREFIX
#JAVASCRIPT1const { SlashCommandBuilder, EmbedBuilder, PermissionFlagsBits } = require('discord.js'); 2const db = require('megadb'); 3const warnDB = new db.crearDB('warnings'); // Use crearDB to initialize the database 4 5module.exports = { 6 data: new SlashCommandBuilder() 7 .setName('warn') 8 .setDescription('Warns a server member.') 9 .addUserOption(option => 10 option.setName('user') 11 .setDescription('The user you want to warn') 12 .setRequired(true)) 13 .addStringOption(option => 14 option.setName('reason') 15 .setDescription('Reason for the warning') 16 .setRequired(false)) 17 .setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers), // Warning permissions 18 19 name: 'warn', // Name for commands with prefix 20 description: 'Warns a server member.', 21 22 async executeSlash(interaction) { 23 const member = interaction.options.getMember('user'); 24 const reason = interaction.options.getString('reason') || 'No reason provided.'; 25 await this.warnMember(interaction, member, reason); 26 }, 27 28 async executePrefix(message, args) { 29 const member = message.mentions.members.first(); 30 const reason = args.slice(1).join(' ') || 'No reason provided.'; 31 if (!member) { 32 //<a:denyxbox:1287542408082358292> are global emojis, uploaded from discord dev portal 33 return message.reply('<a:denyxbox:1287542408082358292> | Please mention a valid user.'); 34 } 35 await this.warnMember(message, member, reason); 36 }, 37 38 async warnMember(context, member, reason) { 39 const isInteraction = !!context.isCommand; 40 41 // Check if it has warning permissions (only in prefixes) 42 if (!isInteraction && !context.member.permissions.has('MODERATE_MEMBERS')) { 43 return context.reply({ content: '<:win11erroicon:1287543137505378324> | You do not have permission to warn members.', ephemeral: true }); 44 } 45 46 if (!member) { 47 return context.reply({ content: '<:440warning:1287542257985126501> | Please select a valid member.', ephemeral: true }); 48 } 49 50 try { 51 // Try to send a direct message to the user 52 try { 53 await member.send(`<a:1302moderatorprogramsalumnia:1287542225399709737> You have received a warning on the server ${context.guild.name} by ${context.user.tag}. Reason: ${reason}`); 54 } catch (error) { 55 console.log(`[LOG] Could not send a direct message to ${member.user.tag}.`); 56 } 57 58 // Register warning in MegaDB 59 if (!await warnDB.has(`warnings.${member.id}`)) { 60 await warnDB.set(`warnings.${member.id}`, []); 61 } 62 await warnDB.push(`warnings.${member.id}`, { 63 reason: reason, 64 moderator: context.user.tag, 65 timestamp: new Date().toISOString() 66 }); 67 68 // Create embed to notify the channel 69 const warnEmbed = new EmbedBuilder() 70 .setColor(0xffff00) // Yellow 71 .setTitle('<a:1302moderatorprogramsalumnia:1287542225399709737> **WARNING**') 72 .setDescription(`${member.user.tag} has received a warning.`) 73 .addFields( 74 { name: '<a:9755discordstaffanimated:1287542237571321896> Moderator', value: `${context.user.tag}`, inline: true }, 75 { name: '<:discordcopyid:1287542182080679997> Member', value: `${member.user.tag}`, inline: true }, 76 { name: '<:discordeditprofile:1287542190926467094> Reason', value: reason, inline: false } 77 ) 78 .setThumbnail(member.user.displayAvatarURL()) 79 .setTimestamp() 80 .setFooter({ text: 'Warning registered', iconURL: context.user.displayAvatarURL() }); 81 82 // Send the embed as a response 83 await context.reply({ embeds: [warnEmbed] }); 84 85 // Log in console 86 console.log(`[LOG] ${context.user.tag} has warned ${member.user.tag} in ${context.guild.name}`); 87 } catch (error) { 88 console.error(error); 89 context.reply({ content: 'There was an error warning this member.', ephemeral: true }); 90 } 91 }, 92}; 93
The most complex part or module is index.js, but since it is very long I am not going to put it, I recommend checking the project's github.
But in summary I revived the project, if I abandon it again it is because I got bored hahaha, so now it has more commands and has a save function, oh, I hosted it on an intel celeron with little ram, likewise in another blog I will give the characteristics of the NAS and the PC.
🤝 Contributing
Contributions, issues and feature requests are welcome! Feel free to check issues page.
-
Fork the Repository: Create a copy of the repository in your GitHub account.
-
Create a Branch:
#BASH1git checkout -b your-branch-name 2
-
Make your Changes: Make the modifications you want to add.
-
Commit and Push:
#BASH1git add . 2git commit -m "Description of the changes" 3git push origin your-branch-name 4
-
Create a Pull Request: Open a Pull Request from your branch to the main branch of the repository.
❤️ Show your support
Give a ⭐️ if this project helped you!