diff --git a/src/plugins/openMoreConnections/README.md b/src/plugins/openMoreConnections/README.md new file mode 100644 index 000000000..ef3eb93d2 --- /dev/null +++ b/src/plugins/openMoreConnections/README.md @@ -0,0 +1,12 @@ +# OpenMoreConnections + +Adds the Open Profile button to connections that don't natively have it in the regular Discord client. +## Supported Platforms +* Xbox +* Roblox +## Planned Platforms +* PSN +## Platforms that will never be supported +* Riot Games/League of Legends +* Battle.net +* Epic Games diff --git a/src/plugins/openMoreConnections/index.ts b/src/plugins/openMoreConnections/index.ts new file mode 100644 index 000000000..055abdf0a --- /dev/null +++ b/src/plugins/openMoreConnections/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"; + + + +//* platforms that dont open +//* riot and leage (can't view profiles) +//* epic (can't view profiles) +//* psn (can't view profiles but I have a workaround for 3rd party stuff) +//* roblox +//* xbox +//* battle.net (can't view profiles) + +enum ConnectionType { + Roblox = "roblox", + PSN = "playstation", + Xbox = "xbox", +} + + +interface Connection { + type: ConnectionType | string; + id: string; + name: string; + verified: boolean; +} + + +export default definePlugin({ + name: "OpenMoreConnections", + description: "Adds the Open Profile button to connections that don't natively have it in the regular Discord client. Supported Platforms: Xbox, and Roblox. Planned Platforms: PSN. Platforms that will never be supported: Riot Games/League of Legends, Battle.net, and Epic Games", + authors: [Devs.coopeeo], + patches: [ + { + find: ".CONNECTED_ACCOUNT_VIEWED,", + replacement: { + match: /(?<=(\i)=null==\i\?void 0:null===\(\i=\i.getPlatformUserUrl\)\|\|void 0===\i\?void 0:\i.call\(\i,(\i)\);)/, + replace: "if ($1 == null) $1 = $self.addConnectionLink($2);" + } + } + ], + addConnectionLink(con: Connection) { + switch (con.type) { + case ConnectionType.Roblox: + return `https://www.roblox.com/users/${con.id}/profile`; + case ConnectionType.Xbox: + return `https://www.xbox.com/en-US/play/user/${con.name}`; + } + + + return null; + } +}); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index c399baafe..88d8e12d6 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -533,6 +533,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({ Antti: { name: "Antti", id: 312974985876471810n + }, + coopeeo: { + name: "Cooper", + id: 594864203102158859n } } satisfies Record);