This is a Discord bot built with discord.js and TypeScript. The bot pulls commands from a MongoDB database and generates responses based on a list of commands that start with !. It can assign users roles and provides a welcome message when a new member joins the server.
- Command Handling: Responds to commands starting with
!. - Role Assignment: Assigns roles to users.
- Welcome Message: Sends a welcome message to new members.
Ensure you have the following installed on your development machine:
- Node.js (>= 14.x)
- npm or yarn
- MongoDB instance (local or remote)
-
Clone the repository
git clone https://github.com/ljreaux/MMMeadBot.git cd MMMeadBot -
Install dependencies
npm install # or yarn install
-
Create a
.envfile in the root of the project and add the following environment variables:```dotenv TOKEN=<your-discord-bot-token> CLIENT_ID=<your-discord-client-id> GUILD_ID=<your-discord-guild-id> WELCOME_CHANNEL=<your-welcome-channel-id> BOT_SPAM_CHANNEL=<your-bot-spam-channel-id> GENERAL_CHANNEL=<your-general-channel-id> ADMIN_CHANNEL=<your-admin-channel-id> HONEYPOT_CHANNEL=<your-honeypot-channel-id> # Optional comma-separated role IDs that must never be banned: HONEYPOT_EXEMPT_ROLE_IDS=<role-id>,<role-id> MONGO_URI=<your-mongodb-connection-string> ```Replace the placeholders with your Discord bot token, application and server IDs, channel IDs, and MongoDB connection string.
HONEYPOT_CHANNELis an enforcement channel: an ordinary human member who posts there is immediately banned, their messages from the preceding 24 hours are deleted, and a detailed incident embed is sent toADMIN_CHANNEL. Bots, webhooks, the server owner, members with moderation permissions, and members whose roles are listed inHONEYPOT_EXEMPT_ROLE_IDSare not banned. Protected-member posts and failed ban attempts are still reported. The bot needs View Channel and Read Message History in the honeypot, Ban Members with a role above the members it must ban, and View Channel, Send Messages, and Embed Links in the admin channel.
-
npm start # or yarn start
- Commands: Use !list to trigger a command to get a list of available commands.
- Role Assignment: The bot can automatically assign roles based on predefined commands.
- Welcome Message: The bot sends a welcome message whenever a new member joins the server.
- Fork the repository.
- Create a new branch:
git checkout -b my-feature-branch - Make your changes and commit them:
git commit -m 'Add some feature' - Push to the branch:
git push origin my-feature-branch - Submit a pull request.
This project is licensed under the MIT License.