This commit is contained in:
Mirco Wittrien 2022-02-28 21:05:45 +01:00
parent 422f4c9806
commit e3b2f380bd
6 changed files with 130 additions and 104 deletions

View File

@ -2,7 +2,7 @@
* @name BDFDB
* @author DevilBro
* @authorId 278543574059057154
* @version 2.2.1
* @version 2.2.2
* @description Required Library for DevilBro's Plugins
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -19,7 +19,7 @@ module.exports = (_ => {
"info": {
"name": "BDFDB",
"author": "DevilBro",
"version": "2.2.1",
"version": "2.2.2",
"description": "Required Library for DevilBro's Plugins"
},
"rawUrl": `https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js`
@ -6589,7 +6589,7 @@ module.exports = (_ => {
render() {
let value = this.props.state && this.props.state.value || 0;
return BDFDB.ReactUtils.createElement(Internal.NativeSubComponents.MenuControlItem, BDFDB.ObjectUtils.exclude(Object.assign({}, this.props, {
label: typeof this.props.renderLabel == "function" ? this.props.renderLabel(Math.round(value * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits)) : this.props.label,
label: typeof this.props.renderLabel == "function" ? this.props.renderLabel(Math.round(value * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits), this) : this.props.label,
control: (menuItemProps, ref) => {
return BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.menuslidercontainer,
@ -7204,7 +7204,7 @@ module.exports = (_ => {
children: [
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.settingstablecardlabel,
children: this.props.renderLabel(props)
children: this.props.renderLabel(props, this)
}),
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.settingstablecardconfigs,
@ -8362,12 +8362,12 @@ module.exports = (_ => {
Internal.patchContextMenu = function (plugin, type, module) {
if (!module || !module.default) return;
plugin = plugin == BDFDB && Internal || plugin;
const caller = `on${InternalData.ModuleUtilsConfig.ContextMenuTypesMap[type] || type}`;
if (!InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[type]) {
const mappedType = InternalData.ModuleUtilsConfig.ContextMenuTypesMap[type] || type;
if (!InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[mappedType]) {
const call = (args, props, returnValue, name) => {
if (!returnValue || !returnValue.props || !returnValue.props.children || returnValue.props.children.__BDFDBPatchesCalled && returnValue.props.children.__BDFDBPatchesCalled[plugin.name]) return;
returnValue.props.children.__BDFDBPatchesCalled = Object.assign({}, returnValue.props.children.__BDFDBPatchesCalled, {[plugin.name]: true});
return plugin[caller]({
return plugin[`on${mappedType}`]({
arguments: args,
instance: {props: props},
returnvalue: returnValue,
@ -8377,7 +8377,7 @@ module.exports = (_ => {
});
};
BDFDB.PatchUtils.patch(plugin, module, "default", {after: e => {
if (typeof plugin[caller] != "function") return;
if (typeof plugin[`on${mappedType}`] != "function") return;
else if (e.returnValue && e.returnValue.props.children !== undefined) {
if (e.returnValue.props.navId) {
e.returnValue.props.children = [e.returnValue.props.children].flat(10);
@ -8400,22 +8400,30 @@ module.exports = (_ => {
}
}
else BDFDB.PatchUtils.patch(plugin, e.returnValue, "type", {after: e2 => {
if (e2.returnValue && typeof plugin[caller] == "function") call(e2.methodArguments, e2.methodArguments[0], e2.returnValue, module.default.displayName);
if (e2.returnValue && typeof plugin[`on${mappedType}`] == "function") call(e2.methodArguments, e2.methodArguments[0], e2.returnValue, module.default.displayName);
}}, {noCache: true});
}}, {name: type});
}
else {
const getProps = (props, key) => {
const store = `${Internal.LibraryModules.StringUtils.upperCaseFirstChar(key)}Store`;
const getter = `get${Internal.LibraryModules.StringUtils.upperCaseFirstChar(key)}`;
return Object.assign({}, BDFDB.ObjectUtils.is(props) ? props : typeof props == "string" ? {id: props} : {}, {[key]: (props && props[key] || Internal.LibraryModules[store] && typeof Internal.LibraryModules[store][getter] == "function" && Internal.LibraryModules[store][getter](props && props.id || props))});
const getProps = (props, keys) => {
let newProps = Object.assign({}, BDFDB.ObjectUtils.is(props) ? props : typeof props == "string" ? {id: props} : {});
for (const key of [keys].flat(10).filter(n => n)) {
const store = `${Internal.LibraryModules.StringUtils.upperCaseFirstChar(key)}Store`;
const getter = `get${Internal.LibraryModules.StringUtils.upperCaseFirstChar(key)}`;
const value = props && props[key] || Internal.LibraryModules[store] && typeof Internal.LibraryModules[store][getter] == "function" && Internal.LibraryModules[store][getter](props && props.id || props);
if (value) {
newProps = Object.assign(newProps, {[key]: value});
break;
}
}
return newProps;
};
BDFDB.PatchUtils.patch(plugin, module, "default", {after: e => {
if (typeof plugin[caller] != "function") return;
if (typeof plugin[`on${mappedType}`] != "function") return;
e.returnValue = [e.returnValue].flat(10).filter(n => n);
return plugin[caller]({
return plugin[`on${mappedType}`]({
arguments: e.methodArguments,
instance: {props: InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[type].key && getProps(e.methodArguments[0], InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[type].key) || e.methodArguments[0]},
instance: {props: InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[mappedType].keys && getProps(e.methodArguments[0], InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[mappedType].keys) || e.methodArguments[0]},
returnvalue: e.returnValue,
component: module,
methodname: "default",
@ -8458,10 +8466,8 @@ module.exports = (_ => {
const returnValue = exports.default({});
if (returnValue && returnValue.props && returnValue.props.object == BDFDB.DiscordConstants.AnalyticsObjects.CONTEXT_MENU) {
for (const type in PluginStores.contextChunkObserver) {
const name = PluginStores.contextChunkObserver[type].filter(returnValue.props.children.type);
if (name) {
exports.__BDFDB_ContextMenu_Patch_Name = name;
exports.__BDFDB_ContextMenuWrapper_Patch_Name = name;
if (PluginStores.contextChunkObserver[type].filter(returnValue.props.children)) {
exports.__BDFDB_ContextMenuWrapper_Patch_Name = exports.__BDFDB_ContextMenu_Patch_Name;
found = true;
if (PluginStores.contextChunkObserver[type].modules.indexOf(exports) == -1) PluginStores.contextChunkObserver[type].modules.push(exports);
for (const plugin of PluginStores.contextChunkObserver[type].query) Internal.patchContextMenu(plugin, type, exports);
@ -8471,9 +8477,7 @@ module.exports = (_ => {
}
}
if (!found) for (const type in PluginStores.contextChunkObserver) {
const name = PluginStores.contextChunkObserver[type].filter(exports.default);
if (name) {
exports.__BDFDB_ContextMenu_Patch_Name = name;
if (PluginStores.contextChunkObserver[type].filter(exports)) {
if (PluginStores.contextChunkObserver[type].modules.indexOf(exports) == -1) PluginStores.contextChunkObserver[type].modules.push(exports);
for (const plugin of PluginStores.contextChunkObserver[type].query) Internal.patchContextMenu(plugin, type, exports);
break;
@ -8513,10 +8517,36 @@ module.exports = (_ => {
if (InternalData.ModuleUtilsConfig.ContextMenuTypes) for (let type of InternalData.ModuleUtilsConfig.ContextMenuTypes) {
type = `${type}ContextMenu`;
if (!PluginStores.contextChunkObserver[type]) {
const mappedType = InternalData.ModuleUtilsConfig.ContextMenuTypesMap[type] || type;
PluginStores.contextChunkObserver[type] = {query: [], modules: []};
if (!InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[type]) PluginStores.contextChunkObserver[type].filter = m => m && (m.displayName && m.displayName.endsWith("ContextMenu") && `${InternalData.ModuleUtilsConfig.ContextMenuTypes.find(t => m.displayName.indexOf(t) > -1)}ContextMenu` == type || m.__BDFDB_ContextMenuWrapper_Patch_Name && m.__BDFDB_ContextMenuWrapper_Patch_Name.endsWith("ContextMenu") && `${InternalData.ModuleUtilsConfig.ContextMenuTypes.find(t => m.__BDFDB_ContextMenuWrapper_Patch_Name.indexOf(t) > -1)}ContextMenu` == type) && type;
else PluginStores.contextChunkObserver[type].filter = m => m && (m.displayName && InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[type].items.indexOf(m.displayName) > -1 && m.displayName || InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[type].items.find(item => InternalData.ModuleUtilsConfig.Finder[item] && InternalData.ModuleUtilsConfig.Finder[item].strings && Internal.hasModuleStrings(m, InternalData.ModuleUtilsConfig.Finder[item].strings)));
PluginStores.contextChunkObserver[type].modules = BDFDB.ModuleUtils.find(PluginStores.contextChunkObserver[type].filter, {all: true});
if (!InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[mappedType]) PluginStores.contextChunkObserver[type].filter = m => {
if (!m || !(m.default || m.type)) return;
const d = m.default || m.type;
if (d.displayName && d.displayName.endsWith("ContextMenu") && `${InternalData.ModuleUtilsConfig.ContextMenuTypes.find(t => d.displayName.indexOf(t) > -1)}ContextMenu` == type) {
m.__BDFDB_ContextMenu_Patch_Name = type;
return true;
}
else if (m.__BDFDB_ContextMenuWrapper_Patch_Name && m.__BDFDB_ContextMenuWrapper_Patch_Name.endsWith("ContextMenu") && `${InternalData.ModuleUtilsConfig.ContextMenuTypes.find(t => m.__BDFDB_ContextMenuWrapper_Patch_Name.indexOf(t) > -1)}ContextMenu` == type) {
m.__BDFDB_ContextMenu_Patch_Name = type;
return true;
}
};
else PluginStores.contextChunkObserver[type].filter = m => {
if (!m || !(m.default || m.type)) return;
const d = m.default || m.type;
if (d.displayName && InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[mappedType].items.indexOf(d.displayName) > -1) {
m.__BDFDB_ContextMenu_Patch_Name = d.displayName;
return true;
}
else {
const subType = InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[mappedType].items.find(item => InternalData.ModuleUtilsConfig.Finder[item] && InternalData.ModuleUtilsConfig.Finder[item].strings && Internal.hasModuleStrings(d, InternalData.ModuleUtilsConfig.Finder[item].strings));
if (subType) {
m.__BDFDB_ContextMenu_Patch_Name = subType;
return true;
}
}
};
PluginStores.contextChunkObserver[type].modules = BDFDB.ModuleUtils.find(PluginStores.contextChunkObserver[type].filter, {useExport: false, all: true}).map(m => m.exports).filter(n => n);
}
}

View File

@ -2,7 +2,7 @@
* @name EditUsers
* @author DevilBro
* @authorId 278543574059057154
* @version 4.5.2
* @version 4.5.3
* @description Allows you to locally edit Users
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,13 +17,8 @@ module.exports = (_ => {
"info": {
"name": "EditUsers",
"author": "DevilBro",
"version": "4.5.2",
"version": "4.5.3",
"description": "Allows you to locally edit Users"
},
"changeLog": {
"fixed": {
"PlatformIndicators": "Fixed Plugin Issue with PlatformIndicators that broke Features in the DM List"
}
}
};
@ -387,6 +382,18 @@ module.exports = (_ => {
}
onUserContextMenu (e) {
if (e.instance.props.channel && e.instance.props.channel.isDM()) {
const user = BDFDB.LibraryModules.UserStore.getUser(e.instance.props.channel.getRecipientId());
if (user && this.settings.places.contextMenu && e.subType == "useMuteChannelItem") {
let userName = this.getUserData(user.id).username;
if (userName != user.username) {
let [muteChildren, muteIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "mute-channel"});
if (muteIndex > -1) muteChildren[muteIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("MUTE_CHANNEL", `@${userName}`);
let [unmuteChildren, unmuteIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "unmute-channel"});
if (unmuteIndex > -1) unmuteChildren[unmuteIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("UNMUTE_CHANNEL", `@${userName}`);
}
}
}
if (e.instance.props.user) {
if (this.settings.places.contextMenu && e.subType == "useUserManagementItems") {
let userName = this.getUserData(e.instance.props.user.id).username;
@ -401,7 +408,7 @@ module.exports = (_ => {
if (banIndex > -1) banChildren[banIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("BAN_USER", userName);
}
}
if (e.subType == "useUserRolesItems") {
if (e.subType == "useBlockUserItem") {
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
e.returnvalue.push(this.createContextMenuEntry(e.instance.props.user));
}

View File

@ -2,7 +2,7 @@
* @name ImageUtilities
* @author DevilBro
* @authorId 278543574059057154
* @version 4.5.9
* @version 4.6.0
* @description Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "ImageUtilities",
"author": "DevilBro",
"version": "4.5.9",
"version": "4.6.0",
"description": "Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)"
}
};
@ -220,6 +220,9 @@ module.exports = (_ => {
white-space: nowrap;
}
${BDFDB.dotCN._imageutilitiesimagedetails} > a {
max-width: 300px;
}
span + ${BDFDB.dotCN._imageutilitiesimagedetails} > a {
max-width: 200px;
}
${BDFDB.dotCN._imageutilitiesimagedetails} > span {
@ -306,21 +309,12 @@ module.exports = (_ => {
});
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.MediaComponentUtils, "renderImageComponent", {
before: e => {
if (this.settings.general.showInDescription && e.methodArguments[0].original && e.methodArguments[0].src.indexOf("https://media.discordapp.net/attachments") == 0 && (e.methodArguments[0].className || "").indexOf(BDFDB.disCN.embedmedia) == -1 && (e.methodArguments[0].className || "").indexOf(BDFDB.disCN.embedthumbnail) == -1 && BDFDB.ReactUtils.findChild(e.returnValue, {name: ["LazyImageZoomable", "LazyImage"]})) {
e.thisObject.props.alt = e.thisObject.props.alt || "__BDFDB__PLACEHOLDER__";
e.thisObject.props.injectDescription = true;
}
},
after: e => {
if (e.thisObject.props.injectDescription) {
let altText = BDFDB.ReactUtils.findChild(e.returnValue, {props: [["className", BDFDB.disCN.imagealttext]]});
if (!altText) return;
altText.props.children = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
if (this.settings.general.showInDescription && e.methodArguments[0].original && e.methodArguments[0].src.indexOf("https://media.discordapp.net/attachments") == 0 && (e.methodArguments[0].className || "").indexOf(BDFDB.disCN.embedmedia) == -1 && (e.methodArguments[0].className || "").indexOf(BDFDB.disCN.embedthumbnail) == -1 && BDFDB.ReactUtils.findChild(e.returnValue, {name: ["LazyImageZoomable", "LazyImage"]})) {
e.returnValue.props.children[1] = BDFDB.ReactUtils.createElement("span", {
className: BDFDB.disCN.imagealttext,
children: [
altText.props.children == "__BDFDB__PLACEHOLDER__" ? null : BDFDB.ReactUtils.createElement("span", {
children: altText.props.children
}),
e.returnValue.props.children[1],
BDFDB.ReactUtils.createElement(ImageDetailsComponent, {
original: e.methodArguments[0].original,
attachment: {
@ -545,13 +539,9 @@ module.exports = (_ => {
}
}
onDMContextMenu (e) {
if (e.instance.props.user && this.settings.places.userAvatars) this.injectItem(e, (e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096) || "").replace(/\.webp|\.gif/, ".png"), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.avatar) && e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096, true));
}
onUserContextMenu (e) {
if (e.instance.props.user && this.settings.places.userAvatars && e.subType == "useUserRolesItems") {
let validUrls = this.filterUrls((e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096) || "").replace(/\.webp|\.gif/, ".png"), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.avatar) && e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096, true));
if (e.instance.props.user && this.settings.places.userAvatars && e.subType == "useBlockUserItem") {
let validUrls = this.filterUrls((e.instance.props.user.getAvatarURL(null, 4096) || "").replace(/\.webp|\.gif/, ".png"), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.avatar) && e.instance.props.user.getAvatarURL(null, 4096, true), (e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096) || "").replace(/\.webp|\.gif/, ".png"), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.avatar) && e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096, true));
if (!validUrls.length) return;
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
@ -568,9 +558,7 @@ module.exports = (_ => {
}
onNativeContextMenu (e) {
if (e.type == "NativeImageContextMenu" && (e.instance.props.href || e.instance.props.src)) {
this.injectItem(e, e.instance.props.href || e.instance.props.src);
}
if (e.type == "NativeImageContextMenu" && (e.instance.props.href || e.instance.props.src)) this.injectItem(e, e.instance.props.href || e.instance.props.src);
}
onMessageContextMenu (e) {
@ -651,7 +639,19 @@ module.exports = (_ => {
createSubMenus (instance, validUrls) {
return validUrls.length == 1 ? this.createUrlMenu(instance, validUrls[0]) : validUrls.map((urlData, i) => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: urlData.fileType.toUpperCase(),
label: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.AvatarComponents.default, {
src: urlData.src || urlData.file,
size: BDFDB.LibraryComponents.AvatarComponents.Sizes.SIZE_40
}),
BDFDB.ReactUtils.createElement("span", {
style: {marginLeft: 12},
children: urlData.fileType.toUpperCase()
})
]
}),
id: BDFDB.ContextMenuUtils.createItemId(this.name, "subitem", i),
children: this.createUrlMenu(instance, urlData)
}));
@ -696,7 +696,6 @@ module.exports = (_ => {
label: this.labels.context_view.replace("{{var0}}", type),
id: BDFDB.ContextMenuUtils.createItemId(this.name, "view-file"),
action: _ => {
console.log(urlData);
let img = document.createElement(isVideo ? "video" : "img");
img.addEventListener(isVideo ? "loadedmetadata" : "load", function() {
BDFDB.LibraryModules.ModalUtils.openModal(modalData => {
@ -781,7 +780,6 @@ module.exports = (_ => {
if (clickedImage) e.instance.props.cachedImage = clickedImage;
let url = this.getImageSrc(e.instance.props.cachedImage && e.instance.props.cachedImage.src ? e.instance.props.cachedImage : e.instance.props.src);
url = this.getImageSrc(typeof e.instance.props.children == "function" && e.instance.props.children(Object.assign({}, e.instance.props, {size: e.instance.props})).props.src) || url;
console.log(url);
let isVideo = this.isValid(url, "video");
let messages = this.getMessageGroupOfImage(url);
if (e.returnvalue) {
@ -793,12 +791,28 @@ module.exports = (_ => {
children: Object.keys(this.defaults.zoomSettings).map(type => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSliderItem, Object.assign({
id: BDFDB.ContextMenuUtils.createItemId(this.name, type),
value: this.settings.zoomSettings[type],
renderLabel: value => {
return (this.labels[this.defaults.zoomSettings[type].label] || BDFDB.LanguageUtils.LanguageStrings[this.defaults.zoomSettings[type].label]) + ": " + value + this.defaults.zoomSettings[type].unit;
},
onValueRender: value => {
return value + this.defaults.zoomSettings[type].unit;
},
renderLabel: (value, instance) => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
children: `${this.labels[this.defaults.zoomSettings[type].label] || BDFDB.LanguageUtils.LanguageStrings[this.defaults.zoomSettings[type].label]}:`
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
type: "number",
size: BDFDB.LibraryComponents.TextInput.Sizes.MINI,
style: {width: 70},
min: 1,
max: this.defaults.zoomSettings[type].maxValue,
value: this.settings.zoomSettings[type],
onChange: value => value && value >= this.defaults.zoomSettings[type].minValue && instance.handleValueChange(BDFDB.NumberUtils.mapRange([this.defaults.zoomSettings[type].minValue, this.defaults.zoomSettings[type].maxValue], [0, 100], value))
}),
BDFDB.ReactUtils.createElement("span", {
style: {width: 20},
children: this.defaults.zoomSettings[type].unit
})
]
}),
onValueRender: value => `${value}${this.defaults.zoomSettings[type].unit}`,
onValueChange: value => {
this.settings.zoomSettings[type] = value;
BDFDB.DataUtils.save(this.settings.zoomSettings, this, "zoomSettings");
@ -880,7 +894,6 @@ module.exports = (_ => {
else this.loadImage(e.instance, data.next, "next");
}
}
console.log(e);
if (this.settings.general.addDetails) e.returnvalue.props.children.push(BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN._imageutilitiesdetailswrapper,
children: [

View File

@ -2,7 +2,7 @@
* @name PinDMs
* @author DevilBro
* @authorId 278543574059057154
* @version 1.8.9
* @version 1.9.0
* @description Allows you to pin DMs, making them appear at the top of your DMs/ServerList
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,13 +17,8 @@ module.exports = (_ => {
"info": {
"name": "PinDMs",
"author": "DevilBro",
"version": "1.8.9",
"version": "1.9.0",
"description": "Allows you to pin DMs, making them appear at the top of your DMs/ServerList"
},
"changeLog": {
"fixed": {
"PlatformIndicators": "Fixed Plugin Issue with PlatformIndicators that broke Features in the DM List"
}
}
};
@ -257,31 +252,25 @@ module.exports = (_ => {
BDFDB.DiscordUtils.rerenderAll();
}
onDMContextMenu (e) {
if (e.instance.props.user) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "close-dm"});
if (index > -1) {
let id = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(e.instance.props.user.id);
if (id) this.injectItem(e.instance, id, children, index);
}
}
onUserContextMenu (e) {
if (e.instance.props.channel && e.subType == "useCloseDMItem") e.returnvalue.unshift(this.createItem(e.instance.props.channel.id));
}
onGroupDMContextMenu (e) {
if (e.instance.props.channel) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "change-icon"});
if (index > -1) this.injectItem(e.instance, e.instance.props.channel.id, children, index + 1);
if (index > -1) children.splice(index + 1, 0, this.createItem(e.instance.props.channel.id));
}
}
injectItem (instance, id, children, index) {
createItem (id) {
if (!id) return;
let pinnedInGuild = this.isPinnedInGuilds(id);
let categories = this.sortAndUpdateCategories("channelList", true);
let currentCategory = this.getChannelListCategory(id);
children.splice(index, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
return BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_pindm,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "submenu-pin"),
children: [
@ -339,7 +328,7 @@ module.exports = (_ => {
}
})
].filter(n => n)
}));
});
}
processPrivateChannelsList (e) {

View File

@ -124,7 +124,7 @@ module.exports = (_ => {
label: [
BDFDB.ReactUtils.createElement("span", {
className: BDFDB.disCN.username,
children: this.props.user.username,
children: this.props.user.nick || this.props.user.username,
style: {color: this.props.user.colorString}
}),
!this.props.user.discriminator ? null : BDFDB.ReactUtils.createElement("span", {

View File

@ -2,7 +2,7 @@
* @name UserNotes
* @author DevilBro
* @authorId 278543574059057154
* @version 1.0.8
* @version 1.0.9
* @description Allows you to write User Notes locally
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "UserNotes",
"author": "DevilBro",
"version": "1.0.8",
"version": "1.0.9",
"description": "Allows you to write User Notes locally"
}
};
@ -92,21 +92,8 @@ module.exports = (_ => {
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
}
onDMContextMenu (e) {
if (e.instance.props.user) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.user_note,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "user-note"),
action: _ => this.openNotesModal(e.instance.props.user)
})
}));
}
}
onUserContextMenu (e) {
if (e.instance.props.user && e.subType == "useUserRolesItems") {
if (e.instance.props.user && e.subType == "useBlockUserItem") {
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.user_note,