From 08c652eb8e18de1bcb7836a85e6059ec2ec6ff29 Mon Sep 17 00:00:00 2001 From: Navy Date: Thu, 17 Sep 2020 20:41:44 +0300 Subject: [PATCH] "clean" substring, removes prefix and callers --- structure/extensions/Message.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/structure/extensions/Message.js b/structure/extensions/Message.js index 79fdf25..756ad45 100644 --- a/structure/extensions/Message.js +++ b/structure/extensions/Message.js @@ -198,6 +198,13 @@ const Message = Structures.extend('Message', (Message) => { : this.author.prefix; } + get _clean() { + if (!this.command) return this.cleanContent; + let str = this.content.replace(new RegExp(`^(${this.prefix}|<@!?${this.client.id}>)`, 'iu'), '').replace(this._caller, ''); + if (this._settingCaller) str = str.replace(this._settingCaller, ''); + return str.trim(); + } + } return ExtendedMessage;