|
class SnippetApi { |
|
constructor() { |
|
const _mods = webpackChunkdiscord_app.push([[Symbol()],{},({c})=>Object.values(c)]); |
|
|
|
this._mods = _mods; |
|
|
|
webpackChunkdiscord_app.pop(); |
|
} |
|
|
|
findByProps = (...props) => { |
|
for (let m of this._mods) { |
|
try { |
|
if (!m.exports || m.exports === window) continue; |
|
if (props.every((x) => m.exports?.[x])) return m.exports; |
|
|
|
for (let ex in m.exports) { |
|
if (props.every((x) => m.exports?.[ex]?.[x])) return m.exports[ex]; |
|
} |
|
} catch {} |
|
} |
|
} |
|
|
|
getStore = (store) => { |
|
return Object.values(Object.values(this._mods.find(x => x?.exports?.default?.getUsers).exports.default._dispatcher._actionHandlers)[3].nodes).filter(s => s.name === store)[0]; |
|
}; |
|
|
|
getActionHandler = (store, actionHandler) => { |
|
let stores = Object.values(Object.values(this._mods.find(x => x?.exports?.default?.getUsers).exports.default._dispatcher._actionHandlers)[3].nodes).filter(s => s.name === store); |
|
let found; |
|
|
|
for (var store of stores) { |
|
if (!found && store.actionHandler[actionHandler]) found = store; |
|
}; |
|
|
|
if (found) return found.actionHandler[actionHandler]; |
|
else return console.error(`${actionHandler} action handler could not found!`); |
|
}; |
|
|
|
getAllFunctions = () => { |
|
return this._mods.filter(m => typeof m?.exports?.Z === "object").map(m => Object.entries(m?.exports?.Z).filter(entry => typeof entry[1] === "function").map(entry => entry[0])); |
|
}; |
|
|
|
searchFunctions = (query) => { |
|
return this._mods.filter(m => typeof m?.exports?.Z === "object").map(m => Object.entries(m?.exports?.Z).filter(entry => typeof entry[1] === "function" && entry[0].toLowerCase().includes(search)).map(entry => entry[0])).filter(array => array.length !== 0); |
|
}; |
|
|
|
searchStores = (query) => { |
|
return Object.fromEntries(this._mods.find(x => x?.exports?.Z?.connectStores).Store.getAll().filter(store => store.getName().toLowerCase().includes(query)).map(matchingStore => [matchingStore.getName(), matchingStore])); |
|
}; |
|
|
|
searchActionHandlers = (query) => { |
|
return Object.keys(Object.values(this._mods.find(x => x?.exports?.default?.getUsers).exports.default._dispatcher._actionHandlers)[0]).filter(key => key.toLowerCase().includes(query)); |
|
}; |
|
|
|
findModule = (func) => this.this._mods.find(func) |
|
|
|
get React() {return this.findByProps("createElement", "cloneElement");} |
|
get ReactDOM() {return this.findByProps("render", "findDOMNode");} |
|
|
|
/* Guild Info, Stores, and Utilities */ |
|
get GuildStore() {return this.findByProps("getGuild");} |
|
get SortedGuildStore() {return this.findByProps("getSortedGuilds");} |
|
get SelectedGuildStore() {return this.findByProps("getLastSelectedGuildId");} |
|
get GuildSync() {return this.findByProps("getSyncedGuilds");} |
|
get GuildInfo() {return this.findByProps("getAcronym");} |
|
get GuildChannelsStore() {return this.findByProps("getChannels", "getDefaultChannel");} |
|
get GuildMemberStore() {return this.findByProps("getMember");} |
|
get MemberCountStore() {return this.findByProps("getMemberCounts");} |
|
get GuildEmojiStore() {return this.findByProps("getEmojis");} |
|
get GuildActions() {return this.findByProps("requestMembers");} |
|
get GuildPermissions() {return this.findByProps("getGuildPermissions");} |
|
|
|
/* Channel Store & Actions */ |
|
get ChannelStore() {return this.findByProps("getChannel", "getDMFromUserId");} |
|
get SelectedChannelStore() {return this.findByProps("getLastSelectedChannelId");} |
|
get ChannelActions() {return this.findByProps("selectChannel");} |
|
get PrivateChannelActions() {return this.findByProps("openPrivateChannel");} |
|
|
|
/* Current User Info, State and Settings */ |
|
get UserInfoStore() {return this.findByProps("getSessionId");} |
|
get UserSettingsStore() {return this.findByProps("guildPositions");} |
|
get StreamerModeStore() {return this.findByProps("hidePersonalInformation");} |
|
get UserSettingsUpdater() {return this.findByProps("updateRemoteSettings");} |
|
get OnlineWatcher() {return this.findByProps("isOnline");} |
|
get CurrentUserIdle() {return this.findByProps("isIdle");} |
|
get RelationshipStore() {return this.findByProps("isBlocked", "getFriendIDs");} |
|
get RelationshipManager() {return this.findByProps("addRelationship");} |
|
get MentionStore() {return this.findByProps("getMentions");} |
|
|
|
/* User Stores and Utils */ |
|
get UserStore() {return this.findByProps("getCurrentUser", "getUser");} |
|
get UserStatusStore() {return this.findByProps("getStatus", "getState");} |
|
get UserTypingStore() {return this.findByProps("isTyping");} |
|
get UserActivityStore() {return this.findByProps("getActivity");} |
|
get UserNameResolver() {return this.findByProps("getName");} |
|
get UserNoteStore() {return this.findByProps("getNote");} |
|
get UserNoteActions() {return this.findByProps("updateNote");} |
|
|
|
/* Emoji Store and Utils */ |
|
get EmojiInfo() {return this.findByProps("isEmojiDisabled");} |
|
get EmojiUtils() {return this.findByProps("getGuildEmoji");} |
|
get EmojiStore() {return this.findByProps("getByCategory", "EMOJI_NAME_RE");} |
|
|
|
/* Invite Store and Utils */ |
|
get InviteStore() {return this.findByProps("getInvites");} |
|
get InviteResolver() {return this.findByProps("resolveInvite");} |
|
get InviteActions() {return this.findByProps("acceptInvite");} |
|
|
|
/* Discord Objects & Utils */ |
|
get DiscordConstants() {return this.findByProps("Permissions", "ActivityTypes", "StatusTypes");} |
|
get DiscordPermissions() {return this.findByProps("Permissions", "ActivityTypes", "StatusTypes").Permissions;} |
|
get Permissions() {return this.findByProps("computePermissions");} |
|
get ColorConverter() {return this.findByProps("hex2int");} |
|
get ColorShader() {return this.findByProps("darken");} |
|
get TinyColor() {return WebpackModules.getByPrototypes("toRgb");} |
|
get ClassResolver() {return this.findByProps("getClass");} |
|
get ButtonData() {return this.findByProps("ButtonSizes");} |
|
get NavigationUtils() {return this.findByProps("transitionTo", "replaceWith", "getHistory");} |
|
get KeybindStore() {return this.findByProps("keyToCode");} |
|
|
|
/* Discord Messages */ |
|
get MessageStore() {return this.findByProps("getMessage", "getMessages");} |
|
get ReactionsStore() {return this.findByProps("getReactions", "_dispatcher");} |
|
get MessageActions() {return this.findByProps("jumpToMessage", "_sendMessage");} |
|
get MessageQueue() {return this.findByProps("enqueue");} |
|
|
|
/* Experiments */ |
|
get ExperimentStore() {return this.findByProps("getExperimentOverrides");} |
|
get ExperimentsManager() {return this.findByProps("isDeveloper");} |
|
get CurrentExperiment() {return this.findByProps("getExperimentId");} |
|
|
|
/* Streams */ |
|
get StreamStore() {return this.findByProps("getAllActiveStreams", "getStreamForUser");} |
|
get StreamPreviewStore() {return this.findByProps("getIsPreviewLoading", "getPreviewURL");} |
|
|
|
/* Images, Avatars and Utils */ |
|
get ImageResolver() {return this.findByProps("getUserAvatarURL", "getGuildIconURL");} |
|
get ImageUtils() {return this.findByProps("getSizedImageSrc");} |
|
get AvatarDefaults() {return this.findByProps("getUserAvatarURL", "DEFAULT_AVATARS");} |
|
|
|
/* Drag & Drop */ |
|
get DNDSources() {return this.findByProps("addTarget");} |
|
get DNDObjects() {return this.findByProps("DragSource");} |
|
|
|
/* Electron & Other Internals with Utils*/ |
|
get ElectronModule() {return this.findByProps("setBadge");} |
|
get Flux() {return this.findByProps("Store", "connectStores");} |
|
get Dispatcher() {return this.findByProps("dirtyDispatch");} |
|
get PathUtils() {return this.findByProps("hasBasename");} |
|
get NotificationModule() {return this.findByProps("showNotification");} |
|
get RouterModule() {return this.findByProps("Router");} |
|
get APIModule() {return this.findByProps("getAPIBaseURL");} |
|
get AnalyticEvents() {return this.findByProps("AnalyticEventConfigs");} |
|
get Buffers() {return this.findByProps("Buffer", "kMaxLength");} |
|
get DeviceStore() {return this.findByProps("getDevices");} |
|
get SoftwareInfo() {return this.findByProps("os");} |
|
get i18n() {return this.findByProps("Messages", "languages");} |
|
|
|
/* Media Stuff (Audio/Video) */ |
|
get MediaDeviceInfo() {return this.findByProps("Codecs", "MediaEngineContextTypes");} |
|
get MediaInfo() {return this.findByProps("getOutputVolume");} |
|
get MediaEngineInfo() {return this.findByProps("determineMediaEngine");} |
|
get VoiceInfo() {return this.findByProps("getEchoCancellation");} |
|
get SoundModule() {return this.findByProps("playSound");} |
|
|
|
/* Window, DOM, HTML */ |
|
get WindowInfo() {return this.findByProps("isFocused", "windowSize");} |
|
get DOMInfo() {return this.findByProps("canUseDOM");} |
|
|
|
/* Locale/Location and Time */ |
|
get Moment() {return this.findByProps("parseZone");} |
|
get LocationManager() {return this.findByProps("createLocation");} |
|
get Timestamps() {return this.findByProps("fromTimestamp");} |
|
|
|
/* Strings and Utils */ |
|
get StringFormats() {return this.findByProps("a", "z");} |
|
get StringUtils() {return this.findByProps("toASCII");} |
|
|
|
/* URLs and Utils */ |
|
get URLParser() {return this.findByProps("Url", "parse");} |
|
get ExtraURLs() {return this.findByProps("getArticleURL");} |
|
|
|
/* Text Processing */ |
|
get hljs() {return this.findByProps("highlight", "highlightBlock");} |
|
get SimpleMarkdown() {return this.findByProps("parseBlock", "parseInline", "defaultOutput");} |
|
|
|
/* DOM/React Components */ |
|
/* ==================== */ |
|
get LayerManager() {return this.findByProps("popLayer", "pushLayer");} |
|
get UserSettingsWindow() {return this.findByProps("open", "updateAccount");} |
|
get ChannelSettingsWindow() {return this.findByProps("open", "updateChannel");} |
|
get GuildSettingsWindow() {return this.findByProps("open", "updateGuild");} |
|
|
|
/* Modals */ |
|
get ModalActions() {return this.findByProps("openModal", "updateModal");} |
|
get ModalStack() {return this.findByProps("push", "update", "pop", "popWithKey");} |
|
get UserProfileModals() {return this.findByProps("fetchMutualFriends", "setSection");} |
|
get ChangeNicknameModal() {return this.findByProps("open", "changeNickname");} |
|
get CreateChannelModal() {return this.findByProps("open", "createChannel");} |
|
get PruneMembersModal() {return this.findByProps("open", "prune");} |
|
get NotificationSettingsModal() {return this.findByProps("open", "updateNotificationSettings");} |
|
|
|
/* Popouts */ |
|
get PopoutStack() {return this.findByProps("open", "close", "closeAll");} |
|
get PopoutOpener() {return this.findByProps("openPopout");} |
|
|
|
/* Context Menus */ |
|
get ContextMenuActions() {return this.findByProps("openContextMenu");} |
|
|
|
/* Misc */ |
|
get FlexChild() {return this.findByProps("Child");} |
|
get Titles() {return this.findByProps("Tags", "default");} |
|
get Tooltip() {return this.findByProps("TooltipContainer").TooltipContainer;} |
|
|
|
/* Scrollers */ |
|
get ScrollerThin() {return this.findByProps("ScrollerThin").ScrollerThin;} |
|
get ScrollerAuto() {return this.findByProps("ScrollerAuto").ScrollerAuto;} |
|
get AdvancedScrollerThin() {return this.findByProps("AdvancedScrollerThin").AdvancedScrollerThin;} |
|
get AdvancedScrollerAuto() {return this.findByProps("AdvancedScrollerAuto").AdvancedScrollerAuto;} |
|
get AdvancedScrollerNone() {return this.findByProps("AdvancedScrollerNone").AdvancedScrollerNone;} |
|
|
|
get Dropdown() {return this.findByProps("SingleSelect").SingleSelect;} |
|
}; |
|
|
|
window.snippetApi = new SnippetApi(); |
just update this shit bro 🔥