Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

peterthehan/discord-birthday-role-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Discord Birthday Role Bot

Discord Twitter Follow

A Discord bot that assigns members a birthday role based on their account creation date and server join date.

Setup

  1. Follow the instructions in create-discord-bot.

    Don't forget to give your bot the Manage Roles permission!

  2. Download this bot and move the src-discord-birthday-role-bot folder into the /src/bots folder from step 1.

    Run npm i cron@^1.8.2 and npm i -D @types/cron@^1.7.3 to install this bot's dependencies.

  3. Open config.json to configure your own settings:

    [
      {
        "guildId": "258167954913361930",
        "accountBirthdayRoleId": "606324811068735489",
        "serverBirthdayRoleId": "606262166672113675",
        "daysToLookBack": 1,
        "daysToLookForward": 1,
        "timezone": "America/Los_Angeles",
        "cronExpression": "0 0 20 * * *"
      }
    ]

    Add as many rules as you want to configure for other servers.

    • guildId is the server id.
    • accountBirthdayRoleId is the role id assigned to users with an account birthday.
    • serverBirthdayRoleId is the role id assigned to members with a server birthday.
    • Birthday roles are assigned if the birthday falls between the date range created by daysToLookBack and daysToLookForward using the current date (excludes "0th" birthdays for users that join the same day).
    • timezone is the timezone you wish to localize your cronExpression to.
    • cronExpression is the interval at which the birthday checks are done.

    Some useful tools:

    • Moment Timezone: find your timezone string.
    • crontab guru: build your cronExpression. Note that the tool does not support seconds but this bot configuration does.
  4. npm start to run the bot.

Visit for more help or information!