From 63b88694271fabf8d699cba464488849da966122 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Wed, 27 Jul 2022 12:11:33 +0200 Subject: [PATCH] Update ChatAliases.plugin.js --- Plugins/ChatAliases/ChatAliases.plugin.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Plugins/ChatAliases/ChatAliases.plugin.js b/Plugins/ChatAliases/ChatAliases.plugin.js index 52eb6327d0..f58a449fb8 100644 --- a/Plugins/ChatAliases/ChatAliases.plugin.js +++ b/Plugins/ChatAliases/ChatAliases.plugin.js @@ -389,14 +389,16 @@ module.exports = (_ => { handleSubmit (e, e2) { if (!this.settings.general.replaceBeforeSend || BDFDB.LibraryModules.SlowmodeUtils.getSlowmodeCooldownGuess(e.instance.props.channel.id) > 0) return; - let messageData = this.formatText(e2.methodArguments[0].value); + let messageData = this.formatText(e2.methodArguments[0].value || e2.methodArguments[0]); if (messageData) { - if (messageData.files.length > 0 && (BDFDB.DMUtils.isDMChannel(e.instance.props.channel.id) || BDFDB.UserUtils.can("ATTACH_FILES", BDFDB.UserUtils.me.id, e.instance.props.channel.id))) { + if (e2.methodArguments[0].uploads && messageData.files.length > 0 && (BDFDB.DMUtils.isDMChannel(e.instance.props.channel.id) || BDFDB.UserUtils.can("ATTACH_FILES", BDFDB.UserUtils.me.id, e.instance.props.channel.id))) { e2.methodArguments[0].uploads = [].concat(e2.methodArguments[0].uploads); - for (let file of messageData.files) e2.methodArguments[0].uploads.push(new BDFDB.DiscordObjects.Upload({file: file, platform: 1})); + console.log(messageData.files); + for (let file of messageData.files) BDFDB.LibraryModules.UploadUtils.instantBatchUpload(e.instance.props.channel.id, file, 0); } - if (messageData.text != null && e2.methodArguments[0].value != messageData.text) { - e2.methodArguments[0].value = messageData.text; + if (messageData.text != null && (e2.methodArguments[0].value || e2.methodArguments[0]) != messageData.text) { + if (e2.methodArguments[0].value != undefined) e2.methodArguments[0].value = messageData.text; + else e2.methodArguments[0] = messageData.text; e.instance.props.textValue = ""; if (e.instance.props.richValue) e.instance.props.richValue = BDFDB.SlateUtils.toRichValue(""); if (e.instance.state) {