npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

discord-birthday-wisher

v1.3.3

Published

discord-brithday-wisher is a powerful npm package that wishes everyone a happy birthday on their birthday, uses MongoDB.

Downloads

14

Readme

discord-birthday-wisher

  • discord-birthday-wisher is a powerful npm package that wishes everyone a happy birthday on their birthday, uses MongoDB.
  • If you need help feel free to join our discord server to talk and help you with your code.
  • If you encounter any of issues fell free to open an issue in our github repository.

Download & Update

You can download it from npm:

npm install discord-birthday-wisher

You can update to a newer version to receive updates using npm.

npm update discord-birthday-wisher

Changelog

  • 8 July 2022 (v1.3.3) - Fixed bug in changeBirthday() assigning wrong birthday month.
  • 7 July 2022 (v1.3.0) - Changed
<Birthday>.BirthdayDay;
<Birthday>.BirthdayMonth;
<Birthday>.BirthdayYear;
<Birthday>.BirthdayFull;

to

<Birthday>.Day;
<Birthday>.Month;
<Birthday>.Year;
<Birthday>.Full;
  • 6 July 2022 (v1.1.0) - Grand Launch.

Quick Example

/* setBirthday Example */
const Birthdays = require("discord-birthday-wisher");
// Sets the birthday for a user to 08/11/2005.
const myBirthday = Birthdays.setBirthday("611107142560382976", "753938142246994031", "753938142246994033", 8, 11, 2005);

console.log(myBirthday.Day); // Output: 8
console.log(myBirthday.Month); // Output: 11
console.log(myBirthday.Year); // Output: 2005
console.log(myBirthday.Full); // Output: 8/11/2005

Setting Up

First things first, we include the module into the project.

const Birthdays = require("discord-birthday-wisher");

After that, you need to provide a valid mongo database url, and set it. You can do so by:

See How to connect to MongoDB Atlas here

Birthdays.connectionURL("mongodb://..."); // You only need to do this ONCE per process.

Examples

Examples can be found in /test

Methods

setBirthday

Creates an entry in database for that birthday if it doesnt exist.

Birthdays.setBirthday(<UserID - String>, <GuildID - String>, <ChannelID - String>, <BirthdayDay - Number> , BirthdayMonth - Number>, <BirthdayYear - Number>);
  • Output:
Promise<Object>

deleteBirthday

If the birthday exists, deletes it.

Birthdays.deleteBirthday(<UserID - String>, <GuildID - String>);
  • Output:
Promise<Object>

changeBirthday

If the birthday exists, changes it to the new birthday date.

Birthdays.changeBirthday(<BirthdayDay - Number> , <BirthdayMonth - Number>, <BirthdayYear - Number>);
  • Output:
Promise<Object>

How it works

setBirthday

  1. First, it runs a check to validated the given parameters.
  2. Then, it creates a MongoDB document in your database that stores the information.
  3. After that, it uses node-schedule to schedule a job at the specified birthday date.
  4. Lastly, when we get to that date, it sends a message to the specified channel wishing the user a happy birthday.

deleteBirthday

  1. First, it runs a check to validated the given parameters.
  2. Then, it finds the MongoDB document that matches with the inforamtion and deletes this document.
  3. Lastly, it retrieves the node-schedule job and cancels it.

changeBirthday

  1. First, it runs a check to validated the given parameters.
  2. Then, it finds the MongoDB document that matches with the inforamtion and updates this document.
  3. Lastly, it retrieves the node-schedule job and updates it with the new date.

Have fun and happy birthdays! Made with ❤ by Abdelrahman.