more-djs-events
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

More Discord.JS Events

Getting Started

Use this command in your terminal to install the package.

cd project-path
npm i --save more-djs-events

Important note

Check your intents, some events won't be emitted if the required intents are missing!

How to use

const Discord = require("discord.js");
const moreDJSEvents = require("more-djs-events").default;
const intents = [
  "GUILDS",
  "GUILD_MEMBERS",
  "GUILD_BANS",
  "GUILD_EMOJIS_AND_STICKERS",
  "GUILD_INTEGRATIONS",
  "GUILD_WEBHOOKS",
  "GUILD_INVITES",
  "GUILD_VOICE_STATES",
  "GUILD_PRESENCES",
  "GUILD_MESSAGES",
  "GUILD_MESSAGE_REACTIONS",
  "GUILD_MESSAGE_TYPING",
  "DIRECT_MESSAGES",
  "DIRECT_MESSAGE_REACTIONS",
  "DIRECT_MESSAGE_TYPING",
];
const partials = ["USER", "CHANNEL", "GUILD_MEMBER", "MESSAGE", "REACTION"];

const client = new Discord.Client({
  intents,
  partials,
});

(async () => {
  await moreDJSEvents(client);
  await client.login("token");
})();

//Example Events:
client.on("guildMemberVoiceConnect", (member, channel) => {});

client.on("guildMemberVoiceDisconnect", (member, oldChannel) => {});

client.on("guildMemberVoiceSwitch", (member, oldChannel, newChannel) => {});

Avaliable Events

Here are the current events with their types.

  interface ClientEvents {
    guildMemberVoiceDisconnect: [
      member: GuildMember,
      oldVoiceChannel: VoiceChannel | StageChannel
    ];
    guildMemberVoiceConnect: [
      member: GuildMember,
      voiceChannel: VoiceChannel | StageChannel
    ];
    guildMemberVoiceSwitch: [
      member: GuildMember,
      oldVoiceChannel: VoiceChannel | StageChannel,
      newVoiceChannel: VoiceChannel | StageChannel
    ];
    guildMemberUsernameChange: [
      member: GuildMember,
      oldUsername: string,
      newUsername: string
    ];
    guildMemberDiscrminatorChange: [
      member: GuildMember,
      oldUsername: string,
      newUsername: string
    ];
    guildMemberAvatarChange: [
      member: GuildMember,
      oldAvatarURL: string | null,
      newAvatarURL: string | null
    ];
    guildMemberAvatarUserChange: [
      member: GuildMember,
      oldAvatarURL: string | null,
      newAvatarURL: string | null
    ];
    guildMemberBannerChange: [
      member: GuildMember,
      oldAvatarURL: string | null,
      newAvatarURL: string | null
    ];
    guildMemberUserDelete: [member: GuildMember];
    guildMemberHexColorChange: [
      member: GuildMember,
      oldHexColor: `#${string}`,
      newHexColor: `#${string}`
    ];
    guildMemberDisplayNameChange: [
      member: GuildMember,
      oldNickname: string,
      newNickname: string
    ];
    guildMemberNicknameChange: [
      member: GuildMember,
      oldNickname: string | null,
      newNickname: string | null
    ];
    guildMemberPartialChange: [
      member: GuildMember,
      oldPartial: boolean,
      newPartial: boolean
    ];
    guildMemberPendingChange: [
      member: GuildMember,
      oldPending: boolean,
      newPending: boolean
    ];
    guildMemberPermissionsChange: [
      member: GuildMember,
      oldPermissions: Readonly<Permissions>,
      newPermissions: Readonly<Permissions>
    ];
    guildMemberSubscribedToNitro: [member: GuildMember];
    guildMemberUnsubscribedToNitro: [member: GuildMember];
    guildMemberPresenceChange: [
      member: GuildMember,
      oldPresense: Presence | null,
      newPresense: Presence | null
    ];
    guildAFKChannelChange: [
      oldChannel: VoiceChannel | null,
      newChannel: VoiceChannel | null
    ];
    guildAFKTimeoutChange: [
      guild: Guild,
      oldTimeout: number,
      newTimeout: number
    ];
    guildBannerChange: [
      guild: Guild,
      oldBanner: string | null,
      newBanner: string | null
    ];
    guildMemberRoleAdd: [member: GuildMember, role: Role];
    guildMemberRoleRemove: [member: GuildMember, role: Role];
    guildChannelPermissionsUpdate: [
      channel: GuildChannel,
      oldPermissions: Collection<
        string,
        {
          allow: PermissionString[];
          deny: PermissionString[];
        }
      >,
      newPermissions: Collection<
        string,
        {
          allow: PermissionString[];
          deny: PermissionString[];
        }
      >
    ];
    guildChannelNameChange: [
      channel: GuildChannel,
      oldChannelName: string,
      newChanelName: string
    ];
    guildChannelParentChange: [
      channel: GuildChannel,
      oldParent: CategoryChannel | null,
      newParent: CategoryChannel | null
    ];
    guildChannelPositionChange: [
      channel: GuildChannel,
      oldChannelPosition: number,
      newChanelPosition: number
    ];
  }

Are there more events?

We're just setting the bases of this package for now, We'll add a lot events soon.

Community

You can join our discord server to give us suggestions or reports Discord Server.

Github

You can find the source code on Github.

Readme

Keywords

none

Package Sidebar

Install

npm i more-djs-events

Weekly Downloads

1

Version

1.0.9

License

ISC

Unpacked Size

32.4 kB

Total Files

14

Last publish

Collaborators

  • aze-sama