From 76cdad921b688fcb9436b669c9184c679d5e6a1b Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Mon, 22 Aug 2022 22:43:09 +0200 Subject: [PATCH] stuff --- Plugins/ChatAliases/ChatAliases.plugin.js | 15 +++++++++------ Plugins/EditChannels/EditChannels.plugin.js | 15 ++++++++++++++- Plugins/ThemeRepo/ThemeRepo.plugin.js | 1 - 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Plugins/ChatAliases/ChatAliases.plugin.js b/Plugins/ChatAliases/ChatAliases.plugin.js index c63e49df50..8135bf090f 100644 --- a/Plugins/ChatAliases/ChatAliases.plugin.js +++ b/Plugins/ChatAliases/ChatAliases.plugin.js @@ -2,7 +2,7 @@ * @name ChatAliases * @author DevilBro * @authorId 278543574059057154 - * @version 2.4.1 + * @version 2.4.2 * @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.4.1", + "version": "2.4.2", "description": "Allows you to configure your own Aliases/Commands" } }; @@ -114,9 +114,11 @@ module.exports = (_ => { if (BDFDB.LibraryModules.AutocompleteOptions && BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_PRIORITY) BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_PRIORITY.unshift(AUTOCOMPLETE_ALIAS_OPTION); if (BDFDB.LibraryModules.AutocompleteOptions && BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS) { + let query = ""; BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS[AUTOCOMPLETE_ALIAS_OPTION] = { autoSelect: true, - matches: (channel, guild, query, _, options) => { + matches: (channel, guild, newQuery, _, options) => { + query = newQuery; if (query.length >= this.settings.amounts.minAliasLength) for (let word in aliases) { let aliasData = aliases[word]; if (!aliasData.regex && aliasData.autoc) { @@ -132,7 +134,7 @@ module.exports = (_ => { } return false; }, - queryResults: (channel, guild, query, options) => { + queryResults: (channel, guild, newQuery, options) => { if (query == commandSentinel) return; let matches = []; for (let word in aliases) { @@ -149,6 +151,7 @@ module.exports = (_ => { } } if (matches.length) return {results: {aliases: matches}}; + else return {results: {}}; }, renderResults: data => { return data && data.results && data.results.aliases && [ @@ -156,7 +159,7 @@ module.exports = (_ => { title: [ "Aliases: ", BDFDB.ReactUtils.createElement("strong", { - children: data.query + children: query }) ] }), @@ -174,7 +177,7 @@ module.exports = (_ => { onSelect: data => { if (data.results.aliases[data.index].word.indexOf(" ") > -1) { let textValue = BDFDB.ReactUtils.findValue(BDFDB.DOMUtils.getParent(BDFDB.dotCN.textareawrapall, document.activeElement) || document.querySelector(BDFDB.dotCN.textareawrapall), "textValue"); - if (textValue) data.options.replaceText(textValue.replace(new RegExp(BDFDB.StringUtils.regEscape(data.results.aliases[data.index].word), "g"), BDFDB.StringUtils.insertNRST(data.results.aliases[data.index].replace))); + if (textValue) data.options.replaceText(textValue.replace(new RegExp(BDFDB.StringUtils.regEscape(data.results.aliases[data.index].word), data.results.aliases[data.index].case ? "gi" : "g"), BDFDB.StringUtils.insertNRST(data.results.aliases[data.index].replace))); } else data.options.insertText(BDFDB.StringUtils.insertNRST(data.results.aliases[data.index].replace)); return {}; diff --git a/Plugins/EditChannels/EditChannels.plugin.js b/Plugins/EditChannels/EditChannels.plugin.js index 22edb59de9..60540f0a35 100644 --- a/Plugins/EditChannels/EditChannels.plugin.js +++ b/Plugins/EditChannels/EditChannels.plugin.js @@ -294,7 +294,20 @@ module.exports = (_ => { } processAutocompleteChannelResult (e) { - console.log(e); + if (e.instance.props.channel && this.settings.places.autocompletes) { + if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id); + else { + if (typeof e.returnvalue.props.children == "function") { + let childrenRender = e.returnvalue.props.children; + e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => { + let children = childrenRender(...args); + let channelName = BDFDB.ReactUtils.findChild(children, {name: "AutocompleteRowHeading"}); + if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id); + return children; + }, "Error in Children Render of AutocompleteChannelResult!", this); + } + } + } } processGuildSettingsAuditLogEntry (e) { diff --git a/Plugins/ThemeRepo/ThemeRepo.plugin.js b/Plugins/ThemeRepo/ThemeRepo.plugin.js index cde45eb1b8..0be609b0b8 100644 --- a/Plugins/ThemeRepo/ThemeRepo.plugin.js +++ b/Plugins/ThemeRepo/ThemeRepo.plugin.js @@ -684,7 +684,6 @@ module.exports = (_ => { onMouseLeave: this.props.data.thumbnailGifUrl && (e => e.target.src = this.props.data.thumbnailUrl), onClick: _ => { const url = this.props.data.thumbnailGifUrl || this.props.data.thumbnailUrl; - console.log(this.props.data); const img = document.createElement("img"); img.addEventListener("load", function() { BDFDB.LibraryModules.ModalUtils.openModal(modalData => {