stuff
This commit is contained in:
parent
a96451a577
commit
af58c59b83
|
@ -5,8 +5,13 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "EditChannels",
|
||||
"author": "DevilBro",
|
||||
"version": "4.1.6",
|
||||
"version": "4.1.7",
|
||||
"description": "Allows you to rename and recolor channelnames."
|
||||
},
|
||||
"changeLog": {
|
||||
"fixed": {
|
||||
"Autocomplete Menu": "Works again"
|
||||
}
|
||||
}
|
||||
};
|
||||
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
|
||||
|
@ -92,6 +97,24 @@ module.exports = (_ => {
|
|||
let observer = new MutationObserver(_ => {this.changeAppTitle();});
|
||||
BDFDB.ObserverUtils.connect(this, document.head.querySelector("title"), {name:"appTitleObserver",instance:observer}, {childList:true});
|
||||
|
||||
if (BDFDB.LibraryModules.AutocompleteOptions && BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS) BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS.CHANNELS, "queryResults", {after: e => {
|
||||
let channelArray = [];
|
||||
for (let id in changedChannels) if (changedChannels[id] && changedChannels[id].name) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(id);
|
||||
let category = channel && channel.parent_id && BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id);
|
||||
let catData = category && changedChannels[category.id] || {};
|
||||
if (BDFDB.ChannelUtils.isTextChannel(channel) && channel.guild_id == e.methodArguments[0].guild_id) channelArray.push(Object.assign({
|
||||
lowerCaseName: changedChannels[id].name.toLowerCase(),
|
||||
lowerCaseCatName: catData && catData.name && catData.name.toLowerCase(),
|
||||
channel,
|
||||
category,
|
||||
catData
|
||||
}, changedChannels[id]));
|
||||
}
|
||||
channelArray = BDFDB.ArrayUtils.keySort(channelArray.filter(n => e.returnValue.channels.every(channel => channel.id != n.channel.id) && (n.lowerCaseName.indexOf(e.methodArguments[1]) != -1 || (n.lowerCaseCatName && n.lowerCaseCatName.indexOf(e.methodArguments[1]) != -1))), "lowerCaseName");
|
||||
e.returnValue.channels = [].concat(e.returnValue.channels, channelArray.map(n => n.channel)).slice(0, BDFDB.DiscordConstants.MAX_AUTOCOMPLETE_RESULTS);
|
||||
}});
|
||||
|
||||
this.forceUpdateAll();
|
||||
}
|
||||
|
||||
|
@ -194,28 +217,6 @@ module.exports = (_ => {
|
|||
}
|
||||
}
|
||||
|
||||
processChannelAutoComplete (e) {
|
||||
if (e.instance.state.autocompleteType == "CHANNELS" && BDFDB.ArrayUtils.is(e.instance.state.autocompletes.channels) && e.instance.props.channel && e.instance.props.channel.guild_id) {
|
||||
let lastWord = (e.instance.props.textValue || "").slice(1).toLowerCase();
|
||||
if (!lastWord) return;
|
||||
let channelArray = [];
|
||||
for (let id in changedChannels) if (changedChannels[id] && changedChannels[id].name) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(id);
|
||||
let category = channel && channel.parent_id && BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id);
|
||||
let catdata = category && changedChannels[category.id] || {};
|
||||
if (BDFDB.ChannelUtils.isTextChannel(channel) && channel.guild_id == e.instance.props.channel.guild_id) channelArray.push(Object.assign({
|
||||
lowerCaseName: changedChannels[id].name.toLowerCase(),
|
||||
lowerCaseCatName: catdata && catdata.name && catdata.name.toLowerCase(),
|
||||
channel,
|
||||
category,
|
||||
catdata
|
||||
}, changedChannels[id]));
|
||||
}
|
||||
channelArray = BDFDB.ArrayUtils.keySort(channelArray.filter(n => e.instance.state.autocompletes.channels.every(channel => channel.id != n.channel.id) && (n.lowerCaseName.indexOf(lastWord) != -1 || (n.lowerCaseCatName && n.lowerCaseCatName.indexOf(lastWord) != -1))), "lowerCaseName");
|
||||
e.instance.state.autocompletes.channels = [].concat(e.instance.state.autocompletes.channels, channelArray.map(n => n.channel)).slice(0, BDFDB.DiscordConstants.MAX_AUTOCOMPLETE_RESULTS);
|
||||
}
|
||||
}
|
||||
|
||||
processAutocompleteChannelResult (e) {
|
||||
if (e.instance.props.channel && settings.changeInAutoComplete) {
|
||||
if (!e.returnvalue) {
|
||||
|
|
|
@ -5,8 +5,13 @@ module.exports = (_ => {
|
|||
"info": {
|
||||
"name": "EditUsers",
|
||||
"author": "DevilBro",
|
||||
"version": "3.9.5",
|
||||
"version": "3.9.6",
|
||||
"description": "Allows you to change the icon, name, tag and color of users."
|
||||
},
|
||||
"changeLog": {
|
||||
"fixed": {
|
||||
"Autocomplete Menu": "Works again"
|
||||
}
|
||||
}
|
||||
};
|
||||
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
|
||||
|
@ -178,6 +183,18 @@ module.exports = (_ => {
|
|||
}
|
||||
}});
|
||||
}
|
||||
if (BDFDB.LibraryModules.AutocompleteOptions && BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS) BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS.MENTIONS, "queryResults", {after: e => {
|
||||
let userArray = [];
|
||||
for (let id in changedUsers) if (changedUsers[id] && changedUsers[id].name) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
||||
if (user && (e.methodArguments[0].recipients.includes(id) || (e.methodArguments[0].guild_id && BDFDB.LibraryModules.MemberStore.getMember(e.methodArguments[0].guild_id, id)))) userArray.push(Object.assign({
|
||||
lowerCaseName: changedUsers[id].name.toLowerCase(),
|
||||
user
|
||||
}, changedUsers[id]));
|
||||
}
|
||||
userArray = BDFDB.ArrayUtils.keySort(userArray.filter(n => e.returnValue.users.every(comp => comp.user.id != n.user.id) && n.lowerCaseName.indexOf(e.methodArguments[1]) != -1), "lowerCaseName");
|
||||
e.returnValue.users = [].concat(e.returnValue.users, userArray.map(n => {return {user: n.user};})).slice(0, BDFDB.DiscordConstants.MAX_AUTOCOMPLETE_RESULTS);
|
||||
}});
|
||||
|
||||
this.forceUpdateAll();
|
||||
}
|
||||
|
@ -187,7 +204,7 @@ module.exports = (_ => {
|
|||
}
|
||||
|
||||
getSettingsPanel (collapseStates = {}) {
|
||||
let settingsPanel, settingsItems = [], innerItems = [];
|
||||
let settingsPanel, settingsItems = [];
|
||||
|
||||
for (let key in settings) if (!this.defaults.settings[key].inner) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
||||
className: BDFDB.disCN.marginbottom8,
|
||||
|
@ -294,23 +311,6 @@ module.exports = (_ => {
|
|||
}
|
||||
}
|
||||
|
||||
processChannelAutoComplete (e) {
|
||||
if (e.instance.state.autocompleteType == "MENTIONS" && BDFDB.ArrayUtils.is(e.instance.state.autocompletes.users) && e.instance.props.channel) {
|
||||
let lastWord = (e.instance.props.textValue || "").slice(1).toLowerCase();
|
||||
if (!lastWord) return;
|
||||
let userArray = [];
|
||||
for (let id in changedUsers) if (changedUsers[id] && changedUsers[id].name) {
|
||||
let user = BDFDB.LibraryModules.UserStore.getUser(id);
|
||||
if (user && (e.instance.props.channel.recipients.includes(id) || (e.instance.props.channel.guild_id && BDFDB.LibraryModules.MemberStore.getMember(e.instance.props.channel.guild_id, id)))) userArray.push(Object.assign({
|
||||
lowerCaseName: changedUsers[id].name.toLowerCase(),
|
||||
user
|
||||
}, changedUsers[id]));
|
||||
}
|
||||
userArray = BDFDB.ArrayUtils.keySort(userArray.filter(n => e.instance.state.autocompletes.users.every(comp => comp.user.id != n.user.id) && n.lowerCaseName.indexOf(lastWord) != -1), "lowerCaseName");
|
||||
e.instance.state.autocompletes.users = [].concat(e.instance.state.autocompletes.users, userArray.map(n => {return {user: n.user};})).slice(0, BDFDB.DiscordConstants.MAX_AUTOCOMPLETE_RESULTS);
|
||||
}
|
||||
}
|
||||
|
||||
processAutocompleteUserResult (e) {
|
||||
if (e.instance.props.user && settings.changeInAutoComplete) {
|
||||
if (!e.returnvalue) {
|
||||
|
|
Loading…
Reference in New Issue