discordx
Advanced tools
Comparing version 11.6.0 to 11.7.0
@@ -20,2 +20,3 @@ import type { AnySelectMenuInteraction, AutocompleteInteraction, ButtonInteraction, CommandInteraction, ContextMenuCommandInteraction, Interaction, Message, MessageReaction, ModalSubmitInteraction, PartialMessageReaction, PartialUser, Snowflake, User } from "discord.js"; | ||
private _botGuilds; | ||
private _plugins; | ||
private _guards; | ||
@@ -199,7 +200,3 @@ private logger; | ||
*/ | ||
executeCommand(message: Message, options?: { | ||
caseSensitive?: boolean; | ||
forcePrefixCheck?: boolean; | ||
log?: boolean; | ||
}): Promise<unknown>; | ||
executeCommand(message: Message, caseSensitive?: boolean): Promise<unknown>; | ||
/** | ||
@@ -206,0 +203,0 @@ * Parse reaction |
@@ -24,2 +24,3 @@ "use strict"; | ||
_botGuilds = []; | ||
_plugins = []; | ||
_guards = []; | ||
@@ -187,2 +188,3 @@ logger; | ||
super(options); | ||
this._plugins = options?.plugins ?? []; | ||
this._silent = options?.silent ?? true; | ||
@@ -833,5 +835,5 @@ this.guards = options.guards ?? []; | ||
*/ | ||
async executeCommand(message, options) { | ||
async executeCommand(message, caseSensitive) { | ||
const prefix = await this.getMessagePrefix(message); | ||
const command = await this.parseCommand(prefix, message, options?.caseSensitive ?? false); | ||
const command = await this.parseCommand(prefix, message, caseSensitive ?? false); | ||
if (command === index_js_1.SimpleCommandParseType.notCommand) { | ||
@@ -844,6 +846,6 @@ return; | ||
if (typeof handleNotFound === "string") { | ||
message.reply(handleNotFound); | ||
await message.reply(handleNotFound); | ||
} | ||
else { | ||
handleNotFound(message); | ||
await handleNotFound(message); | ||
} | ||
@@ -861,3 +863,3 @@ } | ||
} | ||
// check dm allowed or not | ||
// Check if DM is allowed and if guild is present in message | ||
if (!command.info.directMessage && !message.guild) { | ||
@@ -941,2 +943,3 @@ return; | ||
} | ||
await Promise.all(this._plugins.map((plugin) => plugin.init())); | ||
this._isBuilt = true; | ||
@@ -943,0 +946,0 @@ await this.instance.build(); |
export * from "./metadata/MetadataStorage.js"; | ||
export * from "./plugin.js"; |
@@ -5,2 +5,3 @@ "use strict"; | ||
tslib_1.__exportStar(require("./metadata/MetadataStorage.js"), exports); | ||
tslib_1.__exportStar(require("./plugin.js"), exports); | ||
//# sourceMappingURL=index.js.map |
import type { ClientOptions as DiscordJSClientOptions, Message } from "discord.js"; | ||
import type { ArgSplitter, GuardFunction, IGuild } from "../../index.js"; | ||
import type { ArgSplitter, GuardFunction, IGuild, Plugin } from "../../index.js"; | ||
import type { Awaitable, ILogger, IPrefixResolver } from "../index.js"; | ||
@@ -41,2 +41,6 @@ export type SimpleCommandConfig = { | ||
/** | ||
* Set of plugins | ||
*/ | ||
plugins?: Plugin[]; | ||
/** | ||
* Do not log anything | ||
@@ -43,0 +47,0 @@ */ |
@@ -20,2 +20,3 @@ import type { AnySelectMenuInteraction, AutocompleteInteraction, ButtonInteraction, CommandInteraction, ContextMenuCommandInteraction, Interaction, Message, MessageReaction, ModalSubmitInteraction, PartialMessageReaction, PartialUser, Snowflake, User } from "discord.js"; | ||
private _botGuilds; | ||
private _plugins; | ||
private _guards; | ||
@@ -199,7 +200,3 @@ private logger; | ||
*/ | ||
executeCommand(message: Message, options?: { | ||
caseSensitive?: boolean; | ||
forcePrefixCheck?: boolean; | ||
log?: boolean; | ||
}): Promise<unknown>; | ||
executeCommand(message: Message, caseSensitive?: boolean): Promise<unknown>; | ||
/** | ||
@@ -206,0 +203,0 @@ * Parse reaction |
@@ -20,2 +20,3 @@ import { DIService } from "@discordx/di"; | ||
_botGuilds = []; | ||
_plugins = []; | ||
_guards = []; | ||
@@ -183,2 +184,3 @@ logger; | ||
super(options); | ||
this._plugins = options?.plugins ?? []; | ||
this._silent = options?.silent ?? true; | ||
@@ -829,5 +831,5 @@ this.guards = options.guards ?? []; | ||
*/ | ||
async executeCommand(message, options) { | ||
async executeCommand(message, caseSensitive) { | ||
const prefix = await this.getMessagePrefix(message); | ||
const command = await this.parseCommand(prefix, message, options?.caseSensitive ?? false); | ||
const command = await this.parseCommand(prefix, message, caseSensitive ?? false); | ||
if (command === SimpleCommandParseType.notCommand) { | ||
@@ -840,6 +842,6 @@ return; | ||
if (typeof handleNotFound === "string") { | ||
message.reply(handleNotFound); | ||
await message.reply(handleNotFound); | ||
} | ||
else { | ||
handleNotFound(message); | ||
await handleNotFound(message); | ||
} | ||
@@ -857,3 +859,3 @@ } | ||
} | ||
// check dm allowed or not | ||
// Check if DM is allowed and if guild is present in message | ||
if (!command.info.directMessage && !message.guild) { | ||
@@ -937,2 +939,3 @@ return; | ||
} | ||
await Promise.all(this._plugins.map((plugin) => plugin.init())); | ||
this._isBuilt = true; | ||
@@ -939,0 +942,0 @@ await this.instance.build(); |
export * from "./metadata/MetadataStorage.js"; | ||
export * from "./plugin.js"; |
export * from "./metadata/MetadataStorage.js"; | ||
export * from "./plugin.js"; | ||
//# sourceMappingURL=index.js.map |
import type { ClientOptions as DiscordJSClientOptions, Message } from "discord.js"; | ||
import type { ArgSplitter, GuardFunction, IGuild } from "../../index.js"; | ||
import type { ArgSplitter, GuardFunction, IGuild, Plugin } from "../../index.js"; | ||
import type { Awaitable, ILogger, IPrefixResolver } from "../index.js"; | ||
@@ -41,2 +41,6 @@ export type SimpleCommandConfig = { | ||
/** | ||
* Set of plugins | ||
*/ | ||
plugins?: Plugin[]; | ||
/** | ||
* Do not log anything | ||
@@ -43,0 +47,0 @@ */ |
@@ -0,1 +1,11 @@ | ||
# [11.7.0](https://github.com/discordx-ts/discordx/releases/tag/discordx-11.7.0) (2023-02-11) | ||
## Features | ||
- plugins support ([#920](https://github.com/discordx-ts/discordx/issues/920)) ([811cb6](https://github.com/discordx-ts/discordx/commit/811cb66629348bd0f6764088a9d9c5011451c49a)) | ||
## Changed | ||
- simple command ([#917](https://github.com/discordx-ts/discordx/issues/917)) ([6694b7](https://github.com/discordx-ts/discordx/commit/6694b7c3a9484b4f7d7580296b883b44fffc7462)) | ||
# [11.6.0](https://github.com/discordx-ts/discordx/releases/tag/discordx-11.6.0) (2023-01-26) | ||
@@ -2,0 +12,0 @@ |
{ | ||
"name": "discordx", | ||
"version": "11.6.0", | ||
"version": "11.7.0", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Create a discord bot with TypeScript and Decorators!", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
604122
331
10075