Skip to content

Description

This module offers automated and flexible management of event winners, making it easy to track events on the server, while giving the server the freedom to use this role in a customized way. With this role, you can assign special permissions, offer exclusive benefits, or simply recognize active members of your community.

Once the title, description, image (optional) and the name of the message author (optional) are provided:

Image for adding an animation message

You will get a personalized animation message that will be automatically sent to the channel configured in the .env file, as shown below:

Animation message result image

You can view the list and add event winners via the /animation-add slash command. Each time days are added, they are summed with the remaining days of the member if they were already a winner from a previous event:

Animation winner add command image

Every day at 23:59, the module checks whether the event winner role should be removed from the member.

  • The module is not functional by merely downloading the files; it must be integrated into an already working Discord bot.
  • We use Prisma as the ORM for database management; make sure your project also uses Prisma or adapt the code accordingly.
  • A working Discord bot with the necessary permissions to register slash commands.
  • Knowledge of Discord bot development (JavaScript) and database management to use and adapt this script to your needs.
  • Directorycommands
    • animation-add.js Implementation of the /animation-add slash command
    • animation-list.js Implementation of the /animation-list slash command
    • animation-remove.js Implementation of the /animation-remove slash command

      Required argument “id_user”: ID of the user to remove from the winners list
    • animation-message.js Implementation of the /animation-message slash command

      Optional argument “id_role”: if provided, the message will mention that role

      Optional argument “id_message”: if provided, the message will be edited instead of creating a new one
  • Directoryevents
    • interactionCreate.js Interaction recovery file
  • Directoryprisma
    • schema.prisma Data model for the module (Prisma)
  • Directoryutils
    • Directoryarguments
      • post-message.js List of arguments for the animation message command
    • animation.js Helper functions for managing winners
  • .env Required environment variables
  • index.js Entry point of the script
  • package.json Required dependencies

These are the versions used during development and testing of the script:

  • @prisma/client@6.18.0
  • discord.js@14.24.0
  • dotenv@16.6.1
  • node-schedule@2.1.1
  • moment@2.30.1