Skip to content
This repository has been archived by the owner on Dec 24, 2021. It is now read-only.

Mention prefix option #349

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
11 changes: 11 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class CommandoClient extends discord.Client {
* @property {boolean} [nonCommandEditable=true] - Whether messages without commands can be edited to a command
* @property {string|string[]|Set<string>} [owner] - ID of the bot owner's Discord user, or multiple IDs
* @property {string} [invite] - Invite URL to the bot's support server
* @property {boolean} [mentionPrefix=true] Enable whether the bot mention, should also be a command prefix.
*/

/**
Expand All @@ -26,6 +27,7 @@ class CommandoClient extends discord.Client {
if(options.commandPrefix === null) options.commandPrefix = '';
if(typeof options.commandEditableDuration === 'undefined') options.commandEditableDuration = 30;
if(typeof options.nonCommandEditable === 'undefined') options.nonCommandEditable = true;
if(options.mentionPrefix === null) options.mentionPrefix = true;
super(options);

/**
Expand Down Expand Up @@ -166,6 +168,15 @@ class CommandoClient extends discord.Client {
return undefined;
}

get mentionPrefix() {
if(!this.options.mentionPrefix) return null;
MagnusHJensen marked this conversation as resolved.
Show resolved Hide resolved
return this.options.mentionPrefix;
}

set mentionPrefix(value) {
this.options.mentionPrefix = value;
}

async destroy() {
await super.destroy();
if(this.provider) await this.provider.destroy();
Expand Down