# @magicyan/discord-events

> Extended events of discord.js

Latest version **1.2.1** (published 2025-02-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @magicyan/discord-events
pnpm add @magicyan/discord-events
yarn add @magicyan/discord-events
bun add @magicyan/discord-events
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2025-02-07 |
| First published | 2023-10-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 28.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 20 |
| Author | Rincko Dev |
| Maintainers | rinckodev |

## Links

- npm: https://www.npmjs.com/package/@magicyan/discord-events
- Repository: https://github.com/rinckodev/magicyan
- Homepage: https://github.com/rinckodev/magicyan/tree/main/packages/discord-events#readme
- Issues: https://github.com/rinckodev/magicyan/issues
- npm.io page: https://npm.io/package/@magicyan/discord-events

## Recent versions

- 1.2.1 (latest) — 2025-02-07
- 1.2.0 — 2025-01-02
- 1.1.1 — 2024-09-02
- 1.1.0 — 2024-09-02
- 1.0.16 — 2024-08-08
- 1.0.15 — 2024-05-15
- 1.0.14 — 2024-05-04
- 1.0.13 — 2024-03-08
- 1.0.12 — 2024-02-24
- 1.0.11 — 2024-01-17
- 1.0.10 — 2024-01-17
- 1.0.9 — 2024-01-16
- 1.0.8 — 2024-01-16
- 1.0.7 — 2024-01-14
- 1.0.6 — 2024-01-14
- … 5 more at https://npm.io/package/@magicyan/discord-events/versions

## README

<div align="center">
  <img src="../../assets/images/icon.png" alt="Icon" width="100" height="100">
  <div style="margin-left: 20px;">

  # Magicyan Discord Events
  
  </div>
</div>

Install with
```bash
npm install @magicyan/discord-events
pnpm install @magicyan/discord-events
yarn add @magicyan/discord-events
bun install @magicyan/discord-events
```

This lib adds more discord.js specific events

## Setup
Create your bot client normally and pass it to the initDiscordEvents function, so that events can be registered

```ts
import { Client } from "discord.js";
import { initDiscordEvents } from "@magicyan/discord-events";

const client = new Client({
    intents: [/* add your intents ... */]
    // set your client options ...
});

initDiscordEvents(client);
```

## How to use
You can create a listener for the event in the same way you create it for standard discord.js events

```ts
client.on("guildMemberConnect", (member, channel) => {
    console.log(member.displayName, "joined the" channel.name);
})
```

See below the list of all events

| Event | Parameters | Description |
| ----- | --------- |------------ |
| webhookMessageCreate | `message`, `webhook` | Emitted when a webhook message is created. | 
| guildMemberConnect | `member`, `voiceChannel` | Emitted when a member connect to voice channel in a guild. |
| guildMemberDisconnect | `member`, `voiceChannel`  | Emitted when a member disconnect from voice channel in a guild. |
| guildMemberMoved | `member`, `executor`, `oldVoiceChannel`, `newVoiceChannel` | Emitted when a member is moved from one voice channel to another. |
| guildMemberTimeoutAdd | `member`, `executor`, `expireAt`, `reason` | Emitted when a member gets a timeout |
| guildMemberTimeoutAdd | `member`, `executor` | Emitted when a member has a timeout removed |
| userKick | `user`, `executor`, `reason`, `guild` | Emitted when a user is kicked from the guild |
| userBanAdd | `user`, `executor`, `reason`, `guild` | Emitted when a user is banned from the guild |
| userBanRemove | `user`, `executor`, `reason`, `guild` | Emitted when a user's ban is removed |
| extendedRoleCreate | `role`, `executor` | Emitted when a role is created |
| extendedRoleUpdate | `role`, `changes`, `executor` | Emitted when a role is updated |
| extendedRoleDelete | `deletedRole`, `executor` | Emitted when a role is deleted |

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