This commit is contained in:
Mirco Wittrien 2021-07-28 23:53:07 +02:00
parent 9d1dc332fe
commit 71c697d8ec
2 changed files with 16 additions and 23 deletions

View File

@ -2,7 +2,7 @@
* @name SplitLargeMessages * @name SplitLargeMessages
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.6.8 * @version 1.7.0
* @description Allows you to enter larger Messages, which will automatically split into several smaller Messages * @description Allows you to enter larger Messages, which will automatically split into several smaller Messages
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -17,12 +17,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "SplitLargeMessages", "name": "SplitLargeMessages",
"author": "DevilBro", "author": "DevilBro",
"version": "1.6.8", "version": "1.7.0",
"description": "Allows you to enter larger Messages, which will automatically split into several smaller Messages" "description": "Allows you to enter larger Messages, which will automatically split into several smaller Messages"
}, },
"changeLog": { "changeLog": {
"improved": { "improved": {
"Nitro Max Message Length": "Now uses 4000 as Max Limit when the user has the permissions to" "Threads": "Works flawlessly with Threads now"
} }
} }
}; };
@ -96,7 +96,7 @@ module.exports = (_ => {
} }
onStart () { onStart () {
maxMessageLength = BDFDB.LibraryModules.NitroUtils.canUseIncreasedMessageLength(BDFDB.UserUtils.me) && BDFDB.DiscordUtils.getExperiment("premiumContentLengthAvailable") !== false ? BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH_PREMIUM : BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH; maxMessageLength = BDFDB.LibraryModules.NitroUtils.canUseIncreasedMessageLength(BDFDB.UserUtils.me) ? BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH_PREMIUM : BDFDB.DiscordConstants.MAX_MESSAGE_LENGTH;
BDFDB.PatchUtils.forceAllUpdates(this); BDFDB.PatchUtils.forceAllUpdates(this);
} }
@ -134,16 +134,14 @@ module.exports = (_ => {
} }
processChannelTextAreaForm (e) { processChannelTextAreaForm (e) {
if (!BDFDB.PatchUtils.isPatched(this, e.instance, "handleSendMessage")) BDFDB.PatchUtils.patch(this, e.instance, "handleSendMessage", {instead: e2 => { BDFDB.PatchUtils.patch(this, e.instance, "handleSendMessage", {instead: e2 => {
if (e2.methodArguments[0].length > maxMessageLength) { if (e2.methodArguments[0].length > maxMessageLength) {
e2.stopOriginalMethodCall(); e2.stopOriginalMethodCall();
let messages = this.formatText(e2.methodArguments[0]); let messages = this.formatText(e2.methodArguments[0]).filter(n => n);
messages.filter(n => n).forEach((message, i) => { for (let i in messages) BDFDB.TimeUtils.timeout(_ => {
BDFDB.TimeUtils.timeout(_ => { e2.originalMethod(messages[i]);
e2.originalMethod(message);
if (i >= messages.length-1) BDFDB.NotificationUtils.toast(this.labels.toast_allsent, {type: "success"}); if (i >= messages.length-1) BDFDB.NotificationUtils.toast(this.labels.toast_allsent, {type: "success"});
}, messageDelay * i); }, messageDelay * i * (messages > 4 ? 2 : 1));
});
return Promise.resolve({ return Promise.resolve({
shouldClear: true, shouldClear: true,
shouldRefocus: true shouldRefocus: true
@ -154,7 +152,7 @@ module.exports = (_ => {
} }
processChannelTextAreaContainer (e) { processChannelTextAreaContainer (e) {
if (e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL) { if (e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL || e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.SIDEBAR) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "SlateCharacterCount"}); let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "SlateCharacterCount"});
if (index > -1) { if (index > -1) {
let text = BDFDB.LibraryModules.SlateSelectionUtils.serialize(children[index].props.document, "raw"); let text = BDFDB.LibraryModules.SlateSelectionUtils.serialize(children[index].props.document, "raw");
@ -172,7 +170,7 @@ module.exports = (_ => {
} }
processChannelEditorContainer (e) { processChannelEditorContainer (e) {
if (e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL) e.instance.props.shouldUploadLongMessages = false; if (e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL || e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.SIDEBAR) e.instance.props.shouldUploadLongMessages = false;
} }
formatText (text) { formatText (text) {

View File

@ -2,7 +2,7 @@
* @name Translator * @name Translator
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 2.2.9 * @version 2.3.0
* @description Allows you to translate Messages and your outgoing Messages within Discord * @description Allows you to translate Messages and your outgoing Messages within Discord
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -17,12 +17,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "Translator", "name": "Translator",
"author": "DevilBro", "author": "DevilBro",
"version": "2.2.9", "version": "2.3.0",
"description": "Allows you to translate Messages and your outgoing Messages within Discord" "description": "Allows you to translate Messages and your outgoing Messages within Discord"
}, },
"changeLog": { "changeLog": {
"improved": { "improved": {
"Plugin Name": "Changed to clarify the Usage" "Threads": "Works flawlessly with Threads now"
} }
} }
}; };
@ -389,11 +389,6 @@ module.exports = (_ => {
} }
onStart () { onStart () {
// REMOVE 25.05.2021
let loadedFavorites = BDFDB.DataUtils.load(this, "favorites");
if (BDFDB.ObjectUtils.is(loadedFavorites) && Object.keys(loadedFavorites).length) BDFDB.DataUtils.save(Object.keys(loadedFavorites), this, "favorites")
this.forceUpdateAll(); this.forceUpdateAll();
} }
@ -622,7 +617,7 @@ module.exports = (_ => {
processChannelTextAreaContainer (e) { processChannelTextAreaContainer (e) {
if (this.settings.general.addTranslateButton) { if (this.settings.general.addTranslateButton) {
let editor = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ChannelEditorContainer"}); let editor = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ChannelEditorContainer"});
if (editor && editor.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL && !editor.props.disabled) { if (editor && (editor.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL || editor.props.type == BDFDB.DiscordConstants.TextareaTypes.SIDEBAR) && !editor.props.disabled) {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.textareapickerbuttons]]}); let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.textareapickerbuttons]]});
if (index > -1 && children[index].props && children[index].props.children) children[index].props.children.unshift(BDFDB.ReactUtils.createElement(TranslateButtonComponent, { if (index > -1 && children[index].props && children[index].props.children) children[index].props.children.unshift(BDFDB.ReactUtils.createElement(TranslateButtonComponent, {
channelId: e.instance.props.channel.id channelId: e.instance.props.channel.id