necord 2.0.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +66 -9
  2. package/package.json +4 -10
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  <a href='https://img.shields.io/npm/v/necord'><img src="https://img.shields.io/npm/v/necord" alt="NPM Version" /></a>
10
10
  <a href='https://img.shields.io/npm/l/necord'><img src="https://img.shields.io/npm/l/necord" alt="NPM License" /></a>
11
11
  <a href='https://img.shields.io/npm/dm/necord'><img src="https://img.shields.io/npm/dm/necord" alt="NPM Downloads" /></a>
12
- <a href='https://img.shields.io/github/last-commit/SocketSomeone/necord'><img src="https://img.shields.io/github/last-commit/SocketSomeone/necord" alt="Last commt" /></a>
12
+ <a href='https://img.shields.io/github/last-commit/SocketSomeone/necord'><img src="https://img.shields.io/github/last-commit/SocketSomeone/necord" alt="Last commit" /></a>
13
13
  </p>
14
14
 
15
15
  ## About
@@ -20,26 +20,83 @@ This module provides fast and easy way for creating Discord bots and deep integr
20
20
 
21
21
  **Features**
22
22
 
23
- - Simple. Easy to use.
23
+ - Simple. Flexible. Easy to use.
24
24
  - Ability to create custom decorators.
25
25
  - Interact with Discord (Slash Commands, Context Menus, Message Components, Listeners).
26
26
  - Full support of NestJS guards, interceptors, filters and pipes!
27
27
 
28
- ## Getting started
28
+ For questions and support please use
29
+ the [Issues](https://github.com/SocketSomeone/necord/issues/new?assignees=&labels=question&template=question.yml).
29
30
 
30
- If you want to dive fully into Necord check out the [documentation site](https://github.com/SocketSomeone/necord/wiki).
31
+ ## Installation
31
32
 
32
- ## Questions
33
+ **Node.js 16.6.0 or newer is required.**
33
34
 
34
- For questions and support please use the [Discussions page](https://github.com/SocketSomeone/necord/discussions). The issue list of this repo is
35
- exclusively for bug reports and feature requests.
35
+ ```bash
36
+ $ npm i necord discord.js
37
+ $ yarn add necord discord.js
38
+ $ pnpm add necord discord.js
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ Once the installation process is complete, we can import the `NecordModule` into the root `AppModule`:
44
+
45
+ ```typescript
46
+ import { NecordModule } from 'necord';
47
+ import { Module } from '@nestjs/common';
48
+ import { Intents } from 'discord.js';
49
+
50
+ @Module({
51
+ imports: [
52
+ NecordModule.forRoot({
53
+ token: 'DISCORD_BOT_TOKEN',
54
+ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.DIRECT_MESSAGES]
55
+ })
56
+ ],
57
+ providers: []
58
+ })
59
+ export class AppModule {
60
+ }
61
+ ```
62
+
63
+ Then create `app.update.ts` file and add `On`/`Once` decorators for handling Discord API events:
64
+
65
+ ```typescript
66
+ import { Injectable, Logger } from '@nestjs/common';
67
+ import { Context, On, Once } from 'necord';
68
+ import { Client } from 'discord.js';
69
+
70
+ @Injectable()
71
+ export class AppUpdate {
72
+ private readonly logger = new Logger(AppUpdate.name);
73
+
74
+ @Once('ready')
75
+ public onReady(@Context() client: Client) {
76
+ this.logger.log(`Bot logged in as ${client.user.username}`);
77
+ }
78
+
79
+ @On('warn')
80
+ public onWarn(@Context() message: string) {
81
+ this.logger.warn(message);
82
+ }
83
+ }
84
+ ```
85
+
86
+ Whenever you need to handle any event data, use the `Context` decorator.
87
+
88
+ If you want to fully dive into Necord check out these resources:
89
+
90
+ * [Necord Wiki](https://github.com/SocketSomeone/necord/wiki) - Official documentation of Necord.
91
+ * [Nest JS](https://docs.nestjs.com) - A progressive framework for creating well-architectured applications.
92
+ * [Discord JS](https://discord.js.org) - The most powerful library for creating bots.
93
+ * [Discord API](https://discord.com/developers/docs) - Official documentation of Discord API.
36
94
 
37
95
  ## Stay in touch
38
96
 
39
97
  * Author - [Alexey Filippov](https://t.me/socketsomeone)
40
- * Documentation - https://github.com/SocketSomeone/necord/wiki
41
98
  * Twitter - [@SocketSomeone](https://twitter.com/SocketSomeone)
42
99
 
43
100
  ## License
44
101
 
45
- Necord is [MIT licensed](https://github.com/SocketSomeone/necord/blob/main/LICENSE).
102
+ [MIT](https://github.com/SocketSomeone/necord/blob/master/LICENSE) © [Alexey Filippov](https://github.com/SocketSomeone)
package/package.json CHANGED
@@ -1,26 +1,21 @@
1
1
  {
2
2
  "name": "necord",
3
3
  "description": "A Discord bot framework built on top of Discord.js and Nest.js for advanced and amazing bots.",
4
- "version": "2.0.1",
4
+ "version": "3.0.0",
5
5
  "scripts": {
6
6
  "build": "rimraf -rf dist && tsc -p tsconfig.json",
7
- "precommit": "lint-staged",
8
7
  "prepublish:npm": "npm run build",
9
8
  "publish:npm": "npm publish --access public",
10
9
  "prepublish:dev": "npm run build",
11
10
  "publish:dev": "npm publish --access public --tag dev",
12
11
  "prepare": "husky install .github/husky",
13
12
  "test": "echo add tests",
13
+ "format": "prettier --write \"src/**/*.ts\"",
14
14
  "lint": "eslint --ignore-path .gitignore {integration,src}/**/*.ts",
15
15
  "release": "release-it"
16
16
  },
17
17
  "main": "./dist/index.js",
18
18
  "types": "./dist/index.d.ts",
19
- "lint-staged": {
20
- "*.ts": [
21
- "prettier --write"
22
- ]
23
- },
24
19
  "keywords": [
25
20
  "nest",
26
21
  "nestjs",
@@ -53,7 +48,7 @@
53
48
  "@favware/npm-deprecate": "^1.0.4",
54
49
  "@nestjs/common": "8.2.3",
55
50
  "@nestjs/core": "8.2.3",
56
- "@types/node": "16.11.11",
51
+ "@types/node": "16.11.12",
57
52
  "@typescript-eslint/eslint-plugin": "4.33.0",
58
53
  "@typescript-eslint/parser": "4.33.0",
59
54
  "discord.js": "13.3.1",
@@ -61,8 +56,7 @@
61
56
  "eslint-config-prettier": "8.3.0",
62
57
  "eslint-plugin-prettier": "4.0.0",
63
58
  "husky": "7.0.4",
64
- "lint-staged": "12.1.2",
65
- "prettier": "2.5.0",
59
+ "prettier": "2.5.1",
66
60
  "reflect-metadata": "0.1.13",
67
61
  "release-it": "^14.11.8",
68
62
  "rimraf": "3.0.2",