Update ChatAliases.plugin.js

This commit is contained in:
Mirco Wittrien 2022-07-27 12:11:33 +02:00
parent c7e6d827c1
commit 63b8869427
1 changed files with 7 additions and 5 deletions

View File

@ -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) {