Skip to content

Commit

Permalink
Message Listener + Verify Message
Browse files Browse the repository at this point in the history
  • Loading branch information
TisMeCastle committed Mar 27, 2024
1 parent 05d651c commit bccf0f7
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
19 changes: 19 additions & 0 deletions commands/Server/sendVerify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { MessageActionRow, MessageButton } = require("discord.js");

module.exports = {
data: new SlashCommandBuilder()
.setName("verifysend")
.setDescription("Verifies the user"),
async execute(interaction) {
const buttonData = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('verifybutt')
.setLabel('Click to Verify')
.setStyle('SUCCESS'),
);
interaction.channel.send({ content: `<@&1059563959037984929> Please __click__ the button __below__ to gain access to the server. Run \`/ticket\` for support!`, components: [buttonData] })
}
}

33 changes: 33 additions & 0 deletions events/messageCreate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const ROLE_ID = '1219871155952025671';
const TIMEOUT_DURATION = 7500

module.exports = {
name: "messageCreate",
async execute(interaction) {

if (!interaction.author.bot) {
if (interaction.mentions.users.size > 0) {
for (const user of interaction.mentions.users.values()) {
const member = interaction.guild.members.cache.get(user.id);
if (member && member.roles.cache.has(ROLE_ID)) {

const deleteReply = await interaction.reply({
content: `Please refrain from mentioning any users with the \`Upper Class\` role! Our goal is to create a healthy environment; we must remain respectful to their time and notifications!`,
ephemeral: true
});

interaction.guild.channels.cache.find(channel => channel.id === '1219872238699020388').send(`⚠️Upper Class Pinged⚠️\n###Who:<@${interaction.user.id}>\n###User Pinged:${user.username}\n###Where: ${interaction.channel.name}\n###Contents: ${interaction.content}`)

setTimeout(async () => {
try {
await deleteReply.delete();
} catch (error) {
console.error('Failed to delete reply:', error);
}
}, TIMEOUT_DURATION);
}
}
}
}
}
}

0 comments on commit bccf0f7

Please sign in to comment.