Archived
added the option to disable message command (prefix)
This commit is contained in:
1 parent
0a9cdb7bde
commit
9e78438d0a
4 files changed
+14
-6
No files matched your search
@@ -12,10 +12,10 @@ import { CommandMessageStructure, PhraseOccurrenceData } from "./types.js";
|
||||
|
||||
export class CommandManager {
|
||||
list: Command[];
|
||||
prefix: string;
|
||||
prefix?: string;
|
||||
argumentSeparator: string;
|
||||
|
||||
constructor(prefix: string, argumentSeparator?: string) {
|
||||
constructor(prefix?: string, argumentSeparator?: string) {
|
||||
this.list = [];
|
||||
this.prefix = prefix;
|
||||
this.argumentSeparator = argumentSeparator || ",";
|
||||
@@ -85,6 +85,7 @@ export class CommandManager {
|
||||
* @returns *CommandMessagesStructure* | *null*
|
||||
*/
|
||||
fetchFromMessage(message: Message): CommandMessageStructure | null {
|
||||
if (!this.prefix) return null;
|
||||
if (!message.author.bot && message.content.startsWith(this.prefix)) {
|
||||
const content = message.content.replace(this.prefix, "");
|
||||
const name = content.split(" ")[0];
|
||||
|
||||
Reference in new issue
Block a user