First implementation

This commit is contained in:
2026-08-22 15:24:48 -04:00
parent 80b8ddbd3f
commit f714fad2d4
16 changed files with 461 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
import { Client, Events, GatewayIntentBits } from 'discord.js';
import { CommandService } from './services/cmd/service';
import RoleService from './services/role/service';
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });
// Services
const commandService = new CommandService(client);
const roleService = new RoleService(client);
client.once(Events.ClientReady, async (readyClient) => {
// Initialize & validate
await commandService.init();
roleService.validate();
// Ready!
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});
client.on("guildMemberAdd", async (guildMember) => {
await roleService.addStarterRoles(guildMember);
});
client.on("messageCreate", async (message) => {
if (message.author.bot) return;
const command = commandService.parse(message);
if (command) command.execute(message);
});
Bun.cron("0 */6 * * *", async () => {
for (const guild of client.guilds.cache.values()) {
const lurkerRole = roleService.getRoleByName(guild, roleService.ROLES["LURKER"]);
if (!lurkerRole) continue;
await guild.members.prune({ days: 5, roles: [lurkerRole] });
}
});
client.login(Bun.env.DISCORD_TOKEN);