ensure the /verify and /code only work in the specified channel, and add admin log channel to the .env.example

This commit is contained in:
Ayden Jahola 2024-09-02 23:05:25 +01:00
parent d11ccfab4e
commit a44310b00f
No known key found for this signature in database
GPG key ID: 71DD90AE4AE92742
4 changed files with 21 additions and 1 deletions

View file

@ -7,12 +7,13 @@ EMAIL_USER=example@example.com
EMAIL_PASS=YOUR_EMAIL_PASS EMAIL_PASS=YOUR_EMAIL_PASS
# Allowed domains for email verification # Allowed domains for email verification
EMAIL_DOMAINS=example@example.com // or it can be a list, example: "example.com,example2.com" EMAIL_DOMAINS=example@example.com // or it can be a list, example: example.com,example2.com
# Discord # Discord
GUILD_ID=YOUR_GUILD_ID GUILD_ID=YOUR_GUILD_ID
VERIFICATION_CHANNEL_NAME=YOUR_VERIFICATION_CHANNEL_NAME VERIFICATION_CHANNEL_NAME=YOUR_VERIFICATION_CHANNEL_NAME
VERIFIED_ROLE_NAME=YOUR_VERIFIED_ROLE_NAME VERIFIED_ROLE_NAME=YOUR_VERIFIED_ROLE_NAME
ADMIN_LOG_CHANNEL_ID=YOUR_ADMIN_LOG_CHANNEL_ID
# Database # Database
MONGODB_URI=YOUR_MONGODB_URI MONGODB_URI=YOUR_MONGODB_URI

View file

@ -54,6 +54,7 @@ EMAIL_DOMAINS=example@example.com // or it can be a list, example: "example.com,
GUILD_ID=YOUR_GUILD_ID GUILD_ID=YOUR_GUILD_ID
VERIFICATION_CHANNEL_NAME=YOUR_VERIFICATION_CHANNEL_NAME VERIFICATION_CHANNEL_NAME=YOUR_VERIFICATION_CHANNEL_NAME
VERIFIED_ROLE_NAME=YOUR_VERIFIED_ROLE_NAME VERIFIED_ROLE_NAME=YOUR_VERIFIED_ROLE_NAME
ADMIN_LOG_CHANNEL_ID=YOUR_ADMIN_LOG_CHANNEL_ID
# Database # Database
MONGODB_URI=YOUR_MONGODB_URI MONGODB_URI=YOUR_MONGODB_URI

View file

@ -13,6 +13,15 @@ module.exports = {
), ),
async execute(interaction, client) { async execute(interaction, client) {
// Ensure command is only used in the specified verification channel
const verificationChannelName = process.env.VERIFICATION_CHANNEL_NAME;
if (interaction.channel.name !== verificationChannelName) {
return interaction.reply({
content: `This command can only be used in the #${verificationChannelName} channel.`,
ephemeral: true,
});
}
const code = interaction.options.getString("code"); const code = interaction.options.getString("code");
if (!code) { if (!code) {

View file

@ -22,6 +22,15 @@ module.exports = {
), ),
async execute(interaction, client) { async execute(interaction, client) {
// Ensure command is only used in the specified verification channel
const verificationChannelName = process.env.VERIFICATION_CHANNEL_NAME;
if (interaction.channel.name !== verificationChannelName) {
return interaction.reply({
content: `This command can only be used in the #${verificationChannelName} channel.`,
ephemeral: true,
});
}
const email = interaction.options.getString("email"); const email = interaction.options.getString("email");
const emailDomain = email.split("@")[1]; const emailDomain = email.split("@")[1];
const EMAIL_DOMAINS = process.env.EMAIL_DOMAINS.split(","); const EMAIL_DOMAINS = process.env.EMAIL_DOMAINS.split(",");