diff --git a/src/plugins/extraConnectionLinks/README.md b/src/plugins/extraConnectionLinks/README.md new file mode 100644 index 000000000..722299622 --- /dev/null +++ b/src/plugins/extraConnectionLinks/README.md @@ -0,0 +1,21 @@ +# ExtraConnectionLinks +Allows you to open more connections in browser! + +### Before +![Shows the Roblox connection in the Discord client without the open profile button (the default).](https://github.com/Vendicated/Vencord/assets/73203995/734efd94-c61a-4f90-987d-3a4bbcc9311f) +### After +![Shows the Roblox connection in the Discord client with the open profile button.](https://github.com/Vendicated/Vencord/assets/73203995/eef59d09-78d9-4859-b722-242fc6aa7c8e) + +## Platform Status +### Supported Platforms +* Xbox +* Epic Games +### Platforms that will never be supported +* Riot Games (Nothing made by Riot Games to view profiles online) +* League of Legends (Same as above since it's the same company) +* Battle.net (Nothing made by Blizzard to view profiles online) +* Bungie.net (Nothing made by Bungie.net to view profiles online) +* PlayStation Network (Sony built a service called My PlayStation, but removed it for unknown reasons in 2021) +* Facebook +* Crunchyroll (can't view other peoples profiles nor your own profile) +* Amazon Music (nothing references to the actual amazon music user id in discord.) diff --git a/src/plugins/extraConnectionLinks/index.ts b/src/plugins/extraConnectionLinks/index.ts new file mode 100644 index 000000000..c7b6af17f --- /dev/null +++ b/src/plugins/extraConnectionLinks/index.ts @@ -0,0 +1,59 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Cooper/coopeeo, Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; + +/** + * All the connection types implemented into this plugin + */ +enum connectionTypes { + Roblox, + Xbox, + Epic, +} + +/** + * The uri to use. + * There are also two variables that you can use, name and id. + * The "name" is what shows up when viewing a connection on a discord profile. + * The "id" is the identifier of the account connected, the type depends on the service connected. + * @example [connectionTypes.Xbox]: "https://www.xbox.com/play/user/${name}", + * @example [connectionTypes.Roblox]: "https://www.roblox.com/users/${id}/profile", + */ +const uris = { // name (what shows up on connection on ui), id (an identifier thing) + //[connectionTypes.Roblox]: "https://www.roblox.com/users/${id}/profile", + [connectionTypes.Xbox]: "https://www.xbox.com/play/user/${name}", + [connectionTypes.Epic]: "https://store.epicgames.com/u/${id}", +}; + +/** + * What discord has the service named as. + * @example [connectionTypes.Epic]: "Epic Games", + */ +const serviceNames = { + //[connectionTypes.Roblox]: "Roblox", + [connectionTypes.Xbox]: "Xbox", + [connectionTypes.Epic]: "Epic Games", +}; + +export default definePlugin({ + name: "ExtraConnectionLinks", + description: "Allows you to open more connections in browser!", + authors: [Devs.coopeeo], + patches: Object.keys(connectionTypes) + .filter(v => isNaN(Number(v))) + .map(key => { + const connectionTypeSelected = connectionTypes[key as keyof typeof connectionTypes]; + return { + find: "getPlatformUserUrl:", + replacement: { + match: new RegExp("(r"), + replace: `, getPlatformUserUrl:e=>{let {name, id} = e; return \`${uris[connectionTypeSelected]}\`;}` + } + }; + }), +}); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 6653e6307..dcefba3b1 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -531,6 +531,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({ name: "Antti", id: 312974985876471810n }, + coopeeo: { + name: "Cooper", + id: 594864203102158859n + }, Joona: { name: "Joona", id: 297410829589020673n