Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
many plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
verticalsync committed Mar 13, 2024
1 parent f20c8c9 commit 94068fe
Show file tree
Hide file tree
Showing 28 changed files with 979 additions and 17 deletions.
50 changes: 33 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,49 @@ Suncord is a fork of [Vencord](https://github.com/Vendicated/Vencord).
You can join our discord server for commits, changes or just chat or maybe even support? Who knows.
For the invite click [here](https://discord.gg/VasF3Ma4Ab)

## Included plugins alongside Vencord
## Installing / Uninstalling

Visit [1_INSTALLING.md](/docs/1_INSTALLING.md)

## Extra included plugins

- Plugins by [D3SOX](https://github.com/D3S0X/vencord-userplugins)
- - MemberListActivities
- - VoiceChatUtilities
- - BlockKrisp
- - IgnoreTerms
- - NotifyUserChanges
- - ScreenShareStreamerMode
- - ServerProfilesToolbox

- Plugins by [Kyuuhachi](https://github.com/Kyuuhachi/VencordPlugins)
- - Anammox
- - ColorMessage
- - DeadMembers
- - ImageLink
- - MessageLinkTooltip
- - ReplyTimestamp
- - ModalFade
- - BetterSettings ([pr to vencord here]())
- - Title

- purgeMessages (by [bhop](https://github.com/prettylittlelies))
- platformSpoofer (by [drag](https://github.com/dragdotpng))
- doubleCounterVerifyBypass (by [verticalsync](https://github.com/verticalsync/double-counter-verify-bypass))
- messageLoggerEnhanced (by [Syncxv](https://github.com/Syncxv/vc-message-logger-enhanced))
- Plugins by [Syncxv](https://github.com/Syncxv)
- - [MessageLoggerEnhanced](https://github.com/Syncxv/vc-message-logger-enhanced)
- - PinDMs (but better) ([pull request](https://github.com/Vendicated/Vencord/pull/2203) to PinDMs)

- PurgeMessages (by [bhop](https://github.com/prettylittlelies))
- PlatformSpoofer (by [drag](https://github.com/dragdotpng))
- DoubleCounterVerifyBypass (by [verticalsync](https://github.com/verticalsync/double-counter-verify-bypass))
- Timezones (by [mantikafasi](https://github.com/mantikafasi) & [ArjixWasTaken](https://github.com/ArjixWasTaken))
- customScreenShare (by [KawaiianPizza](https://github.com/KawaiianPizza))
- CustomScreenShare (by [KawaiianPizza](https://github.com/KawaiianPizza))
- iRememberYou (by [zoodogood](https://github.com/zoodogood/vencord-plugins))
- EmojiDownloader (by [woosh](https://github.com/w8y) modified version of ServerDownload by [cheesesamwich](https://github.com/cheesesamwich/ServerDownload))
- GlobalBadges (by [HypedDomi](https://github.com/domi-btnr/Vencord-Plugins))
- CommandPalette (by [Ethan](https://github.com/ethan-davies)) (added from Ethan's [pull request](https://github.com/Vendicated/Vencord/pull/2145) to vencord)
- AllCallTimers (by [Max-Herbold](https://github.com/Max-Herbold)) (added from Max's [pull request](https://github.com/Vendicated/Vencord/pull/2132) to vencord)
- ReplyTimestamp (by [Kyuuhachi](https://github.com/Kyuuhachi/))
- SoundBoardLogger (by [ImpishMoxxie](https://github.com/ImpishMoxxie/SoundBoardLogger))
- MemberListActivities (by [D3SOX](https://github.com/D3SOX/vencord-userplugins/))
- VoiceChatUtilities (by [D3SOX](https://github.com/D3SOX/vencord-userplugins/))
- PinDMs (but better) ([pull request](https://github.com/Vendicated/Vencord/pull/2203) to PinDMs by [Syncxv](https://github.com/Syncxv/))
- BetterSettings (by [Kyuuhachi](https://github.com/Kyuuhachi/)) (added from Kyuuhachi's [pull request](https://github.com/Vendicated/Vencord/pull/2222))
- Anammox (by [Kyuuhachi](https://github.com/Kyuuhachi/))
- ModalFade (by [Kyuuhachi](https://github.com/Kyuuhachi/))
- HideMessage (by [Hanzy](https://github.com/hanzydev/)) (added from Hanzy's [pull request](https://github.com/Vendicated/Vencord/pull/2207))

## Installing / Uninstalling

Visit [1_INSTALLING.md](/docs/1_INSTALLING.md)

## Disclaimer

Discord is trademark of Discord Inc. and solely mentioned for the sake of descriptivity.
Expand Down
4 changes: 4 additions & 0 deletions src/suncordplugins/ColorMessage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ColorMessage

An addon to RoleColorEverywhere, which colors message contents based on the sender's color, with configurable intensity.
This uses [`color-mix`](https://caniuse.com/mdn-css_types_color_color-mix), which is not supported by the Electron Discord client (I don't know about Vesktop).
63 changes: 63 additions & 0 deletions src/suncordplugins/ColorMessage/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/

import { definePluginSettings } from "@api/Settings";
import * as Styles from "@api/Styles";
import { makeRange } from "@components/PluginSettings/components";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack";

const AuthorStore = findByPropsLazy("useNullableMessageAuthor", "useNullableMessageAuthor");

import { Devs } from "@utils/constants";

import style from "./style.css?managed";

export const settings = definePluginSettings({
saturation: {
type: OptionType.SLIDER,
description: "Message color saturation",
markers: makeRange(0, 100, 10),
default: 20,
onChange() {
updateStyle();
},
},
});

function updateStyle() {
(Styles.requireStyle(style).dom!.sheet!.cssRules[0] as CSSStyleRule)
.style.setProperty("--98-message-color-saturation", `${settings.store.saturation}`);
}

export default definePlugin({
name: "ColorMessage",
description: "Colors message content with author's role color",
authors: [Devs.Kyuuhachi],
settings,

patches: [
{
find: 'default.Messages.MESSAGE_EDITED,")"',
replacement: {
match: /id:\(0,\w+.getMessageContentId\)\((\w+)\),/,
replace: '$&style:{"--98-message-color":$self.getMessageColor($1)},'
}
},
],

getMessageColor(messageId: string) {
return AuthorStore.default(messageId).colorString;
},

start() {
Styles.enableStyle(style);
updateStyle();
},
stop() {
Styles.disableStyle(style);
},
});
12 changes: 12 additions & 0 deletions src/suncordplugins/ColorMessage/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* stylelint-disable custom-property-pattern */
:root {
--98-message-color-saturation: /*DYNAMIC*/;
}

div[class*="messageContent_"] {
color: color-mix(
in lab,
var(--98-message-color, var(--text-normal)) calc(var(--98-message-color-saturation) * 1%),
var(--text-normal)
)
}
60 changes: 60 additions & 0 deletions src/suncordplugins/DeadMembers/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/

import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { ChannelStore, GuildMemberStore, useStateFromStores } from "@webpack/common";

export default definePlugin({
name: "DeadMembers",
description: "Shows when the sender of a message has left the guild",
authors: [Devs.Kyuuhachi],

patches: [
{
find: "UsernameDecorationTypes:function()",
replacement: {
match: /children:(\(\i\?"@":""\)\+\i)/,
replace: "children:$self.wrapMessageAuthor(arguments[0],$1)"
}
},
{
find: "Messages.FORUM_POST_AUTHOR_A11Y_LABEL",
replacement: {
match: /(?<=\}=(\i),\{(user:\i,author:\i)\}=.{0,400}?\(\i\.Fragment,{children:)\i(?=}\),)/,
replace: "$self.wrapForumAuthor({...$1,$2},$&)"
}
},
],

wrapMessageAuthor({ author, message }, text) {
const channel = ChannelStore.getChannel(message.channel_id);
return message.webhookId
? text
: <DeadIndicator
channel={channel}
userId={message.author.id}
text={text}
/>;
},

wrapForumAuthor({ channel, user }, text) {
return <DeadIndicator
channel={channel}
userId={user.id}
text={text}
/>;
},
});


function DeadIndicator({ channel, userId, text }) {
const isMember = useStateFromStores(
[GuildMemberStore],
() => GuildMemberStore.isMember(channel?.guild_id, userId),
);
return channel?.guild_id && !isMember ? <s className="c98-author-dead">{text}</s> : text;
}
24 changes: 24 additions & 0 deletions src/suncordplugins/ImageLink/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/

import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";

export default definePlugin({
name: "ImageLink",
description: "Suppresses the hiding of links for \"simple embeds\"",
authors: [Devs.Kyuuhachi],

patches: [
{
find: "isEmbedInline:function",
replacement: {
match: /(?<=isEmbedInline:function\(\)\{return )\w+(?=\})/,
replace: "()=>false",
},
},
],
});
126 changes: 126 additions & 0 deletions src/suncordplugins/MessageLinkTooltip/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/

import "./style.css";

import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { proxyLazy } from "@utils/lazy";
import definePlugin from "@utils/types";
import { findComponentByCodeLazy } from "@webpack";
import { ChannelStore, Forms, MessageStore, RestAPI, Tooltip, useEffect, useState, useStateFromStores } from "@webpack/common";
import type { ComponentType, HTMLAttributes } from "react";

declare enum SpinnerTypes {
WANDERING_CUBES = "wanderingCubes",
CHASING_DOTS = "chasingDots",
PULSING_ELLIPSIS = "pulsingEllipsis",
SPINNING_CIRCLE = "spinningCircle",
SPINNING_CIRCLE_SIMPLE = "spinningCircleSimple",
LOW_MOTION = "lowMotion",
}

type Spinner = ComponentType<Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
type?: SpinnerTypes;
animated?: boolean;
className?: string;
itemClassName?: string;
"aria-label"?: string;
}> & {
Type: typeof SpinnerTypes;
};

const { Spinner } = proxyLazy(() => Forms as any as {
Spinner: Spinner,
SpinnerTypes: typeof SpinnerTypes;
});

const ChannelMessage = findComponentByCodeLazy("renderSimpleAccessories)") as ComponentType<any>;

export default definePlugin({
name: "MessageLinkTooltip",
description: "Like MessageLinkEmbed but without taking space",
authors: [Devs.Kyuuhachi],

patches: [
{
find: ',className:"channelMention",children:[',
replacement: {
match: /(?<=\.jsxs\)\()(\i\.default)/,
replace: "$self.wrapComponent(arguments[0], $1)"
}
}
],

wrapComponent({ messageId, channelId }, Component: ComponentType) {
return props => {
if (messageId === undefined) return <Component {...props} />;
return <Tooltip
tooltipClassName="c98-message-link-tooltip"
text={
<ErrorBoundary>
<MessagePreview
channelId={channelId}
messageId={messageId}
/>
</ErrorBoundary>
}
>
{({ onMouseEnter, onMouseLeave }) =>
<Component
{...props}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
/>
}
</Tooltip>;
};
}
});

function MessagePreview({ channelId, messageId }) {
const channel = ChannelStore.getChannel(channelId);
const message = useMessage(channelId, messageId);
// TODO handle load failure
if (!message) {
return <Spinner type={Spinner.Type.PULSING_ELLIPSIS} />;
}

return <ChannelMessage
id={`message-link-tooltip-${messageId}`}
message={message}
channel={channel}
subscribeToComponentDispatch={false}
/>;
}

function useMessage(channelId, messageId) {
const cachedMessage = useStateFromStores(
// @ts-ignore
[MessageStore],
() => MessageStore.getMessage(channelId, messageId)
);
const [message, setMessage] = useState(cachedMessage);
useEffect(() => {
if (message == null)
(async () => {
const res = await RestAPI.get({
url: `/channels/${channelId}/messages`,
query: {
limit: 1,
around: messageId,
},
retries: 2,
});
const rawMessage = res.body[0];
const message = MessageStore.getMessages(channelId)
.receiveMessage(rawMessage)
.get(messageId);
setMessage(message);
})();
});
return message;
}
4 changes: 4 additions & 0 deletions src/suncordplugins/MessageLinkTooltip/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.c98-message-link-tooltip {
width: max-content;
max-width: 80vw;
}
3 changes: 3 additions & 0 deletions src/suncordplugins/Title/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Title

In the browser version, the window/tab title is always prefixed with "Discord -". This plugin lets you change or remove this prefix.
Loading

0 comments on commit 94068fe

Please sign in to comment.