GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - necordjs/necord: 🤖 A module for creating Discord bots using NestJS, based on Discord.js

BranchesTags
Open more actions menu

Latest commit

 

History

2,235 Commits
2,235 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.husky
.husky
 
 
src
src
 
 
test
test
 
 
.commitlintrc.json
.commitlintrc.json
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.oxlintrc.json
.oxlintrc.json
 
 
.prettierrc
.prettierrc
 
 
.release-it.json
.release-it.json
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.build.json
tsconfig.build.json
 
 
tsconfig.json
tsconfig.json
 
 
vitest.config.mts
vitest.config.mts
 
 

Repository files navigation

Necord Logo

🤖 A module for creating Discord bots using NestJS, based on Discord.js

Documentation ✨   Source code 🪡   Examples 🛠️   Community 💬

NPM Version NPM License NPM Downloads Last commit

About

This package uses the best of the Node.js world under the hood. Discord.js is the most powerful library for creating bots and Nest.js is a progressive framework for creating well-architectured applications. This module provides a fast and easy way of creating Discord bots and deep integration with your NestJS application.

Features

  • Simple. Flexible. Easy to use.
  • Ability to create custom decorators.
  • Interact with Discord (Slash Commands, Context Menus, Message Components, Listeners).
  • Full support of NestJS guards, interceptors, filters and pipes!

For questions and support, please use the Issues.

Installation

Node.js 18.0.0 or newer is required.

$ npm i necord discord.js
$ yarn add necord discord.js
$ pnpm add necord discord.js

Usage

Once the installation process is complete, we can import the NecordModule into the root AppModule:

import { NecordModule } from 'necord';
import { Module } from '@nestjs/common';
import { AppUpdate } from './app.update';

@Module({
    imports: [
        NecordModule.forRoot({
            token: 'DISCORD_BOT_TOKEN',
            intents: ['Guilds', 'GuildMessages', 'DirectMessages']
        })
    ],
    providers: [AppUpdate]
})
export class AppModule {
}

Then create app.update.ts file and add On/Once decorators for handling Discord API events:

import { Injectable, Logger } from '@nestjs/common';
import { Context, On, Once, ContextOf } from 'necord';
import { Client } from 'discord.js';

@Injectable()
export class AppUpdate {
    private readonly logger = new Logger(AppUpdate.name);

    public constructor(private readonly client: Client) {
    }
    
    @Once('clientReady')
    public onReady(@Context() [client]: ContextOf<'clientReady'>) {
        this.logger.log(`Bot logged in as ${client.user.username}`);
    }

    @On('warn')
    public onWarn(@Context() [message]: ContextOf<'warn'>) {
        this.logger.warn(message);
    }
}

Whenever you need to handle any event data, use the Context decorator.

If you want to fully dive into Necord, check out these resources:

  • Necord Wiki - Official documentation of Necord.
  • Nest JS - A progressive framework for creating well-architectured applications.
  • Discord JS - The most powerful library for creating bots.
  • Discord API - Official documentation of Discord API.

Backers

Stay in touch

  • Author - Alexey Filippov
  • Twitter - @SocketSomeone

License

MIT © Alexey Filippov

About

🤖 A module for creating Discord bots using NestJS, based on Discord.js

necord.org

Topics

botbot-frameworkdiscorddiscord-botdiscord-bot-apidiscordjsjavascriptnestnestjsnodejstypescript

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

504 stars

Watchers

2 watching

Forks

24 forks
Report repository

Releases

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.