Installation
Follow these steps to correctly install the script on your bot.
Installation steps
Section titled “Installation steps”-
Download the module & unzip the folder
Retrieve the module folder (usually in .zip or .rar format) from the official source.
Use a tool like WinRAR or 7-Zip to extract the script folder on your computer. -
Configure environment variables
Open the provided
.envfile and add/modify the environment variables required for the module to work correctly.guildID: ID of the Discord server where the bot is deployedchannelBirthdayID: ID of the channel where birthday messages will be sent
-
Copy/move the files/code into your project
Copy the following files into the appropriate folder(s) of your Discord bot project:
commands/birthday.jsinto your slash commands folderutils/birthday.jsinto your utilities folder
Also copy the module registration code into your main
index.js. In this file, we have added Prisma directly linked to the “client” object. Put this code in your own file or adjust it according to how you use Prisma. -
Update the database schema
Add the birthday data model to your
prisma/schema.prismafile and run the necessary migrations to apply the changes to your database.
Run the following commands:Terminal window npx prisma generatenpx prisma migrate dev --name add_birthday_model -
Install dependencies
Make sure required dependencies are installed by checking your
package.jsonand running:Terminal window npm install -
Restart the bot
Restart your bot so the script is loaded.
- Test the
/birthdayslash command in a test server before deploying to production. - In
index.jsyou can adjust the scheduling of birthday messages as needed (currently set to run every day at 08:00). - In
utils/birthday.jsyou can customize the content of the birthday messages sent to users.