ミラー元
https://github.com/aydenjahola/discord-multipurpose-bot.git
同期済み 2025-07-09 06:17:08 +01:00
adjust the email domain to take multiple arguments/domains and add .env.example
このコミットが含まれているのは:
コミット
5e219a154c
3個のファイルの変更、44行の追加、13行の削除
18
.env.example
ノーマルファイル
18
.env.example
ノーマルファイル
|
@ -0,0 +1,18 @@
|
||||||
|
# Bot token
|
||||||
|
BOT_TOKEN=YOUR_BOT_TOKEN
|
||||||
|
|
||||||
|
# Nodemailer
|
||||||
|
EMAIL_NAME="Example"
|
||||||
|
EMAIL_USER=example@example.com
|
||||||
|
EMAIL_PASS=YOUR_EMAIL_PASS
|
||||||
|
|
||||||
|
# Allowed domains for email verification
|
||||||
|
EMAIL_DOMAINS=example@example.com // or it can be a list, example: "example.com,example2.com"
|
||||||
|
|
||||||
|
# Discord
|
||||||
|
GUILD_ID=YOUR_GUILD_ID
|
||||||
|
VERIFICATION_CHANNEL_NAME=YOUR_VERIFICATION_CHANNEL_NAME
|
||||||
|
VERIFIED_ROLE_NAME=YOUR_VERIFIED_ROLE_NAME
|
||||||
|
|
||||||
|
# Database
|
||||||
|
MONGODB_URI=YOUR_MONGODB_URI
|
31
README.md
31
README.md
|
@ -1,6 +1,6 @@
|
||||||
# Esports Verification Bot
|
# Discord Verification Bot
|
||||||
|
|
||||||
Welcome to the **Esports Verification Bot**! This bot is designed to handle user verification for Discord servers, specifically for esports communities. It verifies users through their student email addresses and manages roles based on their verification status.
|
Welcome to the **Discord Verification Bot**! This bot is designed to handle user verification for Discord servers. It verifies users through their student email addresses and manages roles based on their verification status.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
@ -39,15 +39,28 @@ npm install
|
||||||
Create a `.env` file in the root directory and add the following:
|
Create a `.env` file in the root directory and add the following:
|
||||||
|
|
||||||
```env
|
```env
|
||||||
BOT_TOKEN=your_discord_bot_token
|
# Bot token
|
||||||
MONGODB_URI=your_mongodb_connection_string
|
BOT_TOKEN=YOUR_BOT_TOKEN
|
||||||
EMAIL_USER=your_email@gmail.com
|
|
||||||
EMAIL_PASS=your_email_password
|
# Nodemailer
|
||||||
VERIFIED_ROLE_NAME=YourVerifiedRoleName
|
EMAIL_NAME="Example"
|
||||||
EMAIL_DOMAIN=mail.dcu.ie
|
EMAIL_USER=example@example.com
|
||||||
GUILD_ID=your_discord_guild_id
|
EMAIL_PASS=YOUR_EMAIL_PASS
|
||||||
|
|
||||||
|
# Allowed domains for email verification
|
||||||
|
EMAIL_DOMAINS=example@example.com // or it can be a list, example: "example.com,example2.com"
|
||||||
|
|
||||||
|
# Discord
|
||||||
|
GUILD_ID=YOUR_GUILD_ID
|
||||||
|
VERIFICATION_CHANNEL_NAME=YOUR_VERIFICATION_CHANNEL_NAME
|
||||||
|
VERIFIED_ROLE_NAME=YOUR_VERIFIED_ROLE_NAME
|
||||||
|
|
||||||
|
# Database
|
||||||
|
MONGODB_URI=YOUR_MONGODB_URI
|
||||||
```
|
```
|
||||||
|
|
||||||
|
this can also be seen in in the [.env.example](./.env.example)
|
||||||
|
|
||||||
4. **Run the Bot**
|
4. **Run the Bot**
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
8
bot.js
8
bot.js
|
@ -13,7 +13,7 @@ const client = new Client({
|
||||||
});
|
});
|
||||||
|
|
||||||
const VERIFIED_ROLE_NAME = process.env.VERIFIED_ROLE_NAME; // Role name to assign after verification
|
const VERIFIED_ROLE_NAME = process.env.VERIFIED_ROLE_NAME; // Role name to assign after verification
|
||||||
const EMAIL_DOMAIN = process.env.EMAIL_DOMAIN; // Domain to verify against
|
const EMAIL_DOMAINS = process.env.EMAIL_DOMAINS.split(","); // Domains to verify against, converted to an array
|
||||||
const GUILD_ID = process.env.GUILD_ID; // Guild ID to restrict the bot
|
const GUILD_ID = process.env.GUILD_ID; // Guild ID to restrict the bot
|
||||||
const VERIFICATION_CHANNEL_NAME = process.env.VERIFICATION_CHANNEL_NAME; // Channel name to restrict the bot
|
const VERIFICATION_CHANNEL_NAME = process.env.VERIFICATION_CHANNEL_NAME; // Channel name to restrict the bot
|
||||||
|
|
||||||
|
@ -56,14 +56,14 @@ client.on("messageCreate", async (message) => {
|
||||||
|
|
||||||
if (!email) {
|
if (!email) {
|
||||||
return verificationChannel.send(
|
return verificationChannel.send(
|
||||||
"Please provide your email address. Usage: `!verify your_email@mail.dcu.ie`"
|
"Please provide your email address. Usage: `!verify your_email@example.com`"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const emailDomain = email.split("@")[1];
|
const emailDomain = email.split("@")[1];
|
||||||
if (emailDomain !== EMAIL_DOMAIN) {
|
if (!EMAIL_DOMAINS.includes(emailDomain)) {
|
||||||
return verificationChannel.send(
|
return verificationChannel.send(
|
||||||
"You must use a valid DCU student email address."
|
"You must use a valid DCU email address."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
読み込み中…
新しいイシューから参照