Skip to content

Commit

Permalink
refactor(discordx): remove plugin feature (#1044)
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayymmeena authored Jun 15, 2024
1 parent 04a3ade commit 0926c07
Show file tree
Hide file tree
Showing 27 changed files with 1,330 additions and 1,546 deletions.
29 changes: 0 additions & 29 deletions docs/docs/discordx/basics/plugin.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ module.exports = {
"discordx/basics/debugging",
"discordx/basics/dependency-injection",
"discordx/basics/metadatastorage",
"discordx/basics/plugin",
"discordx/basics/rest-args-of",
"discordx/basics/sharding",
],
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions packages/discordx/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# discordx

## 11.10.0

### Minor Changes

- removed discordx plugin feature

## 11.9.4

### Patch Changes
Expand Down
52 changes: 0 additions & 52 deletions packages/discordx/examples/plugin/main.ts

This file was deleted.

19 changes: 0 additions & 19 deletions packages/discordx/examples/plugin/plugin/commands/help.ts

This file was deleted.

14 changes: 0 additions & 14 deletions packages/discordx/examples/plugin/plugin/plugin.ts

This file was deleted.

18 changes: 0 additions & 18 deletions packages/discordx/examples/plugin/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/discordx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "discordx",
"version": "11.9.4",
"version": "11.10.0",
"private": false,
"description": "Create a discord bot with TypeScript and Decorators!",
"keywords": [
Expand Down
19 changes: 0 additions & 19 deletions packages/discordx/src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import type {
IPrefixResolver,
ISimpleCommandByName,
ITriggerEventData,
Plugin,
SimpleCommandConfig,
} from "./index.js";
import {
Expand All @@ -78,13 +77,11 @@ import {
export class Client extends ClientJS {
private _botId: string;
private _isBuilt = false;
private _isPluginsLoaded = false;
private _prefix: IPrefixResolver;
private _simpleCommandConfig?: SimpleCommandConfig;
private _silent: boolean;
private _listeners = new Map<string, EventListenerDetail[]>();
private _botGuilds: IGuild[] = [];
private _plugins: Plugin[] = [];
private _guards: GuardFunction[] = [];
private logger: ILogger;

Expand Down Expand Up @@ -301,7 +298,6 @@ export class Client extends ClientJS {
constructor(options: ClientOptions) {
super(options);

this._plugins = options.plugins ?? [];
this._silent = options.silent ?? true;
this.guards = options.guards ?? [];
this.botGuilds = options.botGuilds ?? [];
Expand Down Expand Up @@ -1426,18 +1422,6 @@ export class Client extends ClientJS {
return this.instance.trigger(options)(params);
}

/**
* Load plugins
*/
async initPlugins(): Promise<void> {
if (this._isPluginsLoaded) {
return;
}

this._isPluginsLoaded = true;
await Promise.all(this._plugins.map((plugin) => plugin.init(this)));
}

/**
* Bind discordx events to client
*/
Expand Down Expand Up @@ -1501,9 +1485,6 @@ export class Client extends ClientJS {

this._isBuilt = true;

// Load plugins
await this.initPlugins();

// Build instance
await this.instance.build();

Expand Down
1 change: 0 additions & 1 deletion packages/discordx/src/logic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
* -------------------------------------------------------------------------------------------------------
*/
export * from "./metadata/MetadataStorage.js";
export * from "./plugin.js";
22 changes: 0 additions & 22 deletions packages/discordx/src/logic/plugin.ts

This file was deleted.

12 changes: 1 addition & 11 deletions packages/discordx/src/types/core/ClientOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ import type {
Message,
} from "discord.js";

import type {
ArgSplitter,
GuardFunction,
IGuild,
Plugin,
} from "../../index.js";
import type { ArgSplitter, GuardFunction, IGuild } from "../../index.js";
import type { Awaitable, ILogger, IPrefixResolver } from "../index.js";

export interface SimpleCommandConfig {
Expand Down Expand Up @@ -60,11 +55,6 @@ export interface ClientOptions extends DiscordJSClientOptions {
*/
logger?: ILogger;

/**
* Set of plugins
*/
plugins?: Plugin[];

/**
* Do not log anything
*/
Expand Down
6 changes: 6 additions & 0 deletions packages/plugin-lava-player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @discordx/plugin-lava-player

## 2.2.0

### Minor Changes

- removed discordx plugin feature

## 2.1.3

### Patch Changes
Expand Down
11 changes: 1 addition & 10 deletions packages/plugin-lava-player/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ lava player plugin for discordx bots.

```
npm install @discordx/plugin-lava-player
yarn add @discordx/plugin-lava-player
pnpm add @discordx/plugin-lava-player
```

# ⚠️ Prerequisites
Expand All @@ -60,14 +58,7 @@ To use this plugin, You will need to have a running Lavalink instance as well as
# 📄 Usage

```ts
import { Client, MetadataStorage } from "discordx";
import { LavaPlayerPlugin } from "@discordx/plugin-lava-player";

// Initialize the Plugin:
const lavaPlugin = new LavaPlayerPlugin({ metadata: MetadataStorage.instance });

// Provide the plugin to the Discordx Client:
const client = new Client({ plugins: [lavaPlugin] });
import "@discordx/plugin-lava-player";
```

# 📜 Documentation
Expand Down
Loading

0 comments on commit 0926c07

Please sign in to comment.