# discord-birthdays

> An NPM Module to announce users birthdays written in SQL.

Latest version **1.1.0** (published 2021-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install discord-birthdays
pnpm add discord-birthdays
yarn add discord-birthdays
bun add discord-birthdays
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2021-09-01 |
| First published | 2021-08-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 43.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Hyperz#0001 |
| Maintainers | hyperz |
| Keywords | discord, birthdays, birthday, discord-birthdays, db, hyperz, development |

## Links

- npm: https://www.npmjs.com/package/discord-birthdays
- Repository: https://github.com/Itz-Hyperz/discord-birthdays
- Homepage: https://github.com/Itz-Hyperz/discord-birthdays#readme
- Issues: https://github.com/Itz-Hyperz/discord-birthdays/issues
- npm.io page: https://npm.io/package/discord-birthdays

## Dependencies (2)

- [discord.js](https://npm.io/package/discord.js.md) ^13.1.0
- [moment-timezone](https://npm.io/package/moment-timezone.md) ^0.5.33

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [@temporal-architect/claude-plugin](https://npm.io/package/@temporal-architect/claude-plugin.md) — 335 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2021-09-01
- 1.0.0 — 2021-08-29

## README

# discord-birthdays
An NPM Module allowing you to setup birthday messages when it is a users birthday automatically!

---

## Support

* [Discord](https://hyperz.dev/discord)

* [Website](https://hyperz.dev/)

---

## Installation

`npm i discord-birthdays@latest`

---

## Check SQL Table Status

Check if the required SQL table(s) are imported

| Entry        | Type | Definition | 
|----------------|---------------|---------------|
| #1   | SQL VAR  | Your SQL Connection Variable (con, db, etc)

---

## Initialization

con, client, format, guildid, channels, header, footer, color

The nodelogger function offers a fair amount of customization.

| Entry        | Type | Definition | 
|----------------|---------------|---------------|
| #1   | SQL VAR     | Your SQL Connection Variable (con, db, etc)
| #2   | CLIENT VAR  | Your bots "client" variable (client, bot, etc)
| #3   | STRING      | The format you want bdays checked as (MM-DD, DD-MM)
| #4   | STRING      | The guild id for the birthday
| #5   | ARRAY       | The channels to send the alert to
| #6   | STRING      | The header of the birthday embed
| #7   | STRING      | The footer of the birthday embed
| #8   | STRING      | The color of the birthday embed

---

## Add Birthdays

Add a birthday to the database function info

| Entry        | Type | Definition | 
|----------------|---------------|---------------|
| #1   | SQL VAR  | Your SQL Connection Variable (con, db, etc)
| #2   | STRING  | A User ID to add to the bdays table
| #3   | STRING  | The date of the users birthday

---

## Remove Birthdays

Remove a birthday from the database function info

| Entry        | Type | Definition | 
|----------------|---------------|---------------|
| #1   | SQL VAR  | Your SQL Connection Variable (con, db, etc)
| #2   | STRING  | A User ID to remove from the bdays table

---

## Code Example

```js
const Discord = require('discord.js') // V13
const client = new Discord.Client({
    intents: ['GUILDS', 'GUILD_MESSAGES', "GUILD_MESSAGE_REACTIONS", "DIRECT_MESSAGES", "GUILD_MEMBERS", "GUILD_BANS", "GUILD_INTEGRATIONS", "GUILD_WEBHOOKS", "GUILD_INVITES", "GUILD_VOICE_STATES", "GUILD_PRESENCES", "GUILD_MESSAGE_TYPING", "DIRECT_MESSAGE_REACTIONS", "DIRECT_MESSAGE_TYPING"],
    partials: ["CHANNEL", "MESSAGE", "REACTIONS"],
    allowedMentions: { parse: ['users', 'roles', 'everyone'], repliedUser: true }
});

let con;
const mysql = require('mysql')
client.utils = require('discord-birthdays')

client.on(`ready`, () => {
    con = mysql.createConnection({
        host: "localhost",
        user: "root",
        password: "",
        database: "dbname"
    });

    console.log(`I AM READY WOOOOO`)

    setTimeout(async () => {
        await client.utils.dbcheck(con)
        await client.utils.init(con, client, 'MM-DD', '832721829822857296', ['879012702222168064'], `HAPPY BIRTHDAY`, `Happy BDay Lol`, `#ffffff`)
    }, 3000)
});

client.on('messageCreate', message => {
    let prefix = '!'
    if (message.content.startsWith(prefix)) {
        const args = message.content.slice(prefix.length).trim().split(/ +/g);
        let command = args.shift().toLowerCase();

        if(command === 'ping') {
            message.channel.send({ content: "pong!" })
        } else if(command === 'add') {
            let check = client.utils.addbday(con, message.author.id, args[0])
            if(check) {
                message.channel.send({ content: "Bday Added!" })
            } else {
                message.channel.send({ content: "Bday Add Failed!" })
            }
        } else if(command === 'remove') {
            let check2 = client.utils.removebday(con, message.author.id)
            if(check2) {
                message.channel.send({ content: "Bday Removed!" })
            } else {
                message.channel.send({ content: "Failed to remove bday!" })
            }
        }
    }
});

client.login(`YOUR_TOKEN_HERE`)
```

---
_Source: https://npm.io/package/discord-birthdays · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
