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 deployedanimationRoleWinnerAnimationID: ID of the event winner roleanimationChannelEventID: ID of the channel where animation 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/animation-add.js: into your slash commands foldercommands/animation-list.js: into your slash commands foldercommands/animation-remove.js: into your slash commands foldercommands/animation-message.js: into your slash commands folderevents/interactionCreate.js: copy the relevant part of the code from this file to encode it in your own fileutils/arguments/post-message.js: into your utilities folderutils/animation.js: into your utilities folder
Also copy the module initialization code into your main
index.jsfile. In our file, Prisma is attached directly to theclientobject — add this code to your project or adapt it according to how you use Prisma. -
Update the database schema
Add the data model for animations 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_animation_model -
Install dependencies
Ensure the 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 slash commands
/animation-add,/animation-list,/animation-remove,/animation-messageon a test server before deploying to production. - In
index.jsyou can adjust the scheduling for removing the “Event Winner” role as needed. (Currently configured to run every day at 23:59).