ECS Test Fluxer Bot 1.0.1

This commit is contained in:
2026-02-24 10:55:24 -05:00
commit 05dedd0271
6 changed files with 232 additions and 0 deletions

29
.gitignore vendored Normal file
View File

@@ -0,0 +1,29 @@
# Environment variables (CRITICAL - Keeps your token safe)
.env
.env.test
.env.production
.env.local
# Dependency directories
node_modules/
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# OS generated files (Windows/Mac clutter)
Thumbs.db
ehthumbs.db
.DS_Store
# Editor directories and files
.vscode/
.idea/
*.suo
*.ntvs*
*.njsproj
*.sln
*.swp

18
README.md Normal file
View File

@@ -0,0 +1,18 @@
# Eh Bro Hub Welcome Bot
A lightweight Node.js bot built with `@fluxerjs/core` to manage new members joining the Eh Bro Hub server.
## Features
* **Auto-Role Assignment:** Instantly grants a specified role to new users as soon as they join the server.
* **Custom Welcome Messages:** Pings and greets new members with a tailored message in a designated welcome channel.
## Prerequisites
* [Node.js](https://nodejs.org/) installed on your machine or server.
* A registered bot application and token from the Fluxer Developer Portal.
## Installation
1. **Clone the repository** to your local machine or server.
2. **Navigate to the project directory:**
```bash
cd your-project-folder

3
example.env Normal file
View File

@@ -0,0 +1,3 @@
BOT_TOKEN=example_bot_token_here
WELCOME_CHANNEL_ID=example_welcome_channel_id_here
AUTO_ROLE_ID=example_auto_role_id_here

48
index.js Normal file
View File

@@ -0,0 +1,48 @@
require("dotenv").config();
const { Client, Events } = require("@fluxerjs/core");
const client = new Client();
// Your specific IDs for your server, make sure to set these in your .env file
const AUTO_ROLE_ID = process.env.AUTO_ROLE_ID;
const WELCOME_CHANNEL_ID = process.env.WELCOME_CHANNEL_ID;
const BOT_TOKEN = process.env.BOT_TOKEN;
// Safety check before attempting to log in
if (!BOT_TOKEN) {
console.error(
"CRITICAL ERROR: BOT_TOKEN is missing or undefined. Check your .env file!",
);
process.exit(1);
}
client.on(Events.Ready, () => {
/* This will log the bot's username and discriminator to the console when it successfully logs in
* For some reason, client.user.tag doesn't work, so we have to concatenate the username and discriminator manually.
*/
console.log(`Online! Logged in as ${client.user.username}#${client.user.discriminator}`);
});
client.on(Events.GuildMemberAdd, async (member) => {
try {
await member.roles.add(AUTO_ROLE_ID);
console.log(`Assigned role to ${member.user.username}`);
const welcomeChannel =
await member.guild.channels.fetch(WELCOME_CHANNEL_ID);
if (welcomeChannel) {
// This is my example for my server welcome message, feel free to change it up to fit your server's vibe!
await welcomeChannel.send(
`Eh Bro! Welcome to the Hub, <@${member.user.id}>! Grab a seat and say hello. You also have the Role ${member.guild.roles.cache.get(AUTO_ROLE_ID).name} now, so you can check out the channels and get involved!`,
);
}
} catch (error) {
console.error(
`Failed to handle join event for ${member.user.username}:`,
error,
);
}
});
// Log in
client.login(BOT_TOKEN);

117
package-lock.json generated Normal file
View File

@@ -0,0 +1,117 @@
{
"name": "ecstest1",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ecstest1",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"@fluxerjs/core": "^1.2.2",
"dotenv": "^17.3.1"
}
},
"node_modules/@fluxerjs/builders": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@fluxerjs/builders/-/builders-1.2.2.tgz",
"integrity": "sha512-647yuM44Fs+Cf/MKo01XRWoVb7RoFdSOBHebFiTLLCTO/tqz+dgZ4wgVsDNu9O/BB/oZ2tjAp9jDTxvXMXkUbA==",
"license": "Apache-2.0",
"dependencies": {
"@fluxerjs/types": "1.2.2",
"@fluxerjs/util": "1.2.2"
}
},
"node_modules/@fluxerjs/collection": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@fluxerjs/collection/-/collection-1.2.2.tgz",
"integrity": "sha512-ryytiFh38gELqOLHBtL6Tz4f7/7DIu9L2CMTOqNYoer7E1ef8ukU7YiyANASWHgTf34hcGMC0tdi0dcFFFKkKQ==",
"license": "Apache-2.0"
},
"node_modules/@fluxerjs/core": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@fluxerjs/core/-/core-1.2.2.tgz",
"integrity": "sha512-P+c1jveYqwWGT6vafw+U1WmDPJ0Brp+aNa52Qp2vSsEQ3FLNUg+/25PhyrcPP0x2Mf7zoa1Wv9zGLlkHlKb9Ag==",
"license": "Apache-2.0",
"dependencies": {
"@fluxerjs/builders": "1.2.2",
"@fluxerjs/collection": "1.2.2",
"@fluxerjs/rest": "1.2.2",
"@fluxerjs/types": "1.2.2",
"@fluxerjs/util": "1.2.2",
"@fluxerjs/ws": "1.2.2"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@fluxerjs/rest": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@fluxerjs/rest/-/rest-1.2.2.tgz",
"integrity": "sha512-Y96A2wQJ8akiAPpiyQm2WWBfNvrQBGIxIuwFCTuXkWg/g+0D6hYrVB7VHxQlnBeDUlj4T+fSJiqSoAYQ3pwrCQ==",
"license": "Apache-2.0",
"dependencies": {
"@fluxerjs/types": "1.2.2"
}
},
"node_modules/@fluxerjs/types": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@fluxerjs/types/-/types-1.2.2.tgz",
"integrity": "sha512-z3AcTxVF2iY/D0XR8xGIcx+c6LY6eNLWR0uO46xNGmEqpm5guE3joDz/EN8DfAZXuap/ludgqX6EA8dLADIeMg==",
"license": "Apache-2.0"
},
"node_modules/@fluxerjs/util": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@fluxerjs/util/-/util-1.2.2.tgz",
"integrity": "sha512-H0c6rKufJJQsz7cloZSK1EqqbRCaxEIF2LdJ4cIRiGPczQTleD2xAIOQ2NvBZxnFvwx+OeetZs79b42bsjcjHQ==",
"license": "Apache-2.0",
"dependencies": {
"@fluxerjs/types": "1.2.2"
}
},
"node_modules/@fluxerjs/ws": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@fluxerjs/ws/-/ws-1.2.2.tgz",
"integrity": "sha512-twg1wYRYo4DlEHsVHSuUhSAKGK2qTmHM2PV3LNSdE0HdGQIB1EFviSuo0rWDpCb1sVTwIzBVMtthrlxyPfVtKA==",
"license": "Apache-2.0",
"dependencies": {
"@fluxerjs/types": "1.2.2",
"ws": "^8.18.0"
}
},
"node_modules/dotenv": {
"version": "17.3.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.3.1.tgz",
"integrity": "sha512-IO8C/dzEb6O3F9/twg6ZLXz164a2fhTnEWb95H23Dm4OuN+92NmEAlTrupP9VW6Jm3sO26tQlqyvyi4CsnY9GA==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/ws": {
"version": "8.19.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz",
"integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==",
"license": "MIT",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
}
}
}

17
package.json Normal file
View File

@@ -0,0 +1,17 @@
{
"name": "ecstest1",
"version": "1.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "DevEhChad",
"license": "MIT",
"type": "commonjs",
"dependencies": {
"@fluxerjs/core": "^1.2.2",
"dotenv": "^17.3.1"
}
}