The purpose of this project is to create a client for Discord bots, similar to a regular client, specifically for bot moderation.
Project Benefits
This project facilitates the moderation of Discord servers by providing a dedicated client for bot management and moderation tasks.
How the Project Works
The project uses Node.js to create a client that interacts with Discord’s API, allowing bot moderation functionalities similar to those available to regular users.
Repository and Installation
To install and use the project:
-
Clone the repository:
Terminal window git clone https://github.com/Fulldroper/api.discord-botcd api.discord-bot -
Install dependencies and start the client:
Terminal window npm installnpm start
Project Workflow
-
Setup Project: Initialize the project structure and dependencies.
Terminal window npm initnpm install -
Create Discord Bot Client: Set up the client to connect to Discord and perform moderation tasks.
// env configurationprocess.env.NODE_ENV || await require('dotenv').config({ debug: false })// import configsconst { config, description } = await require("./package.json")// import libsconst { REST, Client, GatewayIntentBits } = await require('discord.js');const { readdirSync } = await require('node:fs')const fastify = require('fastify')({ logger: process.env.DEBUG || false })// init discord bot && rest objconst bot = new Client({ intents: [GatewayIntentBits.Guilds,GatewayIntentBits.GuildMessages,GatewayIntentBits.MessageContent,GatewayIntentBits.GuildMembers,GatewayIntentBits.GuildIntegrations,GatewayIntentBits.GuildMessageReactions] });// implement configsbot.config = configbot.types = require("./lib/types") -
Implement Moderation Features: Add functionalities for moderating the server.
// implement routesif (routes) {for (const key in routes) {const {path, method = 'get', run} = routes[key]const _run = run.bind(bot)fastify[method](path, _run)}}bot.login( process.env.TOKEN )fastify.listen({ port: process.env.PORT || 80, host: process.env.HOST || '0.0.0.0' }, (err, address) => {if (err) throw errconsole.log(`Server is now listening on ${address}`);})
Skills Gained
- Developing Discord bot clients with Node.js
- Implementing moderation functionalities
- Managing and configuring bot settings for server management