diff --git a/src/lib/structures/Command.ts b/src/lib/structures/Command.ts index d2f185c6..ef5b6ec3 100644 --- a/src/lib/structures/Command.ts +++ b/src/lib/structures/Command.ts @@ -16,6 +16,8 @@ export class Command extends BasePiece { public readonly canRunInDM: boolean; /** The amount of time in seconds of the command's cooldown */ public readonly cooldown: number; + /** Whether or not this command can only be run by the owner */ + public readonly ownerOnly: boolean; public run(_message: Message, ..._arg: any[]): void { throw new Error(`Run function not defined in ${__filename}`); @@ -27,6 +29,7 @@ export class Command extends BasePiece { this.nsfw = options?.nsfw ?? false; this.canRunInDM = options?.canRunInDM ?? true; this.cooldown = options?.cooldown ?? 0; + this.ownerOnly = options?.ownerOnly ?? false; } } @@ -38,5 +41,7 @@ interface CommandOptions extends BasePieceOptions { /** Whether or not this command can be called by a user when DM-ing the bot */ canRunInDM?: boolean; /** The amount of time in seconds of a command's cooldown */ - cooldown: number; + cooldown?: number; + /** Whether or not this command can only be run by the owner */ + ownerOnly?: boolean; } \ No newline at end of file diff --git a/src/lib/structures/Event.ts b/src/lib/structures/Event.ts index ab2a7ec7..3ee690de 100644 --- a/src/lib/structures/Event.ts +++ b/src/lib/structures/Event.ts @@ -23,8 +23,8 @@ export class Event extends BasePiece { super(client, pool, options); if (!options.event) throw new Error(`No event name provided in one of the event files.`) this.event = options.event; - this.disabled = options.disabled || false; - this.once = options.once || false; + this.disabled = options.disabled ?? false; + this.once = options.once ?? false; } } diff --git a/src/lib/structures/Monitor.ts b/src/lib/structures/Monitor.ts index 4251b505..c11fa0f8 100644 --- a/src/lib/structures/Monitor.ts +++ b/src/lib/structures/Monitor.ts @@ -20,9 +20,9 @@ export class Monitor extends BasePiece { constructor(client: MoonlightClient, pool: BasePool, options: MonitorOptions) { super(client, pool, options) - this.ignoreSelf = options.ignoreSelf || false; - this.ignoreBots = options.ignoreBots || false; - this.ignoreOthers = options.ignoreOthers || false; + this.ignoreSelf = options.ignoreSelf ?? false; + this.ignoreBots = options.ignoreBots ?? false; + this.ignoreOthers = options.ignoreOthers ?? false; } }