Advertisement
spiralvibes

Made By ZayDocs | Maverick Team

Nov 1st, 2024
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { Client, GatewayIntentBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, TextInputBuilder, TextInputStyle, InteractionType } = require('discord.js');
  2. const axios = require('axios');
  3. require('dotenv').config();
  4.  
  5. const client = new Client({
  6.   intents: [
  7.     GatewayIntentBits.Guilds,
  8.     GatewayIntentBits.GuildMessages,
  9.     GatewayIntentBits.MessageContent
  10.   ]
  11. });
  12.  
  13. const LOG_CHANNEL_ID = "YOUR_LOG_CHANNEL_ID";
  14.  
  15. async function checkProfanity(text) {
  16.   try {
  17.     const response = await axios.get(`https://www.purgomalum.com/service/containsprofanity?text=${encodeURIComponent(text)}`);
  18.     return response.data === "true";
  19.   } catch (error) {
  20.     console.error('Error checking profanity:', error);
  21.     return false;
  22.   }
  23. }
  24.  
  25. client.once('ready', () => {
  26.   console.log(`Bot is online and ready!`);
  27. });
  28.  
  29. client.on('messageCreate', async (message) => {
  30.   if (message.author.bot) return;
  31.  
  32.   const isProfane = await checkProfanity(message.content);
  33.   if (isProfane) {
  34.     await message.delete();
  35.  
  36.     await message.channel.send({
  37.       embeds: [
  38.         new EmbedBuilder()
  39.           .setColor("#FE424D")
  40.           .setTitle("🚨 Profane Language Detected")
  41.           .setAuthor({ name: "AutoMod", iconURL: "https://media.discordapp.net/attachments/1284126131800244367/1299779497029271675/offline.png" })
  42.           .setDescription("Your message contains prohibited language and has been removed.")
  43.       ],
  44.       components: [
  45.         new ActionRowBuilder().addComponents(
  46.           new ButtonBuilder()
  47.             .setCustomId('appeal')
  48.             .setLabel("Appeal")
  49.             .setStyle(ButtonStyle.Danger)
  50.         )
  51.       ],
  52.       ephemeral: true
  53.     });
  54.  
  55.     console.log(`Profane message deleted.`);
  56.   }
  57. });
  58.  
  59. client.on('interactionCreate', async interaction => {
  60.   if (interaction.isButton() && interaction.customId === 'appeal') {
  61.     const appealModal = new ModalBuilder()
  62.       .setCustomId('appeal_modal')
  63.       .setTitle('Appeal Your Message');
  64.  
  65.     const appealInput = new TextInputBuilder()
  66.       .setCustomId('appeal_reason')
  67.       .setLabel("Reason for Appeal")
  68.       .setStyle(TextInputStyle.Paragraph)
  69.       .setPlaceholder("Explain why your message should not have been flagged.")
  70.       .setRequired(true);
  71.  
  72.     appealModal.addComponents(new ActionRowBuilder().addComponents(appealInput));
  73.     await interaction.showModal(appealModal);
  74.   }
  75.  
  76.   if (interaction.type === InteractionType.ModalSubmit && interaction.customId === 'appeal_modal') {
  77.     const appealReason = interaction.fields.getTextInputValue('appeal_reason');
  78.     const logChannel = await client.channels.fetch(LOG_CHANNEL_ID);
  79.  
  80.     if (logChannel) {
  81.       await logChannel.send({
  82.         embeds: [
  83.           new EmbedBuilder()
  84.             .setColor("#FFD700")
  85.             .setTitle("📝 New Appeal Submitted")
  86.             .setAuthor({ name: interaction.user.tag, iconURL: interaction.user.displayAvatarURL() })
  87.             .addFields(
  88.               { name: "User ID", value: interaction.user.id, inline: true },
  89.               { name: "Appeal Reason", value: appealReason }
  90.             )
  91.             .setTimestamp()
  92.         ]
  93.       });
  94.     }
  95.  
  96.     await interaction.reply({
  97.       content: "Thank you for submitting your appeal. Our team will review it shortly.",
  98.       ephemeral: true
  99.     });
  100.   }
  101. });
  102.  
  103. client.login(process.env.DISCORD_TOKEN);
  104.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement