From bad96b78879f296d5b9e7adacb03756b0f58427a Mon Sep 17 00:00:00 2001 From: Ven Date: Mon, 28 Nov 2022 13:37:55 +0100 Subject: Path aliases, better lazyWebpack (#268) --- src/plugins/lastfm.tsx | 64 +++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'src/plugins/lastfm.tsx') diff --git a/src/plugins/lastfm.tsx b/src/plugins/lastfm.tsx index 280c0ee..bf3f63c 100644 --- a/src/plugins/lastfm.tsx +++ b/src/plugins/lastfm.tsx @@ -16,43 +16,43 @@ * along with this program. If not, see . */ -import { Link } from "../components/Link"; -import { Devs } from "../utils/constants"; -import { lazyWebpack } from "../utils/misc"; -import definePlugin, { OptionType } from "../utils/types"; -import { Settings, Webpack } from "../Vencord"; -import { FluxDispatcher, Forms } from "../webpack/common"; +import { Settings } from "@api/settings"; +import { Link } from "@components/Link"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; +import { filters, findByPropsLazy, mapMangledModuleLazy } from "@webpack"; +import { FluxDispatcher, Forms } from "@webpack/common"; interface ActivityAssets { - large_image?: string - large_text?: string - small_image?: string - small_text?: string + large_image?: string; + large_text?: string; + small_image?: string; + small_text?: string; } interface Activity { - state: string - details?: string + state: string; + details?: string; timestamps?: { - start?: Number - } - assets?: ActivityAssets - buttons?: Array - name: string - application_id: string + start?: Number; + }; + assets?: ActivityAssets; + buttons?: Array; + name: string; + application_id: string; metadata?: { - button_urls?: Array - } - type: Number - flags: Number + button_urls?: Array; + }; + type: Number; + flags: Number; } interface TrackData { - name: string - album: string - artist: string - url: string - imageUrl?: string + name: string; + album: string; + artist: string; + url: string; + imageUrl?: string; } // only relevant enum values @@ -67,11 +67,11 @@ enum ActivityFlag { const applicationId = "1043533871037284423"; -const presenceStore = lazyWebpack(Webpack.filters.byProps("getLocalPresence")); -const assetManager = Webpack.mapMangledModuleLazy( +const presenceStore = findByPropsLazy("getLocalPresence"); +const assetManager = mapMangledModuleLazy( "getAssetImage: size must === [number, number] for Twitch", { - getAsset: Webpack.filters.byCode("apply("), + getAsset: filters.byCode("apply("), } ); @@ -196,9 +196,9 @@ export default definePlugin({ state: hideAlbumName ? trackData.artist : `${trackData.artist} - ${trackData.album}`, assets, - buttons: [ "Open in Last.fm" ], + buttons: ["Open in Last.fm"], metadata: { - button_urls: [ trackData.url ] + button_urls: [trackData.url] }, type: this.settings.useListeningStatus ? ActivityType.LISTENING : ActivityType.PLAYING, -- cgit