Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //interactionCreate.js
- module.exports = (Discord, libitina) => {
- libitina.on('interactionCreate', interaction => {
- if (!interaction.isButton()) return;
- const approval = require('../../approval');
- const approved = require('../../approved');
- const denied = require('../../denied');
- const modsChat = interaction.member.guild.channels.cache.get('957493730598879372');
- const role = interaction.member.guild.roles.cache.find(role => role.name === "✅Verified 18+");
- console.log(interaction);
- if (interaction.channelId === '957493729101488152') return approval(interaction, modsChat, role);
- if (interaction.channelId === modsChat.id){
- const newUserId = interaction.message.mentions.users.first().id
- if(interaction.customId === "approved") return approved(interaction, modsChat, role, newUserId);
- if(interaction.customId === "deny") return denied(interaction, modsChat, role, newUserId);
- }
- });
- }
- //approval.js
- module.exports = async (interaction, modsChat, role) => {
- const { MessageActionRow, MessageButton } = require('discord.js');
- if(interaction.customId === "yes"){
- const row = new MessageActionRow()
- .addComponents(
- new MessageButton()
- .setCustomId('approved')
- .setLabel('Approve')
- .setStyle('SUCCESS'),
- new MessageButton()
- .setCustomId('deny')
- .setLabel('Deny')
- .setStyle('DANGER')
- );
- modsChat.send({content: `<@${interaction.user.id}> wants the ${role} role!`, components: [row] });
- await interaction.reply({ content: 'Your application has been sent to the server moderators. Please allow them 24 hours to review your application.', ephemeral: true,});
- }
- else if(interaction.customId === "no") {
- modsChat.send(`<@${interaction.user.id}> selected "No!", they are not over the age of 18.`) ;
- await interaction.reply({ content: 'Sorry, we require all members of the servr to be over the age of 18.', ephemeral: true,});
- }
- }
- //approved.js
- module.exports = async (interaction, modsChat, role, newUserId) => {
- interaction.member.roles.add(role);
- modsChat.send(`<@${interaction.user.id}> granted <@${newUserId}> the ${role} role.`)
- }
- //denied.js
- module.exports = async (interaction, modsChat, role, newUserId) => {
- interaction.member.roles.remove(role)
- modsChat.send(`<@${interaction.user.id}> denied <@${newUserId}> the ${role} role.`)
- }
- //index.js
- ['command_handler', 'event_handler'].forEach(handler =>{
- require(`./handlers/${handler}`)(libitina, Discord);
- });
Advertisement
Add Comment
Please, Sign In to add comment