A Discord bot that assigns members a birthday role based on their account creation date and server join date.
-
Follow the instructions in create-discord-bot.
Don't forget to give your bot the
Manage Roles
permission! -
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
andnpm i -D @types/cron@^1.7.3
to install this bot's dependencies. -
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
anddaysToLookForward
using the current date (excludes "0th" birthdays for users that join the same day). timezone
is the timezone you wish to localize yourcronExpression
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.
-
npm start
to run the bot.
Visit for more help or information!