Skip to content

Commit

Permalink
updated ban command
Browse files Browse the repository at this point in the history
  • Loading branch information
LUISDASARTIMANHAS committed Apr 29, 2024
1 parent e626715 commit cbc81d4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
5 changes: 4 additions & 1 deletion src/bot.js
Expand Up @@ -14,6 +14,7 @@ import { helpCommand, handleHelp } from "./comandos/help.js";
import { sendLogs, sendLogsEmbed } from "./comandos/sendLogs.js";
import { showServersCommand, handleShowServers } from "./comandos/showServers.js";
import { sayEmbedCommand, handleSayEmbed } from "./comandos/send-embed.js";
import { banCommand, handleBan } from "./comandos/ban.js";
const rawData = fs.readFileSync("./data/config.json");
const configs = JSON.parse(rawData);
const date = new Date();
Expand Down Expand Up @@ -107,14 +108,16 @@ bot.on("interactionCreate", (interaction) => {
handleHelp(interaction);
handleShowServers(interaction,bot.guilds.cache);
handleSayEmbed(interaction);
handleBan(interaction);
});

async function main() {
const commands = [
pingCommand,
helpCommand,
showServersCommand,
sayEmbedCommand
sayEmbedCommand,
banCommand
];
try {
console.log("Recarregando comandos de barra /");
Expand Down
44 changes: 30 additions & 14 deletions src/comandos/ban.js
@@ -1,17 +1,33 @@
const Discord = require("discord.js");
const embed = new Discord.MessageEmbed();
const {comandos, prefix} = require("../../data/config.json");
import { SlashCommandBuilder } from "@discordjs/builders";

module.exports.run = async (bot, message, args) => {
const novaLinha = "\n";
let banCommand = new SlashCommandBuilder()
.setName('ban')
.setDescription('Usado para moderação do servidor')

let info = "ℹ️" + novaLinha;

embed.setTitle(`**__BAN__**`);
embed.setColor("#00FF00");
embed.setDescription(info);
embed.setTimestamp();
banCommand = banCommand.toJSON();

message.delete().catch((O_o) => {});
message.channel.send(embed);
};
// help.js
function handleBan(interaction) {
if (interaction.commandName === 'ban') {
const date = new Date();

let info = `
Usuario X banido.
Moderador: x
Motivo: x
`
const embed = {
title: "**__BAN__**",
description: info,
color: parseInt("FF0000", 16),
timestamp: date
};

interaction.reply({ embeds: [embed] });
}
}

export {
banCommand,
handleBan
}

0 comments on commit cbc81d4

Please sign in to comment.