mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-11 02:16:23 +00:00
fix(memberListActivities): support twitch and attachment images
This commit is contained in:
parent
c13bb6e47e
commit
94c5e6fdb7
2 changed files with 22 additions and 0 deletions
11
src/plugins/memberListActivities/components/TwitchIcon.tsx
Normal file
11
src/plugins/memberListActivities/components/TwitchIcon.tsx
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/*
|
||||||
|
* Vencord, a Discord client mod
|
||||||
|
* Copyright (c) 2024 Vendicated and contributors
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { SVGProps } from "react";
|
||||||
|
|
||||||
|
export function TwitchIcon(props: SVGProps<SVGSVGElement>) {
|
||||||
|
return (<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 268" {...props}><path fill="#5a3e85" d="M17.458 0L0 46.556v186.201h63.983v34.934h34.931l34.898-34.934h52.36L256 162.954V0zm23.259 23.263H232.73v128.029l-40.739 40.741H128L93.113 226.92v-34.886H40.717zm64.008 116.405H128V69.844h-23.275zm63.997 0h23.27V69.844h-23.27z"></path></svg>);
|
||||||
|
}
|
|
@ -24,6 +24,7 @@ import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
import { SpotifyIcon } from "./components/SpotifyIcon";
|
import { SpotifyIcon } from "./components/SpotifyIcon";
|
||||||
|
import { TwitchIcon } from "./components/TwitchIcon";
|
||||||
|
|
||||||
interface Activity {
|
interface Activity {
|
||||||
created_at: number;
|
created_at: number;
|
||||||
|
@ -58,6 +59,10 @@ export default definePlugin({
|
||||||
icons.push(<SpotifyIcon />);
|
icons.push(<SpotifyIcon />);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (activities.some(activity => activity.name === "Twitch")) {
|
||||||
|
icons.push(<TwitchIcon />);
|
||||||
|
}
|
||||||
|
|
||||||
const applications = activities.filter(activity => activity.application_id);
|
const applications = activities.filter(activity => activity.application_id);
|
||||||
applications.forEach(activity => {
|
applications.forEach(activity => {
|
||||||
const { assets } = activity;
|
const { assets } = activity;
|
||||||
|
@ -71,6 +76,12 @@ export default definePlugin({
|
||||||
if (externalLink) {
|
if (externalLink) {
|
||||||
icons.push(<img src={externalDiscordLink} alt={alt}/>);
|
icons.push(<img src={externalDiscordLink} alt={alt}/>);
|
||||||
}
|
}
|
||||||
|
} else if (image.startsWith("mp:attachments/")) {
|
||||||
|
const attachmentId = image.replace(/mp:attachments\//, "");
|
||||||
|
const attachmentLink = `https://media.discordapp.net/attachments/${attachmentId}`;
|
||||||
|
if (attachmentId) {
|
||||||
|
icons.push(<img src={attachmentLink} alt={alt}/>);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const src = `https://cdn.discordapp.com/app-assets/${activity.application_id}/${image}.png`;
|
const src = `https://cdn.discordapp.com/app-assets/${activity.application_id}/${image}.png`;
|
||||||
icons.push(<img src={src} alt={alt}/>);
|
icons.push(<img src={src} alt={alt}/>);
|
||||||
|
|
Loading…
Reference in a new issue