stuff
This commit is contained in:
parent
2d014c581a
commit
3063605591
|
@ -2,7 +2,7 @@
|
|||
* @name BDFDB
|
||||
* @author DevilBro
|
||||
* @authorId 278543574059057154
|
||||
* @version 3.4.7
|
||||
* @version 3.4.8
|
||||
* @description Required Library for DevilBro's Plugins
|
||||
* @invite Jx3TjNS
|
||||
* @donate https://www.paypal.me/MircoWittrien
|
||||
|
@ -337,6 +337,11 @@ module.exports = (_ => {
|
|||
}
|
||||
return found;
|
||||
};
|
||||
BDFDB.ObjectUtils.invert = function (obj) {
|
||||
let newObj = {};
|
||||
if (BDFDB.ObjectUtils.is(obj)) for (let entry of Object.entries(obj)) newObj[entry[1]] = entry[0];
|
||||
return newObj;
|
||||
};
|
||||
BDFDB.ObjectUtils.extract = function (obj, ...keys) {
|
||||
let newObj = {};
|
||||
if (BDFDB.ObjectUtils.is(obj)) for (let key of keys.flat(10).filter(n => n)) if (obj[key] != null) newObj[key] = obj[key];
|
||||
|
@ -1383,9 +1388,11 @@ module.exports = (_ => {
|
|||
return BDFDB.ArrayUtils.removeCopies([firstReturn].concat(secondReturn).flat(10));
|
||||
};
|
||||
|
||||
const DiscordConstantsObject = BDFDB.ModuleUtils.findByProperties("AnalyticsSections", "ChannelTypes", "MessageTypes");
|
||||
if (InternalData.CustomDiscordConstants) DiscordConstants = Object.assign(DiscordConstants, InternalData.CustomDiscordConstants);
|
||||
if (DiscordConstantsObject) DiscordConstants = Object.assign(DiscordConstants, DiscordConstantsObject);
|
||||
Internal.DiscordConstants = new Proxy(DiscordConstants, {
|
||||
get: function (_, item) {
|
||||
if (InternalData.CustomDiscordConstants && InternalData.CustomDiscordConstants[item]) return InternalData.CustomDiscordConstants[item];
|
||||
if (DiscordConstants[item]) return DiscordConstants[item];
|
||||
if (!InternalData.DiscordConstants[item]) {
|
||||
BDFDB.LogUtils.warn([item, "Object not found in DiscordConstants"]);
|
||||
|
@ -2493,9 +2500,36 @@ module.exports = (_ => {
|
|||
});
|
||||
BDFDB.LibraryModules = Internal.LibraryModules;
|
||||
|
||||
if (Internal.LibraryModules.KeyCodeUtils && InternalData.LibraryModules.KeyCodeUtils._originalModule) InternalData.LibraryModules.KeyCodeUtils._originalModule.getString = function (keyArray) {
|
||||
return Internal.LibraryModules.KeyCodeUtils.toName([keyArray].flat(10).filter(n => n).map(keyCode => [Internal.DiscordConstants.KeyboardDeviceTypes.KEYBOARD_KEY, Internal.LibraryModules.KeyCodeUtils.keyToCode((Object.entries(Internal.LibraryModules.KeyEvents.codes).find(n => n[1] == keyCode && Internal.LibraryModules.KeyCodeUtils.keyToCode(n[0], null)) || [])[0], null) || keyCode]), true);
|
||||
};
|
||||
if (Internal.LibraryModules.KeyCodeUtils) {
|
||||
let originalModule = LibraryModules.KeyCodeUtils;
|
||||
LibraryModules.KeyCodeUtils = new Proxy(originalModule, {
|
||||
get: function (_, item) {
|
||||
if (item == "getString") return getString;
|
||||
else if (item == "_originalModule") return originalModule;
|
||||
else if (originalModule[item]) return originalModule[item];
|
||||
else return null;
|
||||
}
|
||||
});
|
||||
|
||||
let codeMap = BDFDB.ObjectUtils.invert(Internal.LibraryModules.PlatformUtils.isLinux() ? Internal.DiscordConstants.LinuxKeyToCode : Internal.LibraryModules.PlatformUtils.isMac() ? Internal.DiscordConstants.MacosKeyToCode : Internal.LibraryModules.PlatformUtils.isWindows() ? Internal.DiscordConstants.WindowsKeyToCode : {});
|
||||
let keyMap = [["META", "⌘"], ["RIGHT META", "RIGHT ⌘"], ["SHIFT", "⇧"], ["RIGHT SHIFT", "RIGHT ⇧"], ["ALT", "⌥"], ["RIGHT ALT", "RIGHT ⌥"], ["CTRL", "⌃"], ["RIGHT CTRL", "RIGHT ⌃"], ["ENTER", "↵"], ["BACKSPACE", "⌫"], ["DEL", "⌦"], ["ESC", "⎋"], ["PAGEUP", "⇞"], ["PAGEDOWN", "⇟"], ["UP", "↑"], ["DOWN", "↓"], ["LEFT", "←"], ["RIGHT", "→"], ["HOME", "↖"], ["END", "↘"], ["TAB", "⇥"], ["SPACE", "␣"]];
|
||||
let mapKeys = key => {
|
||||
let upperCaseKey = key.toUpperCase();
|
||||
for (let [name, mappedKey] of mapKeys) if (name === upperCaseKey) return mappedKey;
|
||||
return key;
|
||||
};
|
||||
const getString = function (keyArray, upperCase = true) {
|
||||
let strings = [keyArray].flat(10).filter(n => n).map(keyCode => {
|
||||
let code = Internal.LibraryModules.KeyCodeUtils.keyToCode((Object.entries(Internal.LibraryModules.KeyEvents.codes).find(n => n[1] == keyCode && Internal.LibraryModules.KeyCodeUtils.keyToCode(n[0], null)) || [])[0], null) || keyCode;
|
||||
return codeMap[code] || "UNK".concat(code)
|
||||
}).filter(n => n != null);
|
||||
if (!upperCase) return strings.join("+");
|
||||
else {
|
||||
strings = window.navigator.appVersion.indexOf("Mac OS X") != -1 ? strings.map(mapKeys) : strings;
|
||||
return strings.join(" + ").toUpperCase();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const MyReact = {};
|
||||
MyReact.childrenToArray = function (parent) {
|
||||
|
@ -2914,7 +2948,7 @@ module.exports = (_ => {
|
|||
BDFDB.ReactUtils.unmountComponentAtNode(tempNode);
|
||||
return returnValue;
|
||||
};
|
||||
BDFDB.ReactUtils = new Proxy(LibraryModules, {
|
||||
BDFDB.ReactUtils = new Proxy({}, {
|
||||
get: function (_, item) {
|
||||
if (MyReact[item]) return MyReact[item];
|
||||
else if (LibraryModules.React[item]) return LibraryModules.React[item];
|
||||
|
|
|
@ -20,13 +20,6 @@
|
|||
"User": {"props": ["addGuildAvatarHash", "isLocalBot"]}
|
||||
},
|
||||
"CustomDiscordConstants": {
|
||||
"MAX_GUILD_FOLDER_NAME_LENGTH": 32,
|
||||
"MAX_MESSAGE_LENGTH": 2000,
|
||||
"MAX_MESSAGE_LENGTH_PREMIUM": 4000,
|
||||
"MAX_MESSAGES_PER_CHANNEL": 50,
|
||||
"MAX_VIDEO_HEIGHT": 720,
|
||||
"MAX_VIDEO_WIDTH": 1280,
|
||||
"ME": "@me",
|
||||
"MenuItemColors": {
|
||||
"BRAND": "brand",
|
||||
"DANGER": "danger",
|
||||
|
@ -35,7 +28,6 @@
|
|||
"PREMIUMGRADIENT": "premiumgradient",
|
||||
"SUCCESS": "success"
|
||||
},
|
||||
"SEARCH_PAGE_SIZE": 25,
|
||||
"ToastIcons": {
|
||||
"info": "INFO",
|
||||
"danger": "CLOSE_CIRCLE",
|
||||
|
@ -76,35 +68,13 @@
|
|||
"UserPremiumLevels": {"1": 1, "2": 2, "3": 3, "4": 6, "5": 9, "6": 12, "7": 15, "8": 18, "9": 24}
|
||||
},
|
||||
"DiscordConstants": {
|
||||
"ActivityTypes": ["STREAMING", "LISTENING", "CUSTOM_STATUS"],
|
||||
"AnalyticsObjects": ["CONTEXT_MENU", "TOOLTIP", "CHANNEL"],
|
||||
"AnalyticsPages": ["AUTH", "GUILD_CHANNEL", "CUSTOM_STATUS_MODAL"],
|
||||
"AnalyticsSections": ["CHANNEL_LIST", "ACCOUNT_PANEL", "MEMBER_LIST"],
|
||||
"AutocompleterQuerySymbols": ["VOICE_CHANNEL", "TEXT_CHANNEL", "USER", "APPLICATION"],
|
||||
"AutocompleterResultTypes": ["VOICE_CHANNEL", "TEXT_CHANNEL", "USER", "LINK"],
|
||||
"ChannelTextAreaTypes": ["CREATE_FORUM_POST", "PROFILE_BIO_INPUT", "FORUM_CHANNEL_GUIDELINES"],
|
||||
"ChannelTypes": ["GUILD_TEXT", "GUILD_STORE", "DM"],
|
||||
"ChannelTypeGroups": ["GUILD_TEXTUAL", "GUILD_VOCAL", "ALL_DMS"],
|
||||
"Colors": ["SPOTIFY", "RED_100", "BLUE"],
|
||||
"ColorVariables": ["status-danger", "background-primary"],
|
||||
"ComponentActions": ["INSERT_TEXT", "TEXTAREA_FOCUS"],
|
||||
"EmojiSprites": ["DiversityPerRow", "PickerPerRow"],
|
||||
"Endpoints": ["CAPTCHA", "GUILD", "MESSAGES"],
|
||||
"FriendsSections": ["ALL", "ONLINE", "ADD_FRIEND"],
|
||||
"InboxTabs": ["MENTIONS", "UNREADS"],
|
||||
"KeyboardDeviceTypes": ["KEYBOARD_KEY", "MOUSE_BUTTON"],
|
||||
"MenuItemColors": ["BRAND", "GREEN", "PREMIUM_GRADIENT"],
|
||||
"MessageStates": ["SENT", "SENDING", "SEND_FAILED"],
|
||||
"MessageTypeGroups": ["USER_MESSAGE", "DELETABLE"],
|
||||
"MessageTypes": ["CHAT_INPUT_COMMAND", "CHANNEL_PINNED_MESSAGE"],
|
||||
"Permissions": ["ADMINISTRATOR", "MANAGE_MESSAGES", "MANAGE_ROLES", "MANAGE_GUILD_EXPRESSIONS"],
|
||||
"ReadStateTypes": ["GUILD_EVENT", "NOTIFICATION_CENTER", "CHANNEL"],
|
||||
"RelationshipTypes": ["FRIEND", "PENDING_INCOMING", "PENDING_OUTGOING"],
|
||||
"Routes": ["CHANNEL_THREAD_VIEW", "MESSAGE_REQUESTS"],
|
||||
"UserFlags": ["MFA_SMS", "VERIFIED_BOT"],
|
||||
"UserNotificationSettings": ["NULL", "NO_MESSAGES", "ALL_MESSAGES"],
|
||||
"UserSettingsActionTypes": ["SLOW_USER_ACTION", "DAILY"],
|
||||
"UserSettingsSections": ["ACCOUNT", "DEVELOPER_OPTIONS", "DISMISSIBLE_CONTENT_OPTIONS"]
|
||||
"UserSettingsActionTypes": ["SLOW_USER_ACTION", "DAILY"]
|
||||
},
|
||||
"LibraryModules": {
|
||||
"AckUtils": {"strings": ["type:\"BULK_ACK\""], "exported": false, "value": "exports", "map": {
|
||||
|
@ -167,11 +137,7 @@
|
|||
"IconUtils": {"props": ["getGuildIconURL", "getGuildBannerURL"]},
|
||||
"InviteUtils": {"props": ["acceptInvite", "createInvite"]},
|
||||
"InternalReactUtils": {"props": ["jsx", "jsxs", "Fragment"]},
|
||||
"KeyCodeUtils": {"strings": ["Unrecognized DeviceType", "GAMEPAD"], "exported": false, "value": "exports", "assign": true, "map": {
|
||||
"codeToKey": ["[\"\"+", "MACOS"],
|
||||
"keyToCode": ["Unrecognized DeviceType"],
|
||||
"toName": ["appVersion"]
|
||||
}},
|
||||
"KeyCodeUtils": {"props": ["codeToKey", "keyToCode"]},
|
||||
"KeyEvents": {"props": ["aliases", "code", "codes"]},
|
||||
"LoginUtils": {"props": ["login", "logout"]},
|
||||
"MediaComponentUtils": {"strings": ["renderAdjacentContent", "imageContent"], "exported": false, "value": "exports", "map": {
|
||||
|
@ -204,13 +170,7 @@
|
|||
}},
|
||||
"NitroUtils": {"props": ["canUseIncreasedMessageLength", "canUsePremiumGuildMemberProfile"]},
|
||||
"NotificationSettingsUtils": {"props": ["setDesktopType", "setTTSType"]},
|
||||
"PlatformUtils": {"strings": ["return/^win/.test"], "exported": false, "value": "exports", "map": {
|
||||
"isAndroid": ["\"android\""],
|
||||
"isDarwin": ["\"darwin\""],
|
||||
"isIOS": ["ios"],
|
||||
"isLinux": ["\"linux\""],
|
||||
"isWindows": ["return/^win/.test"]
|
||||
}},
|
||||
"PlatformUtils": {"props": ["isAndroid", "isWindows"]},
|
||||
"PermissionRoleUtils": {"props": ["can", "ALLOW", "DENY"]},
|
||||
"PreferencesContext": {"strings": ["reducedMotion", "forcedColors", "alwaysShowLinkDecorations", "createContext"], "exported": false, "value": "exports", "map": {
|
||||
"AccessibilityPreferencesContext": ["object Object"]
|
||||
|
@ -289,6 +249,7 @@
|
|||
"Anchor": {"strings": ["anchorUnderlineOnHover", "noreferrer noopener"]},
|
||||
"Animations": {"props": ["Controller", "Spring", "animated"]},
|
||||
"AppReferencePositionLayer": {"props": ["AppReferencePositionLayer", "appLayerContext"], "funcStrings": ["{children:(", "{ref:"]},
|
||||
"AutocompleterComponents": {"props": ["AutocompleterQuerySymbols", "createHeaderResult"]},
|
||||
"AvatarConstants": {"strings": ["\"SIZE_20\"", "\"SIZE_32\""], "exported": false, "value": "exports", "map": {
|
||||
"Sizes": ["\"SIZE_20\"", "\"SIZE_32\""]
|
||||
}},
|
||||
|
|
Loading…
Reference in New Issue