stuff
This commit is contained in:
parent
f3c16a60ab
commit
6344c24809
|
@ -2,7 +2,7 @@
|
|||
* @name ChatAliases
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 2.3.4
|
||||
* @version 2.3.5
|
||||
* @description Allows you to configure your own Aliases/Commands
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "ChatAliases",
|
||||
"author": "DevilBro",
|
||||
"version": "2.3.4",
|
||||
"version": "2.3.5",
|
||||
"description": "Allows you to configure your own Aliases/Commands"
|
||||
}
|
||||
};
|
||||
|
@ -92,8 +92,7 @@ module.exports = (_ => {
|
|||
this.patchedModules = {
|
||||
before: {
|
||||
ChannelTextAreaForm: "render",
|
||||
MessageEditor: "render",
|
||||
Upload: "render"
|
||||
MessageEditor: "render"
|
||||
},
|
||||
after: {
|
||||
Autocomplete: "render"
|
||||
|
@ -378,28 +377,26 @@ module.exports = (_ => {
|
|||
|
||||
processChannelTextAreaForm (e) {
|
||||
BDFDB.PatchUtils.patch(this, e.instance, "handleSendMessage", {before: e2 => {
|
||||
if (this.settings.places.normal) this.handleSubmit(e, e2, 0);
|
||||
if (this.settings.places.normal) this.handleSubmit(e, e2);
|
||||
}}, {force: true, noCache: true});
|
||||
}
|
||||
|
||||
processMessageEditor (e) {
|
||||
BDFDB.PatchUtils.patch(this, e.instance, "onSubmit", {before: e2 => {
|
||||
if (this.settings.places.edit) this.handleSubmit(e, e2, 0);
|
||||
if (this.settings.places.edit) this.handleSubmit(e, e2);
|
||||
}}, {force: true, noCache: true});
|
||||
}
|
||||
|
||||
processUpload (e) {
|
||||
BDFDB.PatchUtils.patch(this, e.instance, "submitUpload", {before: e2 => {
|
||||
if (this.settings.places.upload) this.handleSubmit(e, e2, 1);
|
||||
}}, {force: true, noCache: true});
|
||||
}
|
||||
|
||||
handleSubmit (e, e2, textIndex) {
|
||||
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[textIndex]);
|
||||
let originalMethodArguments = e2.methodArguments[0];
|
||||
let isObject = BDFDB.ObjectUtils.is(originalMethodArguments);
|
||||
let textValue = isObject ? e2.methodArguments[0].value : e2.methodArguments[0];
|
||||
let messageData = this.formatText(textValue);
|
||||
if (messageData) {
|
||||
if (messageData.text != null && e2.methodArguments[textIndex] != messageData.text) {
|
||||
e2.methodArguments[textIndex] = messageData.text;
|
||||
if (messageData.text != null && textValue != messageData.text) {
|
||||
if (isObject) 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) {
|
||||
|
|
|
@ -140,7 +140,6 @@ module.exports = (_ => {
|
|||
let messages = this.formatText(textValue).filter(n => n);
|
||||
for (let i in messages) BDFDB.TimeUtils.timeout(_ => {
|
||||
let last = i >= messages.length-1;
|
||||
console.log(messages[i].length);
|
||||
e2.originalMethod(!isObject ? messages[i] : (last ? Object.assign({}, originalMethodArguments, {value: messages[i]}) : {stickers: [], uploads: [], value: messages[i]}));
|
||||
if (i >= messages.length-1) BDFDB.NotificationUtils.toast(this.labels.toast_allsent, {type: "success"});
|
||||
}, messageDelay * i * (messages > 4 ? 2 : 1));
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @name Translator
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 2.3.6
|
||||
* @version 2.3.7
|
||||
* @description Allows you to translate Messages and your outgoing Messages within Discord
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "Translator",
|
||||
"author": "DevilBro",
|
||||
"version": "2.3.6",
|
||||
"version": "2.3.7",
|
||||
"description": "Allows you to translate Messages and your outgoing Messages within Discord"
|
||||
}
|
||||
};
|
||||
|
@ -637,18 +637,23 @@ module.exports = (_ => {
|
|||
|
||||
processChannelTextAreaForm (e) {
|
||||
BDFDB.PatchUtils.patch(this, e.instance, "handleSendMessage", {instead: e2 => {
|
||||
if (this.isTranslationEnabled(e.instance.props.channel.id) && e2.methodArguments[0]) {
|
||||
e2.stopOriginalMethodCall();
|
||||
this.translateText(e2.methodArguments[0], messageTypes.SENT, (translation, input, output) => {
|
||||
translation = !translation ? e2.methodArguments[0] : (this.settings.general.sendOriginalMessage ? (translation + "\n\n> *" + e2.methodArguments[0].split("\n").join("*\n> *") + "*") : translation);
|
||||
e2.originalMethod(translation);
|
||||
});
|
||||
return Promise.resolve({
|
||||
shouldClear: true,
|
||||
shouldRefocus: true
|
||||
});
|
||||
if (this.isTranslationEnabled(e.instance.props.channel.id)) {
|
||||
let originalMethodArguments = e2.methodArguments[0];
|
||||
let isObject = BDFDB.ObjectUtils.is(originalMethodArguments);
|
||||
let textValue = isObject ? e2.methodArguments[0].value : e2.methodArguments[0];
|
||||
if (textValue) {
|
||||
e2.stopOriginalMethodCall();
|
||||
this.translateText(textValue, messageTypes.SENT, (translation, input, output) => {
|
||||
translation = !translation ? textValue : (this.settings.general.sendOriginalMessage ? (translation + "\n\n> *" + textValue.split("\n").join("*\n> *") + "*") : translation);
|
||||
e2.originalMethod(!isObject ? translation : Object.assign({}, originalMethodArguments, {value: translation}));
|
||||
});
|
||||
return Promise.resolve({
|
||||
shouldClear: true,
|
||||
shouldRefocus: true
|
||||
});
|
||||
}
|
||||
}
|
||||
else return e2.callOriginalMethodAfterwards();
|
||||
return e2.callOriginalMethodAfterwards();
|
||||
}}, {force: true, noCache: true});
|
||||
}
|
||||
|
||||
|
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 282 B |
Loading…
Reference in New Issue