Compare commits

...

38 Commits

Author SHA1 Message Date
Vendicated
d589d22a0b bump to 1.2.0 2023-04-30 01:27:08 +02:00
Vendicated
4c13521a30 PlatformIndicators: Fix layout reflows 2023-04-30 01:25:17 +02:00
Manti
043381963b ReviewDB: make warning review disableable; add timestamps (#948) 2023-04-30 00:53:37 +02:00
LordElias
5b485806ea Plugin Settings: Better margin for plugin settings modal (#1008) 2023-04-30 00:52:20 +02:00
Kode
29c994648b ShowConnections plugin (#923)
Co-authored-by: Vendicated <vendicated@riseup.net>
2023-04-30 00:49:27 +02:00
Vendicated
a35b417194 BetterRoleDot: Fix copying colour 2023-04-30 00:09:15 +02:00
Vendicated
070aa343ef Remove migratePluginSettings calls 2023-04-30 00:09:15 +02:00
Đỗ Văn Hoài Tuân
b95c5c6619 Fix USRBG (#1000)
Co-authored-by: V <vendicated@riseup.net>
2023-04-30 00:08:04 +02:00
Vendicated
bf795c49df [skip ci] Update Monaco; Fix code scanning errors 2023-04-29 04:16:28 +02:00
Vendicated
a2e03084b0 BadgeAPI: Add support for multiple donor badges 2023-04-29 02:06:52 +02:00
Vendicated
ec72b4c91d PronounDB: Oop, conditional hooks are bad :> 2023-04-29 02:04:00 +02:00
Vendicated
d70d7c7b49 [skip ci] reporter: reduce sleep time 2023-04-28 19:34:21 +02:00
Vendicated
e7d0fc258d [skip ci] WebContextMenus: fix false ci test positives 2023-04-28 19:32:29 +02:00
Vendicated
7b13b9a53e PronounDB: Fix not working in profiles 2023-04-28 19:15:07 +02:00
Vendicated
1b2cb52dac ViewIcons: Fix viewing banners 2023-04-28 18:36:22 +02:00
Vendicated
0fe0fecba2 MessageLogger: Nicer context menu 2023-04-28 04:23:42 +02:00
Vendicated
c1fca76f94 SilentMessageToggle: Add missing dependency on MessageEventsApi 2023-04-28 04:03:49 +02:00
carince
0cc3901e4e MuteNewGuilds: add toggles for guild, everyone, and roles. (#979)
Co-authored-by: V <vendicated@riseup.net>
Co-authored-by: Norikiru <99774021+Norikiru@users.noreply.github.com>
2023-04-28 02:03:38 +00:00
Vendicated
f8ace5b53a [skip ci] definePluginSettings: Add missing BigInt type 2023-04-28 02:57:09 +02:00
V
c0954a1844 Specify that theme in screenshot is only an example 2023-04-28 02:51:18 +02:00
V
6548163d3e Update README.md 2023-04-28 02:49:34 +02:00
V
24f161d6e9 Update README.md 2023-04-28 02:48:39 +02:00
V
7d00b6a842 README: Add screenshot & more info 2023-04-28 02:17:33 +02:00
Vendicated
5f5d4b8961 [skip ci] UserScript: Fix cors check pt 2 2023-04-28 01:13:42 +02:00
Hazel Summer
5be86f9bd1 WhoReacted: Fix clicking user pfps also adding reaction (#977) 2023-04-24 01:42:38 +02:00
Vendicated
dfc3f05834 Fix RoleColorEverywhere crash 2023-04-23 23:33:55 +02:00
V
63fc354d48 feat: auto-managed flux subscriptions via plugin.flux (#959) 2023-04-22 01:18:19 +00:00
V
c6f0c84935 PinDMs: Fix alt up/down being weird (#957) 2023-04-22 03:17:00 +02:00
Vendicated
a8d017811d TypingTweaks: Fix filter 2023-04-22 03:16:08 +02:00
Vendicated
8dd70f5d1a Fix inserting text when markdown preview is off 2023-04-18 23:13:10 +02:00
Amsyar Rasyiq
8be6c6e3ce fix(ReviewDB): fix margin in self-profile preview (#935)
Co-authored-by: V <vendicated@riseup.net>
2023-04-18 18:53:11 +02:00
V
7e96b5dcfb RelationShipNotifier: Support multiple users (#944) 2023-04-18 16:52:46 +00:00
Đỗ Văn Hoài Tuân
99a7d78e9b [skip ci] USRBG: Update README link to a more accurate one (#943) 2023-04-18 16:04:17 +02:00
Nuckyz
e70d00d008 BadgesAPI: Don't depend on getBadges module not being undefined (#942) 2023-04-18 05:25:14 +00:00
Nuckyz
c0ac6a4b86 SilentMessageToggle: Option to persist state (#941) 2023-04-18 04:54:21 +00:00
Vendicated
29749e93c7 CI Reporter fixes 2023-04-18 02:54:22 +02:00
Vendicated
993c6be219 Fix badges 2023-04-18 02:47:48 +02:00
Đỗ Văn Hoài Tuân
e2e1cf2bfd feat(plugin): USRBG (#844)
Co-authored-by: amsyarasyiq <82711525+amsyarasyiq@users.noreply.github.com>
Co-authored-by: Vendicated <vendicated@riseup.net>
2023-04-18 00:18:18 +02:00
68 changed files with 1044 additions and 668 deletions

View File

@ -2,10 +2,14 @@
The cutest Discord client mod The cutest Discord client mod
![](https://user-images.githubusercontent.com/45497981/235015332-0453d3eb-1da6-4601-963e-ef5e454123a1.png)
*A screenshot of Vencord featuring the [ClearVision-v6 theme](https://github.com/ClearVision/ClearVision-v6) (Vencord does not come with it pre-installed, it is only an example)*
## Features ## Features
- Super easy to install (Download Installer, open, click install button, done) - Super easy to install (Download Installer, open, click install button, done)
- 100+ plugins built in: [See a list](https://gist.github.com/Vendicated/8696cde7b92548064a3ae92ead84d033) - 100+ plugins built in: [See a list](https://vencord.dev/plugins)
- Some highlights: SpotifyControls, GameActivityToggle, Experiments, NoTrack, MessageLogger, QuickReply, Free Emotes/Stickers, CustomCommands, ShowHiddenChannels, PronounDB - Some highlights: SpotifyControls, GameActivityToggle, Experiments, NoTrack, MessageLogger, QuickReply, Free Emotes/Stickers, CustomCommands, ShowHiddenChannels, PronounDB
- Fairly lightweight despite the many inbuilt plugins - Fairly lightweight despite the many inbuilt plugins
- Excellent Browser Support: Run Vencord in your Browser via extension or UserScript - Excellent Browser Support: Run Vencord in your Browser via extension or UserScript
@ -13,10 +17,14 @@ The cutest Discord client mod
- Custom CSS and Themes: Inbuilt css editor with support to import any css files (including BetterDiscord themes) - Custom CSS and Themes: Inbuilt css editor with support to import any css files (including BetterDiscord themes)
- Privacy friendly, blocks Discord analytics & crash reporting out of the box and has no telemetry - Privacy friendly, blocks Discord analytics & crash reporting out of the box and has no telemetry
- Maintained very actively, broken plugins are usually fixed within 12 hours - Maintained very actively, broken plugins are usually fixed within 12 hours
- Settings sync: Keep your plugins and their settings synchronised between devices / apps (optional)
## Installing / Uninstalling ## Installing / Uninstalling
[![Download and run the Installer ](https://img.shields.io/github/v/release/Vencord/Installer?label=Download%20Vencord%20Installer&style=for-the-badge)](https://github.com/Vencord/Installer#usage) Click the below button to install Vencord to the Discord Desktop app
[![Download and run the Installer](https://img.shields.io/github/v/release/Vencord/Installer?label=Download%20Vencord%20Installer&style=for-the-badge)](https://github.com/Vencord/Installer#vencord-installer)
## Installing on Browser ## Installing on Browser
@ -24,25 +32,30 @@ The cutest Discord client mod
Or use the [UserScript](https://raw.githubusercontent.com/Vencord/builds/main/Vencord.user.js) - Please note that the CSS Editor, Themes loaded from remote sources and co. will not work in the UserScript. Use the extension if you need any of those Or use the [UserScript](https://raw.githubusercontent.com/Vencord/builds/main/Vencord.user.js) - Please note that the CSS Editor, Themes loaded from remote sources and co. will not work in the UserScript. Use the extension if you need any of those
## Building from Source ## Installing our Desktop App
See the docs folder As an alternative to the Discord Desktop app, Vencord also has its own standalone Desktop app that is snappier and lighter than Discord's official Desktop app. It is currently in beta and we have yet to implement some features like screensharing, but you can try the beta nonetheless
## Contributing [![Download Vencord Desktop](https://img.shields.io/github/v/release/Vencord/Desktop?label=Download%20Vencord%20Desktop&style=for-the-badge)](https://github.com/Vencord/Desktop#vencord-desktop)
See [CONTRIBUTING.md](CONTRIBUTING.md) and [Megu's Plugin Guide!](docs/2_PLUGINS.md) ## Join our Support/Community Server
[contribute]: CONTRIBUTING.md [![Vencord Discord Server](https://invidget.switchblade.xyz/D9uwnFnqmd?theme=dark)](https://discord.gg/D9uwnFnqmd)
[contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute] [contribute]
## Join
[join]: https://discord.gg/D9uwnFnqmd
[join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join] [join]
## Disclaimer ## Disclaimer
Discord is trademark of Discord Inc. and solely mentioned for the sake of descriptivity. Discord is trademark of Discord Inc. and solely mentioned for the sake of descriptivity.
Mention of it does not imply any affiliation with or endorsement by Discord Inc. Mention of it does not imply any affiliation with or endorsement by Discord Inc.
<details>
<summary>Using Vencord violates Discord's terms of service</summary>
Client modifications are against Discords Terms of Service.
However, Discord is pretty indifferent about them and there are no known cases of users getting banned for using client mods! So you should generally be fine as long as you dont use any plugins that implement abusive behaviour. But no worries, all inbuilt plugins are safe to use!
Regardless, if your account is very important to you and it getting disabled would be a disaster for you, you should probably not use any client mods (not exclusive to Vencord), just to be safe
Additionally, make sure not to post screenshots with Vencord in a server where you might get banned for it
</details>

View File

@ -59,7 +59,9 @@ async function checkCors(url, method) {
const origin = headers["access-control-allow-origin"]; const origin = headers["access-control-allow-origin"];
if (origin !== "*" && origin !== window.location.origin) return false; if (origin !== "*" && origin !== window.location.origin) return false;
const methods = headers["access-control-allow-methods"]?.toLowerCase().split(/,\s/g); const methods = headers["access-control-allow-methods"]?.toLowerCase()
.split(",")
.map(s => s.trim());
if (methods && !methods.includes(method.toLowerCase())) return false; if (methods && !methods.includes(method.toLowerCase())) return false;
return true; return true;

View File

@ -16,7 +16,7 @@ chrome.webRequest.onHeadersReceived.addListener(
// In main frame requests, the CSP needs to be removed to enable fetching of custom css // In main frame requests, the CSP needs to be removed to enable fetching of custom css
// as desired by the user // as desired by the user
removeFirst(responseHeaders, h => h.name.toLowerCase() === "content-security-policy"); removeFirst(responseHeaders, h => h.name.toLowerCase() === "content-security-policy");
} else if (type === "stylesheet" && url.startsWith("https://raw.githubusercontent.com")) { } else if (type === "stylesheet" && url.startsWith("https://raw.githubusercontent.com/")) {
// Most users will load css from GitHub, but GitHub doesn't set the correct content type, // Most users will load css from GitHub, but GitHub doesn't set the correct content type,
// so we fix it here // so we fix it here
removeFirst(responseHeaders, h => h.name.toLowerCase() === "content-type"); removeFirst(responseHeaders, h => h.name.toLowerCase() === "content-type");

View File

@ -1,7 +1,7 @@
{ {
"name": "vencord", "name": "vencord",
"private": "true", "private": "true",
"version": "1.1.9", "version": "1.2.0",
"description": "The cutest Discord client mod", "description": "The cutest Discord client mod",
"homepage": "https://github.com/Vendicated/Vencord#readme", "homepage": "https://github.com/Vendicated/Vencord#readme",
"bugs": { "bugs": {

View File

@ -186,7 +186,16 @@ page.on("console", async e => {
} else if (isDebug) { } else if (isDebug) {
console.error(e.text()); console.error(e.text());
} else if (level === "error") { } else if (level === "error") {
const text = e.text(); const text = await Promise.all(
e.args().map(async a => {
try {
return await maybeGetError(a) || await a.jsonValue();
} catch (e) {
return a.toString();
}
})
).then(a => a.join(" "));
if (!text.startsWith("Failed to load resource: the server responded with a status of")) { if (!text.startsWith("Failed to load resource: the server responded with a status of")) {
console.error("Got unexpected error", text); console.error("Got unexpected error", text);
report.otherErrors.push(text); report.otherErrors.push(text);
@ -258,7 +267,7 @@ function runTime(token: string) {
if (!isWasm) if (!isWasm)
await wreq.e(id as any); await wreq.e(id as any);
await new Promise(r => setTimeout(r, 100)); await new Promise(r => setTimeout(r, 150));
} }
console.error("[PUP_DEBUG]", "Finished loading chunks!"); console.error("[PUP_DEBUG]", "Finished loading chunks!");

View File

@ -79,8 +79,8 @@ export function _getBadges(args: BadgeUserArgs) {
: badges.push({ ...badge, ...args }); : badges.push({ ...badge, ...args });
} }
} }
const donorBadge = (Plugins.BadgeAPI as any).getDonorBadge(args.user.id); const donorBadges = (Plugins.BadgeAPI as unknown as typeof import("../plugins/apiBadges").default).getDonorBadges(args.user.id);
if (donorBadge) badges.unshift(donorBadge); if (donorBadges) badges.unshift(...donorBadges);
return badges; return badges;
} }

View File

@ -150,7 +150,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti
); );
}); });
return <Flex flexDirection="column" style={{ gap: 12 }}>{options}</Flex>; return <Flex flexDirection="column" style={{ gap: 12, marginBottom: 16 }}>{options}</Flex>;
} }
} }
@ -180,7 +180,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti
<Text variant="heading-lg/semibold" style={{ flexGrow: 1 }}>{plugin.name}</Text> <Text variant="heading-lg/semibold" style={{ flexGrow: 1 }}>{plugin.name}</Text>
<ModalCloseButton onClick={onClose} /> <ModalCloseButton onClick={onClose} />
</ModalHeader> </ModalHeader>
<ModalContent style={{ marginBottom: 8, marginTop: 8 }}> <ModalContent>
<Forms.FormSection> <Forms.FormSection>
<Forms.FormTitle tag="h3">About {plugin.name}</Forms.FormTitle> <Forms.FormTitle tag="h3">About {plugin.name}</Forms.FormTitle>
<Forms.FormText>{plugin.description}</Forms.FormText> <Forms.FormText>{plugin.description}</Forms.FormText>

View File

@ -1,11 +1,15 @@
<!doctype html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<title>Vencord QuickCSS Editor</title> <title>Vencord QuickCSS Editor</title>
<link rel="stylesheet" data-name="vs/editor/editor.main" <link
href="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.34.0/min/vs/editor/editor.main.min.css"> rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.37.1/min/vs/editor/editor.main.min.css"
integrity="sha512-wB3xfL98hWg1bpkVYSyL0js/Jx9s7FsDg9aYO6nOMSJTgPuk/PFqxXQJKKSUjteZjeYrfgo9NFBOA1r9HwDuZw=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<style> <style>
html, html,
body, body,
@ -24,17 +28,30 @@
<body> <body>
<div id="container"></div> <div id="container"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.34.0/min/vs/loader.min.js"></script> <script
src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.37.1/min/vs/loader.min.js"
integrity="sha512-A+6SvPGkIN9Rf0mUXmW4xh7rDvALXf/f0VtOUiHlDUSPknu2kcfz1KzLpOJyL2pO+nZS13hhIjLqVgiQExLJrw=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script> <script>
require.config({ paths: { 'vs': 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.34.0/min/vs' } }); require.config({
require(["vs/editor/editor.main"], () => { paths: {
getCurrentCss().then(css => { vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.37.1/min/vs",
var editor = monaco.editor.create(document.getElementById('container'), { },
value: css,
language: 'css',
theme: getTheme(),
}); });
require(["vs/editor/editor.main"], () => {
getCurrentCss().then((css) => {
var editor = monaco.editor.create(
document.getElementById("container"),
{
value: css,
language: "css",
theme: getTheme(),
}
);
editor.onDidChangeModelContent(() => editor.onDidChangeModelContent(() =>
setCss(editor.getValue()) setCss(editor.getValue())
); );
@ -44,9 +61,6 @@
}); });
}); });
}); });
</script> </script>
</body> </body>
</html> </html>

View File

@ -48,7 +48,7 @@ const ContributorBadge: ProfileBadge = {
link: "https://github.com/Vendicated/Vencord" link: "https://github.com/Vendicated/Vencord"
}; };
const DonorBadges = {} as Record<string, Pick<ProfileBadge, "image" | "description">>; const DonorBadges = {} as Record<string, Pick<ProfileBadge, "image" | "description">[]>;
export default definePlugin({ export default definePlugin({
name: "BadgeAPI", name: "BadgeAPI",
@ -56,21 +56,17 @@ export default definePlugin({
authors: [Devs.Megu, Devs.Ven, Devs.TheSun], authors: [Devs.Megu, Devs.Ven, Devs.TheSun],
required: true, required: true,
patches: [ patches: [
/* Patch the badges array */
{
find: "Messages.ACTIVE_DEVELOPER_BADGE_TOOLTIP",
replacement: {
match: /(?<=void 0:)\i.getBadges\(\)/,
replace: "Vencord.Api.Badges._getBadges(arguments[0]).concat($&??[])",
}
},
/* Patch the badge list component on user profiles */ /* Patch the badge list component on user profiles */
{ {
find: "Messages.PROFILE_USER_BADGES,role:", find: "Messages.PROFILE_USER_BADGES,role:",
replacement: [ replacement: [
{
match: /null==\i\?void 0:(\i)\.getBadges\(\)/,
replace: (_, badgesMod) => `Vencord.Api.Badges._getBadges(arguments[0]).concat(${badgesMod}?.getBadges()??[])`,
},
{ {
// alt: "", aria-hidden: false, src: originalSrc // alt: "", aria-hidden: false, src: originalSrc
match: /alt:" ","aria-hidden":!0,src:(?=.{0,10}\b(\i)\.(?:icon|key))/g, match: /alt:" ","aria-hidden":!0,src:(?=(\i)\.src)/g,
// ...badge.props, ..., src: badge.image ?? ... // ...badge.props, ..., src: badge.image ?? ...
replace: "...$1.props,$& $1.image??" replace: "...$1.props,$& $1.image??"
}, },
@ -101,14 +97,12 @@ export default definePlugin({
} }
for (const line of lines) { for (const line of lines) {
const [id, description, image] = line.split(","); const [id, description, image] = line.split(",");
DonorBadges[id] = { image, description }; (DonorBadges[id] ??= []).push({ image, description });
} }
}, },
getDonorBadge(userId: string) { getDonorBadges(userId: string) {
const badge = DonorBadges[userId]; return DonorBadges[userId]?.map(badge => ({
if (badge) {
return {
...badge, ...badge,
position: BadgePosition.START, position: BadgePosition.START,
props: { props: {
@ -172,7 +166,6 @@ export default definePlugin({
</ErrorBoundary> </ErrorBoundary>
)); ));
}, },
}; }));
}
} }
}); });

View File

@ -16,12 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { migratePluginSettings, Settings } from "@api/settings"; import { Settings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { Clipboard, Toasts } from "@webpack/common"; import { Clipboard, Toasts } from "@webpack/common";
migratePluginSettings("BetterRoleDot", "ClickableRoleDot");
export default definePlugin({ export default definePlugin({
name: "BetterRoleDot", name: "BetterRoleDot",
authors: [Devs.Ven], authors: [Devs.Ven],
@ -30,10 +29,10 @@ export default definePlugin({
patches: [ patches: [
{ {
find: "M0 4C0 1.79086 1.79086 0 4 0H16C18.2091 0 20 1.79086 20 4V16C20 18.2091 18.2091 20 16 20H4C1.79086 20 0 18.2091 0 16V4Z", find: ".dotBorderBase",
replacement: { replacement: {
match: /viewBox:"0 0 20 20"/, match: /,viewBox:"0 0 20 20"/,
replace: "$&,onClick:()=>$self.copyToClipBoard(e.color),style:{cursor:'pointer'}", replace: "$&,onClick:()=>$self.copyToClipBoard(arguments[0].color),style:{cursor:'pointer'}",
}, },
}, },
{ {

View File

@ -23,7 +23,6 @@ import {
removePreEditListener, removePreEditListener,
removePreSendListener removePreSendListener
} from "@api/MessageEvents"; } from "@api/MessageEvents";
import { migratePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
@ -33,7 +32,6 @@ import { defaultRules } from "./defaultRules";
const reRegExpChar = /[\\^$.*+?()[\]{}|]/g; const reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
const reHasRegExpChar = RegExp(reRegExpChar.source); const reHasRegExpChar = RegExp(reRegExpChar.source);
migratePluginSettings("ClearURLs", "clearURLs");
export default definePlugin({ export default definePlugin({
name: "ClearURLs", name: "ClearURLs",
description: "Removes tracking garbage from URLs", description: "Removes tracking garbage from URLs",

View File

@ -17,7 +17,7 @@
*/ */
import { addPreEditListener, addPreSendListener, removePreEditListener, removePreSendListener } from "@api/MessageEvents"; import { addPreEditListener, addPreSendListener, removePreEditListener, removePreSendListener } from "@api/MessageEvents";
import { definePluginSettings, migratePluginSettings, Settings } from "@api/settings"; import { definePluginSettings, Settings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { ApngBlendOp, ApngDisposeOp, getGifEncoder, importApngJs } from "@utils/dependencies"; import { ApngBlendOp, ApngDisposeOp, getGifEncoder, importApngJs } from "@utils/dependencies";
import { getCurrentGuild } from "@utils/discord"; import { getCurrentGuild } from "@utils/discord";
@ -149,8 +149,6 @@ const settings = definePluginSettings({
} }
}); });
migratePluginSettings("FakeNitro", "NitroBypass");
export default definePlugin({ export default definePlugin({
name: "FakeNitro", name: "FakeNitro",
authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.obscurity, Devs.captain, Devs.Nuckyz, Devs.AutumnVN], authors: [Devs.Arjix, Devs.D3SOX, Devs.Ven, Devs.obscurity, Devs.captain, Devs.Nuckyz, Devs.AutumnVN],

View File

@ -17,9 +17,9 @@
*/ */
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { insertTextIntoChatInputBox } from "@utils/discord";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { filters, mapMangledModuleLazy } from "@webpack"; import { filters, mapMangledModuleLazy } from "@webpack";
import { ComponentDispatch } from "@webpack/common";
const ExpressionPickerState = mapMangledModuleLazy('name:"expression-picker-last-active-view"', { const ExpressionPickerState = mapMangledModuleLazy('name:"expression-picker-last-active-view"', {
close: filters.byCode("activeView:null", "setState") close: filters.byCode("activeView:null", "setState")
@ -40,7 +40,7 @@ export default definePlugin({
handleSelect(gif?: { url: string; }) { handleSelect(gif?: { url: string; }) {
if (gif) { if (gif) {
ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", { rawText: gif.url + " " }); insertTextIntoChatInputBox(gif.url + " ");
ExpressionPickerState.close(); ExpressionPickerState.close();
} }
} }

View File

@ -20,6 +20,8 @@ import { registerCommand, unregisterCommand } from "@api/Commands";
import { Settings } from "@api/settings"; import { Settings } from "@api/settings";
import Logger from "@utils/Logger"; import Logger from "@utils/Logger";
import { Patch, Plugin } from "@utils/types"; import { Patch, Plugin } from "@utils/types";
import { FluxDispatcher } from "@webpack/common";
import { FluxEvents } from "@webpack/types";
import Plugins from "~plugins"; import Plugins from "~plugins";
@ -111,56 +113,64 @@ export function startDependenciesRecursive(p: Plugin) {
} }
export const startPlugin = traceFunction("startPlugin", function startPlugin(p: Plugin) { export const startPlugin = traceFunction("startPlugin", function startPlugin(p: Plugin) {
const { name, commands, flux } = p;
if (p.start) { if (p.start) {
logger.info("Starting plugin", p.name); logger.info("Starting plugin", name);
if (p.started) { if (p.started) {
logger.warn(`${p.name} already started`); logger.warn(`${name} already started`);
return false; return false;
} }
try { try {
p.start(); p.start();
p.started = true; p.started = true;
} catch (e) { } catch (e) {
logger.error(`Failed to start ${p.name}\n`, e); logger.error(`Failed to start ${name}\n`, e);
return false; return false;
} }
} }
if (p.commands?.length) { if (commands?.length) {
logger.info("Registering commands of plugin", p.name); logger.info("Registering commands of plugin", name);
for (const cmd of p.commands) { for (const cmd of commands) {
try { try {
registerCommand(cmd, p.name); registerCommand(cmd, name);
} catch (e) { } catch (e) {
logger.error(`Failed to register command ${cmd.name}\n`, e); logger.error(`Failed to register command ${cmd.name}\n`, e);
return false; return false;
} }
} }
}
if (flux) {
for (const event in flux) {
FluxDispatcher.subscribe(event as FluxEvents, flux[event]);
}
} }
return true; return true;
}, p => `startPlugin ${p.name}`); }, p => `startPlugin ${p.name}`);
export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plugin) { export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plugin) {
const { name, commands, flux } = p;
if (p.stop) { if (p.stop) {
logger.info("Stopping plugin", p.name); logger.info("Stopping plugin", name);
if (!p.started) { if (!p.started) {
logger.warn(`${p.name} already stopped`); logger.warn(`${name} already stopped`);
return false; return false;
} }
try { try {
p.stop(); p.stop();
p.started = false; p.started = false;
} catch (e) { } catch (e) {
logger.error(`Failed to stop ${p.name}\n`, e); logger.error(`Failed to stop ${name}\n`, e);
return false; return false;
} }
} }
if (p.commands?.length) { if (commands?.length) {
logger.info("Unregistering commands of plugin", p.name); logger.info("Unregistering commands of plugin", name);
for (const cmd of p.commands) { for (const cmd of commands) {
try { try {
unregisterCommand(cmd.name); unregisterCommand(cmd.name);
} catch (e) { } catch (e) {
@ -170,5 +180,11 @@ export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plu
} }
} }
if (flux) {
for (const event in flux) {
FluxDispatcher.unsubscribe(event as FluxEvents, flux[event]);
}
}
return true; return true;
}, p => `stopPlugin ${p.name}`); }, p => `stopPlugin ${p.name}`);

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { insertTextIntoChatInputBox } from "@utils/discord";
import { import {
ModalContent, ModalContent,
ModalFooter, ModalFooter,
@ -24,7 +25,7 @@ import {
ModalRoot, ModalRoot,
openModal, openModal,
} from "@utils/modal"; } from "@utils/modal";
import { Button, ComponentDispatch, Forms, React, Switch, TextInput } from "@webpack/common"; import { Button, Forms, React, Switch, TextInput } from "@webpack/common";
import { encrypt } from "../index"; import { encrypt } from "../index";
@ -84,9 +85,7 @@ function EncModal(props: ModalProps) {
const toSend = noCover ? encrypted.replaceAll("d", "") : encrypted; const toSend = noCover ? encrypted.replaceAll("d", "") : encrypted;
if (!toSend) return; if (!toSend) return;
ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", { insertTextIntoChatInputBox(toSend);
rawText: `${toSend}`
});
props.onClose(); props.onClose();
}} }}

View File

@ -19,7 +19,7 @@
import * as DataStore from "@api/DataStore"; import * as DataStore from "@api/DataStore";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { ChannelStore, FluxDispatcher, NavigationRouter, SelectedChannelStore, SelectedGuildStore } from "@webpack/common"; import { ChannelStore, NavigationRouter, SelectedChannelStore, SelectedGuildStore } from "@webpack/common";
export interface LogoutEvent { export interface LogoutEvent {
type: "LOGOUT"; type: "LOGOUT";
@ -37,63 +37,54 @@ interface PreviousChannel {
channelId: string | null; channelId: string | null;
} }
let isSwitchingAccount = false;
let previousCache: PreviousChannel | undefined;
function attemptToNavigateToChannel(guildId: string | null, channelId: string) {
if (!ChannelStore.hasChannel(channelId)) return;
NavigationRouter.transitionTo(`/channels/${guildId ?? "@me"}/${channelId}`);
}
export default definePlugin({ export default definePlugin({
name: "KeepCurrentChannel", name: "KeepCurrentChannel",
description: "Attempt to navigate to the channel you were in before switching accounts or loading Discord.", description: "Attempt to navigate to the channel you were in before switching accounts or loading Discord.",
authors: [Devs.Nuckyz], authors: [Devs.Nuckyz],
isSwitchingAccount: false, flux: {
previousCache: {} as PreviousChannel, LOGOUT(e: LogoutEvent) {
({ isSwitchingAccount } = e);
attemptToNavigateToChannel(guildId: string | null, channelId: string) {
if (!ChannelStore.hasChannel(channelId)) return;
NavigationRouter.transitionTo(`/channels/${guildId ?? "@me"}/${channelId}`);
}, },
onLogout(e: LogoutEvent) { CONNECTION_OPEN() {
this.isSwitchingAccount = e.isSwitchingAccount; if (!isSwitchingAccount) return;
isSwitchingAccount = false;
if (previousCache?.channelId)
attemptToNavigateToChannel(previousCache.guildId, previousCache.channelId);
}, },
onConnectionOpen() { async CHANNEL_SELECT({ guildId, channelId }: ChannelSelectEvent) {
if (!this.isSwitchingAccount) return; if (isSwitchingAccount) return;
this.isSwitchingAccount = false;
if (this.previousCache.channelId) this.attemptToNavigateToChannel(this.previousCache.guildId, this.previousCache.channelId); previousCache = {
},
async onChannelSelect({ guildId, channelId }: ChannelSelectEvent) {
if (this.isSwitchingAccount) return;
this.previousCache = {
guildId, guildId,
channelId channelId
}; };
await DataStore.set("KeepCurrentChannel_previousData", this.previousCache); await DataStore.set("KeepCurrentChannel_previousData", previousCache);
}
}, },
async start() { async start() {
const previousData = await DataStore.get<PreviousChannel>("KeepCurrentChannel_previousData"); previousCache = await DataStore.get<PreviousChannel>("KeepCurrentChannel_previousData");
if (previousData) { if (!previousCache) {
this.previousCache = previousData; previousCache = {
if (this.previousCache.channelId) this.attemptToNavigateToChannel(this.previousCache.guildId, this.previousCache.channelId);
} else {
this.previousCache = {
guildId: SelectedGuildStore.getGuildId(), guildId: SelectedGuildStore.getGuildId(),
channelId: SelectedChannelStore.getChannelId() ?? null channelId: SelectedChannelStore.getChannelId() ?? null
}; };
await DataStore.set("KeepCurrentChannel_previousData", this.previousCache);
await DataStore.set("KeepCurrentChannel_previousData", previousCache);
} else if (previousCache.channelId) {
attemptToNavigateToChannel(previousCache.guildId, previousCache.channelId);
} }
FluxDispatcher.subscribe("LOGOUT", this.onLogout.bind(this));
FluxDispatcher.subscribe("CONNECTION_OPEN", this.onConnectionOpen.bind(this));
FluxDispatcher.subscribe("CHANNEL_SELECT", this.onChannelSelect.bind(this));
},
stop() {
FluxDispatcher.unsubscribe("LOGOUT", this.onLogout);
FluxDispatcher.unsubscribe("CONNECTION_OPEN", this.onConnectionOpen);
FluxDispatcher.unsubscribe("CHANNEL_SELECT", this.onChannelSelect);
} }
}); });

View File

@ -23,7 +23,7 @@ import { getCurrentChannel } from "@utils/discord";
import { useForceUpdater } from "@utils/misc"; import { useForceUpdater } from "@utils/misc";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { findStoreLazy } from "@webpack"; import { findStoreLazy } from "@webpack";
import { FluxDispatcher, Tooltip } from "@webpack/common"; import { Tooltip } from "@webpack/common";
const counts = {} as Record<string, [number, number]>; const counts = {} as Record<string, [number, number]>;
let forceUpdate: () => void; let forceUpdate: () => void;
@ -107,7 +107,8 @@ export default definePlugin({
} }
}], }],
onGuildMemberListUpdate({ guildId, groups, memberCount, id }) { flux: {
GUILD_MEMBER_LIST_UPDATE({ guildId, groups, memberCount, id }) {
// eeeeeh - sometimes it has really wrong counts??? like 10 times less than actual // eeeeeh - sometimes it has really wrong counts??? like 10 times less than actual
// but if we only listen to everyone updates, sometimes we never get the count? // but if we only listen to everyone updates, sometimes we never get the count?
// this seems to work but isn't optional // this seems to work but isn't optional
@ -120,14 +121,7 @@ export default definePlugin({
} }
counts[guildId] = [memberCount, count]; counts[guildId] = [memberCount, count];
forceUpdate?.(); forceUpdate?.();
}, }
start() {
FluxDispatcher.subscribe("GUILD_MEMBER_LIST_UPDATE", this.onGuildMemberListUpdate);
},
stop() {
FluxDispatcher.unsubscribe("GUILD_MEMBER_LIST_UPDATE", this.onGuildMemberListUpdate);
}, },
render: () => ( render: () => (

View File

@ -17,7 +17,6 @@
*/ */
import { addClickListener, removeClickListener } from "@api/MessageEvents"; import { addClickListener, removeClickListener } from "@api/MessageEvents";
import { migratePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack"; import { findByPropsLazy } from "@webpack";
@ -29,8 +28,6 @@ const keyup = (e: KeyboardEvent) => e.key === "Backspace" && (isDeletePressed =
const MANAGE_CHANNELS = 1n << 4n; const MANAGE_CHANNELS = 1n << 4n;
migratePluginSettings("MessageClickActions", "MessageQuickActions");
export default definePlugin({ export default definePlugin({
name: "MessageClickActions", name: "MessageClickActions",
description: "Hold Backspace and click to delete, double click to edit", description: "Hold Backspace and click to delete, double click to edit",

View File

@ -51,7 +51,7 @@ const SearchResultClasses = findByPropsLazy("message", "searchResult");
let AutoModEmbed: React.ComponentType<any> = () => null; let AutoModEmbed: React.ComponentType<any> = () => null;
const messageLinkRegex = /(?<!<)https?:\/\/(?:\w+\.)?discord(?:app)?\.com\/channels\/(\d{17,20}|@me)\/(\d{17,20})\/(\d{17,20})/g; const messageLinkRegex = /(?<!<)https?:\/\/(?:\w+\.)?discord(?:app)?\.com\/channels\/(\d{17,20}|@me)\/(\d{17,20})\/(\d{17,20})/g;
const tenorRegex = /https:\/\/(?:www.)?tenor\.com/; const tenorRegex = /^https:\/\/(?:www\.)?tenor\.com\//;
interface Attachment { interface Attachment {
height: number; height: number;

View File

@ -51,11 +51,28 @@ const patchMessageContextMenu: NavContextMenuPatchCallback = (children, props) =
if (!deleted && !editHistory?.length) return; if (!deleted && !editHistory?.length) return;
toggle: {
if (!deleted) break toggle;
const domElement = document.getElementById(`chat-messages-${channel_id}-${id}`);
if (!domElement) break toggle;
children.push((
<Menu.MenuItem
id={TOGGLE_DELETE_STYLE_ID}
key={TOGGLE_DELETE_STYLE_ID}
label="Toggle Deleted Highlight"
action={() => domElement.classList.toggle("messagelogger-deleted")}
/>
));
}
children.push(( children.push((
<Menu.MenuItem <Menu.MenuItem
id={REMOVE_HISTORY_ID} id={REMOVE_HISTORY_ID}
key={REMOVE_HISTORY_ID} key={REMOVE_HISTORY_ID}
label="Remove Message History" label="Remove Message History"
color="danger"
action={() => { action={() => {
if (deleted) { if (deleted) {
FluxDispatcher.dispatch({ FluxDispatcher.dispatch({
@ -70,20 +87,6 @@ const patchMessageContextMenu: NavContextMenuPatchCallback = (children, props) =
}} }}
/> />
)); ));
if (!deleted) return;
const domElement = document.getElementById(`chat-messages-${channel_id}-${id}`);
if (!domElement) return;
children.push((
<Menu.MenuItem
id={TOGGLE_DELETE_STYLE_ID}
key={TOGGLE_DELETE_STYLE_ID}
label="Toggle Deleted Highlight"
action={() => domElement.classList.toggle("messagelogger-deleted")}
/>
));
}; };
export default definePlugin({ export default definePlugin({

View File

@ -17,11 +17,9 @@
*/ */
import { findOption, OptionalMessageOption } from "@api/Commands"; import { findOption, OptionalMessageOption } from "@api/Commands";
import { migratePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
migratePluginSettings("MoreKaomoji", "moarKaomojis");
export default definePlugin({ export default definePlugin({
name: "MoreKaomoji", name: "MoreKaomoji",
description: "Adds more Kaomoji to discord. ヽ(´▽`)/", description: "Adds more Kaomoji to discord. ヽ(´▽`)/",

View File

@ -21,7 +21,7 @@ import { makeRange } from "@components/PluginSettings/components/SettingSliderCo
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { sleep } from "@utils/misc"; import { sleep } from "@utils/misc";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { FluxDispatcher, SelectedChannelStore, UserStore } from "@webpack/common"; import { SelectedChannelStore, UserStore } from "@webpack/common";
import { Message, ReactionEmoji } from "discord-types/general"; import { Message, ReactionEmoji } from "discord-types/general";
interface IMessageCreate { interface IMessageCreate {
@ -80,14 +80,15 @@ export default definePlugin({
description: "🗿🗿🗿🗿🗿🗿🗿🗿", description: "🗿🗿🗿🗿🗿🗿🗿🗿",
settings, settings,
async onMessage(e: IMessageCreate) { flux: {
if (e.optimistic || e.type !== "MESSAGE_CREATE") return; async MESSAGE_CREATE({ optimistic, type, message, channelId }: IMessageCreate) {
if (e.message.state === "SENDING") return; if (optimistic || type !== "MESSAGE_CREATE") return;
if (settings.store.ignoreBots && e.message.author?.bot) return; if (message.state === "SENDING") return;
if (!e.message.content) return; if (settings.store.ignoreBots && message.author?.bot) return;
if (e.channelId !== SelectedChannelStore.getChannelId()) return; if (!message.content) return;
if (channelId !== SelectedChannelStore.getChannelId()) return;
const moyaiCount = getMoyaiCount(e.message.content); const moyaiCount = getMoyaiCount(message.content);
for (let i = 0; i < moyaiCount; i++) { for (let i = 0; i < moyaiCount; i++) {
boom(); boom();
@ -95,35 +96,24 @@ export default definePlugin({
} }
}, },
onReaction(e: IReactionAdd) { MESSAGE_REACTION_ADD({ optimistic, type, channelId, userId, emoji }: IReactionAdd) {
if (e.optimistic || e.type !== "MESSAGE_REACTION_ADD") return; if (optimistic || type !== "MESSAGE_REACTION_ADD") return;
if (settings.store.ignoreBots && UserStore.getUser(e.userId)?.bot) return; if (settings.store.ignoreBots && UserStore.getUser(userId)?.bot) return;
if (e.channelId !== SelectedChannelStore.getChannelId()) return; if (channelId !== SelectedChannelStore.getChannelId()) return;
const name = e.emoji.name.toLowerCase(); const name = emoji.name.toLowerCase();
if (name !== MOYAI && !name.includes("moyai") && !name.includes("moai")) return; if (name !== MOYAI && !name.includes("moyai") && !name.includes("moai")) return;
boom(); boom();
}, },
onVoiceChannelEffect(e: IVoiceChannelEffectSendEvent) { VOICE_CHANNEL_EFFECT_SEND({ emoji }: IVoiceChannelEffectSendEvent) {
if (!e.emoji?.name) return; if (!emoji?.name) return;
const name = e.emoji.name.toLowerCase(); const name = emoji.name.toLowerCase();
if (name !== MOYAI && !name.includes("moyai") && !name.includes("moai")) return; if (name !== MOYAI && !name.includes("moyai") && !name.includes("moai")) return;
boom(); boom();
}, }
start() {
FluxDispatcher.subscribe("MESSAGE_CREATE", this.onMessage);
FluxDispatcher.subscribe("MESSAGE_REACTION_ADD", this.onReaction);
FluxDispatcher.subscribe("VOICE_CHANNEL_EFFECT_SEND", this.onVoiceChannelEffect);
},
stop() {
FluxDispatcher.unsubscribe("MESSAGE_CREATE", this.onMessage);
FluxDispatcher.unsubscribe("MESSAGE_REACTION_ADD", this.onReaction);
FluxDispatcher.unsubscribe("VOICE_CHANNEL_EFFECT_SEND", this.onVoiceChannelEffect);
} }
}); });

View File

@ -16,9 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { definePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { ModalContent, ModalFooter, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; import { ModalContent, ModalFooter, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
import definePlugin from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { findByProps, findStoreLazy } from "@webpack"; import { findByProps, findStoreLazy } from "@webpack";
import { Button, Text } from "@webpack/common"; import { Button, Text } from "@webpack/common";
@ -49,10 +50,28 @@ function NoDMNotificationsModal({ modalProps }: { modalProps: ModalProps; }) {
); );
} }
const settings = definePluginSettings({
guild: {
description: "Mute Guild",
type: OptionType.BOOLEAN,
default: true
},
everyone: {
description: "Suppress @everyone and @here",
type: OptionType.BOOLEAN,
default: true
},
role: {
description: "Suppress All Role @mentions",
type: OptionType.BOOLEAN,
default: true
},
});
export default definePlugin({ export default definePlugin({
name: "MuteNewGuild", name: "MuteNewGuild",
description: "Mutes newly joined guilds", description: "Mutes newly joined guilds",
authors: [Devs.Glitch, Devs.Nuckyz], authors: [Devs.Glitch, Devs.Nuckyz, Devs.carince],
patches: [ patches: [
{ {
find: ",acceptInvite:function", find: ",acceptInvite:function",
@ -62,10 +81,17 @@ export default definePlugin({
} }
} }
], ],
settings,
handleMute(guildId: string | null) { handleMute(guildId: string | null) {
if (guildId === "@me" || guildId === "null" || guildId == null) return; if (guildId === "@me" || guildId === "null" || guildId == null) return;
findByProps("updateGuildNotificationSettings").updateGuildNotificationSettings(guildId, { muted: true, suppress_everyone: true, suppress_roles: true }); findByProps("updateGuildNotificationSettings").updateGuildNotificationSettings(guildId,
{
muted: settings.store.guild,
suppress_everyone: settings.store.everyone,
suppress_roles: settings.store.role
}
);
}, },
start() { start() {

View File

@ -16,12 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { migratePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
migratePluginSettings("NoDevtoolsWarning", "STFU");
export default definePlugin({ export default definePlugin({
name: "NoDevtoolsWarning", name: "NoDevtoolsWarning",
description: "Disables the 'HOLD UP' banner in the console. As a side effect, also prevents Discord from hiding your token, which prevents random logouts.", description: "Disables the 'HOLD UP' banner in the console. As a side effect, also prevents Discord from hiding your token, which prevents random logouts.",

View File

@ -16,11 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { migratePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
migratePluginSettings("NoF1", "No F1");
export default definePlugin({ export default definePlugin({
name: "NoF1", name: "NoF1",
description: "Disables F1 help bind.", description: "Disables F1 help bind.",

View File

@ -16,11 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { migratePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
migratePluginSettings("NoRPC", "No RPC");
export default definePlugin({ export default definePlugin({
name: "NoRPC", name: "NoRPC",
description: "Disables Discord's RPC server.", description: "Disables Discord's RPC server.",

View File

@ -21,7 +21,7 @@ import definePlugin from "@utils/types";
import { Channel } from "discord-types/general"; import { Channel } from "discord-types/general";
import { addContextMenus, removeContextMenus } from "./contextMenus"; import { addContextMenus, removeContextMenus } from "./contextMenus";
import { getPinAt, isPinned, settings, snapshotArray, usePinnedDms } from "./settings"; import { getPinAt, isPinned, settings, snapshotArray, sortedSnapshot, usePinnedDms } from "./settings";
export default definePlugin({ export default definePlugin({
name: "PinDMs", name: "PinDMs",
@ -44,7 +44,7 @@ export default definePlugin({
}, },
isPinned, isPinned,
getSnapshot: () => snapshotArray, getSnapshot: sortedSnapshot,
getScrollOffset(channelId: string, rowHeight: number, padding: number, preRenderedChildren: number, originalOffset: number) { getScrollOffset(channelId: string, rowHeight: number, padding: number, preRenderedChildren: number, originalOffset: number) {
if (!isPinned(channelId)) if (!isPinned(channelId))

View File

@ -71,7 +71,7 @@ export function togglePin(id: string) {
save([...snapshot]); save([...snapshot]);
} }
function sortedSnapshot() { export function sortedSnapshot() {
requireSnapshot(); requireSnapshot();
if (settings.store.pinOrder === PinOrder.LastMessage) if (settings.store.pinOrder === PinOrder.LastMessage)
return PrivateChannelSortStore.getPrivateChannelIds().filter(isPinned); return PrivateChannelSortStore.getPrivateChannelIds().filter(isPinned);

View File

@ -112,7 +112,7 @@ const PlatformIndicator = ({ user, inline = false, marginLeft = "4px" }: { user:
gap: "4px", gap: "4px",
display: inline ? "inline-flex" : "flex", display: inline ? "inline-flex" : "flex",
alignItems: "center", alignItems: "center",
transform: inline ? "translateY(4px)" : undefined translate: inline ? "0 3px 0" : undefined
}} }}
> >
{icons} {icons}

View File

@ -16,66 +16,59 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Settings } from "@api/settings";
import { classes } from "@utils/misc"; import { classes } from "@utils/misc";
import { findByPropsLazy } from "@webpack"; import { findByPropsLazy } from "@webpack";
import { UserStore } from "@webpack/common"; import { UserStore } from "@webpack/common";
import { Message } from "discord-types/general"; import { Message } from "discord-types/general";
import { awaitAndFormatPronouns } from "../pronoundbUtils"; import { useFormattedPronouns } from "../pronoundbUtils";
import { settings } from "../settings";
const styles: Record<string, string> = findByPropsLazy("timestampInline"); const styles: Record<string, string> = findByPropsLazy("timestampInline");
function shouldShow(message: Message): boolean { function shouldShow(message: Message): boolean {
// Respect showInMessages if (!settings.store.showInMessages)
if (!Settings.plugins.PronounDB.showInMessages)
return false; return false;
// Don't bother fetching bot or system users
if (message.author.bot || message.author.system) if (message.author.bot || message.author.system)
return false; return false;
// Respect showSelf options if (!settings.store.showSelf && message.author.id === UserStore.getCurrentUser().id)
if (!Settings.plugins.PronounDB.showSelf && message.author.id === UserStore.getCurrentUser().id)
return false; return false;
return true; return true;
} }
export function PronounsChatComponentWrapper({ message }: { message: Message; }) { export function PronounsChatComponentWrapper({ message }: { message: Message; }) {
if (!shouldShow(message)) return shouldShow(message)
return null; ? <PronounsChatComponent message={message} />
: null;
return <PronounsChatComponent message={message} />;
} }
export function CompactPronounsChatComponentWrapper({ message }: { message: Message; }) { export function CompactPronounsChatComponentWrapper({ message }: { message: Message; }) {
if (!shouldShow(message)) return shouldShow(message)
return null; ? <CompactPronounsChatComponent message={message} />
: null;
return <CompactPronounsChatComponent message={message} />;
} }
function PronounsChatComponent({ message }: { message: Message; }) { function PronounsChatComponent({ message }: { message: Message; }) {
const result = awaitAndFormatPronouns(message.author.id); const result = useFormattedPronouns(message.author.id);
if (result != null) {
return ( return result
? (
<span <span
className={classes(styles.timestampInline, styles.timestamp)} className={classes(styles.timestampInline, styles.timestamp)}
> {result}</span> > {result}</span>
); )
} : null;
return null;
} }
export function CompactPronounsChatComponent({ message }: { message: Message; }) { export function CompactPronounsChatComponent({ message }: { message: Message; }) {
const result = awaitAndFormatPronouns(message.author.id); const result = useFormattedPronouns(message.author.id);
if (result != null) {
return ( return result
? (
<span <span
className={classes(styles.timestampInline, styles.timestamp, "vc-pronoundb-compact")} className={classes(styles.timestampInline, styles.timestamp, "vc-pronoundb-compact")}
> {result}</span> > {result}</span>
); )
} : null;
return null;
} }

View File

@ -1,61 +0,0 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2022 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { Settings } from "@api/settings";
import { UserStore } from "@webpack/common";
import { awaitAndFormatPronouns } from "../pronoundbUtils";
import { UserProfilePronounsProps, UserProfileProps } from "../types";
export default function PronounsProfileWrapper(PronounsComponent: React.ElementType<UserProfilePronounsProps>, props: UserProfilePronounsProps, profileProps: UserProfileProps) {
const user = UserStore.getUser(profileProps.userId) ?? {};
// Respect showInProfile
if (!Settings.plugins.PronounDB.showInProfile)
return null;
// Don't bother fetching bot or system users
if (user.bot || user.system)
return null;
// Respect showSelf options
if (!Settings.plugins.PronounDB.showSelf && user.id === UserStore.getCurrentUser().id)
return null;
return <ProfilePronouns
userId={profileProps.userId}
Component={PronounsComponent}
leProps={props}
/>;
}
function ProfilePronouns(
{ userId, Component, leProps }: {
userId: string;
Component: React.ElementType<UserProfilePronounsProps>;
leProps: UserProfilePronounsProps;
}
) {
const result = awaitAndFormatPronouns(userId);
// If the promise completed, the result was not "unspecified", and there is a mapping for the code, then render
if (result != null) {
// First child is the header, second is a div with the actual text
leProps.currentPronouns ||= result;
return <Component {...leProps} />;
}
return null;
}

View File

@ -19,20 +19,16 @@
import "./styles.css"; import "./styles.css";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin from "@utils/types";
import PronounsAboutComponent from "./components/PronounsAboutComponent"; import PronounsAboutComponent from "./components/PronounsAboutComponent";
import { CompactPronounsChatComponentWrapper, PronounsChatComponentWrapper } from "./components/PronounsChatComponent"; import { CompactPronounsChatComponentWrapper, PronounsChatComponentWrapper } from "./components/PronounsChatComponent";
import PronounsProfileWrapper from "./components/PronounsProfileWrapper"; import { useProfilePronouns } from "./pronoundbUtils";
import { settings } from "./settings";
export enum PronounsFormat {
Lowercase = "LOWERCASE",
Capitalized = "CAPITALIZED"
}
export default definePlugin({ export default definePlugin({
name: "PronounDB", name: "PronounDB",
authors: [Devs.Tyman, Devs.TheKodeToad], authors: [Devs.Tyman, Devs.TheKodeToad, Devs.Ven],
description: "Adds pronouns to user messages using pronoundb", description: "Adds pronouns to user messages using pronoundb",
patches: [ patches: [
// Add next to username (compact mode) // Add next to username (compact mode)
@ -51,59 +47,30 @@ export default definePlugin({
replace: "[$1, $self.PronounsChatComponentWrapper(e)]" replace: "[$1, $self.PronounsChatComponentWrapper(e)]"
} }
}, },
// Hijack the discord pronouns section and add a wrapper around the text section // Patch the profile popout username header to use our pronoun hook instead of Discord's pronouns
{ {
find: ".Messages.BOT_PROFILE_SLASH_COMMANDS", find: ".userTagNoNickname",
replacement: { replacement: {
match: /\(0,.\.jsx\)\((?<PronounComponent>\i\..),(?<pronounProps>{currentPronouns.+?:(?<fullProps>\i)\.pronouns.+?})\)/, match: /=(\i)\.pronouns/,
replace: "$<fullProps>&&$self.PronounsProfileWrapper($<PronounComponent>,$<pronounProps>,$<fullProps>)" replace: "=$self.useProfilePronouns($1.user.id)"
} }
}, },
// Force enable pronouns component ignoring the experiment value // Patch the profile modal username header to use our pronoun hook instead of Discord's pronouns
{ {
find: ".Messages.USER_POPOUT_PRONOUNS", find: ".USER_PROFILE_ACTIVITY",
replacement: { replacement: {
match: /\.showPronouns/, match: /\).showPronouns/,
replace: ".showPronouns||true" replace: ").showPronouns||true;const vcPronounce=$self.useProfilePronouns(arguments[0].user.id);if(arguments[0].displayProfile)arguments[0].displayProfile.pronouns=vcPronounce"
} }
} }
], ],
options: { settings,
pronounsFormat: {
type: OptionType.SELECT,
description: "The format for pronouns to appear in chat",
options: [
{
label: "Lowercase",
value: PronounsFormat.Lowercase,
default: true
},
{
label: "Capitalized",
value: PronounsFormat.Capitalized
}
]
},
showSelf: {
type: OptionType.BOOLEAN,
description: "Enable or disable showing pronouns for the current user",
default: true
},
showInMessages: {
type: OptionType.BOOLEAN,
description: "Show in messages",
default: true
},
showInProfile: {
type: OptionType.BOOLEAN,
description: "Show in profile",
default: true
}
},
settingsAboutComponent: PronounsAboutComponent, settingsAboutComponent: PronounsAboutComponent,
// Re-export the components on the plugin object so it is easily accessible in patches // Re-export the components on the plugin object so it is easily accessible in patches
PronounsChatComponentWrapper, PronounsChatComponentWrapper,
CompactPronounsChatComponentWrapper, CompactPronounsChatComponentWrapper,
PronounsProfileWrapper useProfilePronouns
}); });

View File

@ -20,10 +20,16 @@ import { Settings } from "@api/settings";
import { VENCORD_USER_AGENT } from "@utils/constants"; import { VENCORD_USER_AGENT } from "@utils/constants";
import { debounce } from "@utils/debounce"; import { debounce } from "@utils/debounce";
import { useAwaiter } from "@utils/misc"; import { useAwaiter } from "@utils/misc";
import { UserStore } from "@webpack/common";
import { PronounsFormat } from "."; import { settings } from "./settings";
import { PronounCode, PronounMapping, PronounsResponse } from "./types"; import { PronounCode, PronounMapping, PronounsResponse } from "./types";
export const enum PronounsFormat {
Lowercase = "LOWERCASE",
Capitalized = "CAPITALIZED"
}
// A map of cached pronouns so the same request isn't sent twice // A map of cached pronouns so the same request isn't sent twice
const cache: Record<string, PronounCode> = {}; const cache: Record<string, PronounCode> = {};
// A map of ids and callbacks that should be triggered on fetch // A map of ids and callbacks that should be triggered on fetch
@ -40,8 +46,8 @@ const bulkFetch = debounce(async () => {
} }
}); });
export function awaitAndFormatPronouns(id: string): string | null { export function useFormattedPronouns(id: string): string | null {
const [result, , isPending] = useAwaiter(() => fetchPronouns(id), { const [result] = useAwaiter(() => fetchPronouns(id), {
fallbackValue: getCachedPronouns(id), fallbackValue: getCachedPronouns(id),
onError: e => console.error("Fetching pronouns failed: ", e) onError: e => console.error("Fetching pronouns failed: ", e)
}); });
@ -53,6 +59,16 @@ export function awaitAndFormatPronouns(id: string): string | null {
return null; return null;
} }
export function useProfilePronouns(id: string) {
const pronouns = useFormattedPronouns(id);
if (!settings.store.showInProfile) return null;
if (!settings.store.showSelf && id === UserStore.getCurrentUser().id) return null;
return pronouns;
}
// Gets the cached pronouns, if you're too impatient for a promise! // Gets the cached pronouns, if you're too impatient for a promise!
export function getCachedPronouns(id: string): PronounCode | null { export function getCachedPronouns(id: string): PronounCode | null {
return cache[id] ?? null; return cache[id] ?? null;

View File

@ -0,0 +1,55 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { definePluginSettings } from "@api/settings";
import { OptionType } from "@utils/types";
import { PronounsFormat } from "./pronoundbUtils";
export const settings = definePluginSettings({
pronounsFormat: {
type: OptionType.SELECT,
description: "The format for pronouns to appear in chat",
options: [
{
label: "Lowercase",
value: PronounsFormat.Lowercase,
default: true
},
{
label: "Capitalized",
value: PronounsFormat.Capitalized
}
]
},
showSelf: {
type: OptionType.BOOLEAN,
description: "Enable or disable showing pronouns for the current user",
default: true
},
showInMessages: {
type: OptionType.BOOLEAN,
description: "Show in messages",
default: true
},
showInProfile: {
type: OptionType.BOOLEAN,
description: "Show in profile",
default: true
}
});

View File

@ -18,8 +18,9 @@
import { addButton, removeButton } from "@api/MessagePopover"; import { addButton, removeButton } from "@api/MessagePopover";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { insertTextIntoChatInputBox } from "@utils/discord";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { ChannelStore, ComponentDispatch } from "@webpack/common"; import { ChannelStore } from "@webpack/common";
export default definePlugin({ export default definePlugin({
name: "QuickMention", name: "QuickMention",
@ -34,7 +35,7 @@ export default definePlugin({
icon: this.Icon, icon: this.Icon,
message: msg, message: msg,
channel: ChannelStore.getChannel(msg.channel_id), channel: ChannelStore.getChannel(msg.channel_id),
onClick: () => ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", { rawText: `<@${msg.author.id}> ` }) onClick: () => insertTextIntoChatInputBox(`<@${msg.author.id}> `)
}; };
}); });
}, },

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { definePluginSettings, migratePluginSettings, Settings } from "@api/settings"; import { definePluginSettings, Settings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack"; import { findByPropsLazy } from "@webpack";
@ -29,7 +29,6 @@ const isMac = navigator.platform.includes("Mac"); // bruh
let replyIdx = -1; let replyIdx = -1;
let editIdx = -1; let editIdx = -1;
migratePluginSettings("QuickReply", "InteractionKeybinds");
const enum MentionOptions { const enum MentionOptions {
DISABLED, DISABLED,

View File

@ -1,40 +0,0 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { FluxEvents } from "@webpack/types";
import { onChannelDelete, onGuildDelete, onRelationshipRemove } from "./functions";
import { syncFriends, syncGroups, syncGuilds } from "./utils";
export const FluxHandlers: Partial<Record<FluxEvents, Array<(data: any) => void>>> = {
GUILD_CREATE: [syncGuilds],
GUILD_DELETE: [onGuildDelete],
CHANNEL_CREATE: [syncGroups],
CHANNEL_DELETE: [onChannelDelete],
RELATIONSHIP_ADD: [syncFriends],
RELATIONSHIP_UPDATE: [syncFriends],
RELATIONSHIP_REMOVE: [syncFriends, onRelationshipRemove]
};
export function forEachEvent(fn: (event: FluxEvents, handler: (data: any) => void) => void) {
for (const event in FluxHandlers) {
for (const cb of FluxHandlers[event]) {
fn(event as FluxEvents, cb);
}
}
}

View File

@ -18,12 +18,10 @@
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { FluxDispatcher } from "@webpack/common";
import { forEachEvent } from "./events"; import { onChannelDelete, onGuildDelete, onRelationshipRemove, removeFriend, removeGroup, removeGuild } from "./functions";
import { removeFriend, removeGroup, removeGuild } from "./functions";
import settings from "./settings"; import settings from "./settings";
import { syncAndRunChecks } from "./utils"; import { syncAndRunChecks, syncFriends, syncGroups, syncGuilds } from "./utils";
export default definePlugin({ export default definePlugin({
name: "RelationshipNotifier", name: "RelationshipNotifier",
@ -55,15 +53,24 @@ export default definePlugin({
} }
], ],
flux: {
GUILD_CREATE: syncGuilds,
GUILD_DELETE: onGuildDelete,
CHANNEL_CREATE: syncGroups,
CHANNEL_DELETE: onChannelDelete,
RELATIONSHIP_ADD: syncFriends,
RELATIONSHIP_UPDATE: syncFriends,
RELATIONSHIP_REMOVE(e) {
onRelationshipRemove(e);
syncFriends();
},
CONNECTION_OPEN: syncAndRunChecks
},
async start() { async start() {
setTimeout(() => { setTimeout(() => {
syncAndRunChecks(); syncAndRunChecks();
}, 5000); }, 5000);
forEachEvent((ev, cb) => FluxDispatcher.subscribe(ev, cb));
},
stop() {
forEachEvent((ev, cb) => FluxDispatcher.unsubscribe(ev, cb));
}, },
removeFriend, removeFriend,

View File

@ -18,7 +18,7 @@
import { DataStore, Notices } from "@api/index"; import { DataStore, Notices } from "@api/index";
import { showNotification } from "@api/Notifications"; import { showNotification } from "@api/Notifications";
import { ChannelStore, GuildStore, RelationshipStore, UserUtils } from "@webpack/common"; import { ChannelStore, GuildStore, RelationshipStore, UserStore, UserUtils } from "@webpack/common";
import settings from "./settings"; import settings from "./settings";
import { ChannelType, RelationshipType, SimpleGroupChannel, SimpleGuild } from "./types"; import { ChannelType, RelationshipType, SimpleGroupChannel, SimpleGuild } from "./types";
@ -30,11 +30,20 @@ const friends = {
requests: [] as string[] requests: [] as string[]
}; };
const guildsKey = () => `relationship-notifier-guilds-${UserStore.getCurrentUser().id}`;
const groupsKey = () => `relationship-notifier-groups-${UserStore.getCurrentUser().id}`;
const friendsKey = () => `relationship-notifier-friends-${UserStore.getCurrentUser().id}`;
async function runMigrations() {
DataStore.delMany(["relationship-notifier-guilds", "relationship-notifier-groups", "relationship-notifier-friends"]);
}
export async function syncAndRunChecks() { export async function syncAndRunChecks() {
await runMigrations();
const [oldGuilds, oldGroups, oldFriends] = await DataStore.getMany([ const [oldGuilds, oldGroups, oldFriends] = await DataStore.getMany([
"relationship-notifier-guilds", guildsKey(),
"relationship-notifier-groups", groupsKey(),
"relationship-notifier-friends" friendsKey()
]) as [Map<string, SimpleGuild> | undefined, Map<string, SimpleGroupChannel> | undefined, Record<"friends" | "requests", string[]> | undefined]; ]) as [Map<string, SimpleGuild> | undefined, Map<string, SimpleGroupChannel> | undefined, Record<"friends" | "requests", string[]> | undefined];
await Promise.all([syncGuilds(), syncGroups(), syncFriends()]); await Promise.all([syncGuilds(), syncGroups(), syncFriends()]);
@ -104,7 +113,7 @@ export async function syncGuilds() {
iconURL: icon && `https://cdn.discordapp.com/icons/${id}/${icon}.png` iconURL: icon && `https://cdn.discordapp.com/icons/${id}/${icon}.png`
}); });
} }
await DataStore.set("relationship-notifier-guilds", guilds); await DataStore.set(guildsKey(), guilds);
} }
export function getGroup(id: string) { export function getGroup(id: string) {
@ -126,7 +135,7 @@ export async function syncGroups() {
}); });
} }
await DataStore.set("relationship-notifier-groups", groups); await DataStore.set(groupsKey(), groups);
} }
export async function syncFriends() { export async function syncFriends() {
@ -145,5 +154,5 @@ export async function syncFriends() {
} }
} }
await DataStore.set("relationship-notifier-friends", friends); await DataStore.set(friendsKey(), friends);
} }

View File

@ -19,6 +19,7 @@
import { Settings } from "@api/settings"; import { Settings } from "@api/settings";
import { Review } from "../entities/Review"; import { Review } from "../entities/Review";
import { ReviewDBUser } from "../entities/User";
import { authorize, showToast } from "./Utils"; import { authorize, showToast } from "./Utils";
const API_URL = "https://manti.vendicated.dev"; const API_URL = "https://manti.vendicated.dev";
@ -32,8 +33,12 @@ interface Response {
updated: boolean; updated: boolean;
} }
const WarningFlag = 0b00000010;
export async function getReviews(id: string): Promise<Review[]> { export async function getReviews(id: string): Promise<Review[]> {
const req = await fetch(API_URL + `/api/reviewdb/users/${id}/reviews`); var flags = 0;
if (!Settings.plugins.ReviewDB.showWarning) flags |= WarningFlag;
const req = await fetch(API_URL + `/api/reviewdb/users/${id}/reviews?flags=${flags}`);
const res = (req.status === 200) ? await req.json() as Response : { success: false, message: "An Error occured while fetching reviews. Please try again later.", reviews: [], updated: false }; const res = (req.status === 200) ? await req.json() as Response : { success: false, message: "An Error occured while fetching reviews. Please try again later.", reviews: [], updated: false };
if (!res.success) { if (!res.success) {
@ -43,6 +48,7 @@ export async function getReviews(id: string): Promise<Review[]> {
id: 0, id: 0,
comment: "An Error occured while fetching reviews. Please try again later.", comment: "An Error occured while fetching reviews. Please try again later.",
star: 0, star: 0,
timestamp: 0,
sender: { sender: {
id: 0, id: 0,
username: "Error", username: "Error",
@ -108,8 +114,10 @@ export async function reportReview(id: number) {
showToast(await res.message); showToast(await res.message);
} }
export function getLastReviewID(id: string): Promise<number> { export function getCurrentUserInfo(token: string): Promise<ReviewDBUser> {
return fetch(API_URL + "/getLastReviewID?discordid=" + id) return fetch(API_URL + "/api/reviewdb/users", {
.then(r => r.text()) body: JSON.stringify({ token }),
.then(Number); method: "POST",
})
.then(r => r.json());
} }

View File

@ -17,13 +17,13 @@
*/ */
import { Settings } from "@api/settings"; import { Settings } from "@api/settings";
import { Devs } from "@utils/constants";
import Logger from "@utils/Logger"; import Logger from "@utils/Logger";
import { openModal } from "@utils/modal"; import { openModal } from "@utils/modal";
import { findByProps } from "@webpack"; import { findByProps } from "@webpack";
import { FluxDispatcher, React, SelectedChannelStore, Toasts, UserUtils } from "@webpack/common"; import { FluxDispatcher, React, SelectedChannelStore, Toasts, UserUtils } from "@webpack/common";
import { Review } from "../entities/Review"; import { Review } from "../entities/Review";
import { UserType } from "../entities/User";
export async function openUserProfileModal(userId: string) { export async function openUserProfileModal(userId: string) {
await UserUtils.fetchUser(userId); await UserUtils.fetchUser(userId);
@ -86,10 +86,5 @@ export function showToast(text: string) {
export const sleep = (ms: number) => new Promise(r => setTimeout(r, ms)); export const sleep = (ms: number) => new Promise(r => setTimeout(r, ms));
export function canDeleteReview(review: Review, userId: string) { export function canDeleteReview(review: Review, userId: string) {
if (review.sender.discordID === userId) return true; if (review.sender.discordID === userId || Settings.plugins.ReviewDB.userType === UserType.Admin) return true;
const myId = BigInt(userId);
return myId === Devs.mantikafasi.id ||
myId === Devs.Ven.id ||
myId === Devs.rushii.id;
} }

View File

@ -16,9 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Settings } from "@api/settings";
import { classes, LazyComponent } from "@utils/misc"; import { classes, LazyComponent } from "@utils/misc";
import { filters, findBulk } from "@webpack"; import { filters, findBulk } from "@webpack";
import { Alerts, UserStore } from "@webpack/common"; import { Alerts, moment, Timestamp, UserStore } from "@webpack/common";
import { Review } from "../entities/Review"; import { Review } from "../entities/Review";
import { deleteReview, reportReview } from "../Utils/ReviewDBAPI"; import { deleteReview, reportReview } from "../Utils/ReviewDBAPI";
@ -32,7 +33,7 @@ export default LazyComponent(() => {
const [ const [
{ cozyMessage, buttons, message, groupStart }, { cozyMessage, buttons, message, groupStart },
{ container, isHeader }, { container, isHeader },
{ avatar, clickable, username, messageContent, wrapper, cozy }, { avatar, clickable, username, messageContent, wrapper, cozy, timestampInline, timestamp },
{ contents }, { contents },
buttonClasses, buttonClasses,
{ defaultColor } { defaultColor }
@ -102,6 +103,16 @@ export default LazyComponent(() => {
{review.sender.username} {review.sender.username}
</span> </span>
{review.sender.badges.map(badge => <ReviewBadge {...badge} />)} {review.sender.badges.map(badge => <ReviewBadge {...badge} />)}
{
!Settings.plugins.ReviewDB.hideTimestamps && (
<Timestamp
timestamp={moment(review.timestamp * 1000)}
compact={true}
/>
)
}
<p <p
className={classes(messageContent, defaultColor)} className={classes(messageContent, defaultColor)}
style={{ fontSize: 15, marginTop: 4 }} style={{ fontSize: 15, marginTop: 4 }}

View File

@ -16,18 +16,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Settings } from "@api/settings";
import { classes, useAwaiter } from "@utils/misc"; import { classes, useAwaiter } from "@utils/misc";
import { findLazy } from "@webpack"; import { findLazy } from "@webpack";
import { Forms, React, Text, UserStore } from "@webpack/common"; import { Forms, React, Text, UserStore } from "@webpack/common";
import type { KeyboardEvent } from "react"; import type { KeyboardEvent } from "react";
import { addReview, getReviews } from "../Utils/ReviewDBAPI"; import { addReview, getReviews } from "../Utils/ReviewDBAPI";
import { showToast } from "../Utils/Utils"; import { authorize, showToast } from "../Utils/Utils";
import ReviewComponent from "./ReviewComponent"; import ReviewComponent from "./ReviewComponent";
const Classes = findLazy(m => typeof m.textarea === "string"); const Classes = findLazy(m => typeof m.textarea === "string");
export default function ReviewsView({ userId }: { userId: string; }) { export default function ReviewsView({ userId }: { userId: string; }) {
const { token } = Settings.plugins.ReviewDB;
const [refetchCount, setRefetchCount] = React.useState(0); const [refetchCount, setRefetchCount] = React.useState(0);
const [reviews, _, isLoading] = useAwaiter(() => getReviews(userId), { const [reviews, _, isLoading] = useAwaiter(() => getReviews(userId), {
fallbackValue: [], fallbackValue: [],
@ -57,7 +59,7 @@ export default function ReviewsView({ userId }: { userId: string; }) {
} }
return ( return (
<div className="ReviewDB"> <div className="vc-reviewdb-view">
<Text <Text
tag="h2" tag="h2"
variant="eyebrow" variant="eyebrow"
@ -83,8 +85,21 @@ export default function ReviewsView({ userId }: { userId: string; }) {
<textarea <textarea
className={classes(Classes.textarea.replace("textarea", ""), "enter-comment")} className={classes(Classes.textarea.replace("textarea", ""), "enter-comment")}
// this produces something like '-_59yqs ...' but since no class exists with that name its fine // this produces something like '-_59yqs ...' but since no class exists with that name its fine
placeholder={reviews?.some(r => r.sender.discordID === UserStore.getCurrentUser().id) ? `Update review for @${username}` : `Review @${username}`} placeholder={
token
? (reviews?.some(r => r.sender.discordID === UserStore.getCurrentUser().id)
? `Update review for @${username}`
: `Review @${username}`)
: "You need to authorize to review users!"
}
onKeyDown={onKeyPress} onKeyDown={onKeyPress}
onClick={() => {
if (!token) {
showToast("Opening authorization window...");
authorize();
}
}}
style={{ style={{
marginTop: "6px", marginTop: "6px",
resize: "none", resize: "none",

View File

@ -31,4 +31,5 @@ export interface Review {
id: number, id: number,
star: number, star: number,
sender: Sender, sender: Sender,
timestamp: number
} }

View File

@ -0,0 +1,28 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
export const enum UserType {
Banned = -1,
Normal = 0,
Admin = 1
}
export interface ReviewDBUser {
lastReviewID: number,
type: UserType;
}

View File

@ -16,15 +16,17 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import "./style.css";
import { Settings } from "@api/settings"; import { Settings } from "@api/settings";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { Button, UserStore } from "@webpack/common"; import { Button } from "@webpack/common";
import { User } from "discord-types/general"; import { User } from "discord-types/general";
import ReviewsView from "./components/ReviewsView"; import ReviewsView from "./components/ReviewsView";
import { getLastReviewID } from "./Utils/ReviewDBAPI"; import { getCurrentUserInfo } from "./Utils/ReviewDBAPI";
import { authorize, showToast } from "./Utils/Utils"; import { authorize, showToast } from "./Utils/Utils";
export default definePlugin({ export default definePlugin({
@ -38,7 +40,7 @@ export default definePlugin({
replacement: { replacement: {
match: /\(.{0,10}\{user:(.),setNote:.,canDM:.,.+?\}\)/, match: /\(.{0,10}\{user:(.),setNote:.,canDM:.,.+?\}\)/,
replace: "$&,$self.getReviewsComponent($1)" replace: "$&,$self.getReviewsComponent($1)"
}, }
} }
], ],
@ -56,19 +58,31 @@ export default definePlugin({
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,
description: "Notify about new reviews on startup", description: "Notify about new reviews on startup",
default: true, default: true,
},
showWarning: {
type: OptionType.BOOLEAN,
description: "Display warning to be respectful at the top of the reviews list",
default: true,
},
hideTimestamps: {
type: OptionType.BOOLEAN,
description: "Hide timestamps on reviews",
default: false,
} }
}, },
async start() { async start() {
const settings = Settings.plugins.ReviewDB; const settings = Settings.plugins.ReviewDB;
if (!settings.lastReviewId || !settings.notifyReviews) return; if (!settings.notifyReviews || !settings.token) return;
setTimeout(async () => { setTimeout(async () => {
const id = await getLastReviewID(UserStore.getCurrentUser().id); const user = await getCurrentUserInfo(settings.token);
if (settings.lastReviewId < id) { if (settings.lastReviewId < user.lastReviewID) {
settings.lastReviewId = user.lastReviewID;
if (user.lastReviewID !== 0)
showToast("You have new reviews on your profile!"); showToast("You have new reviews on your profile!");
settings.lastReviewId = id;
} }
settings.userType = user.type;
}, 4000); }, 4000);
}, },

View File

@ -0,0 +1,3 @@
[class|="section"]:not([class|="lastSection"]) + .vc-reviewdb-view {
margin-top: 12px;
}

View File

@ -53,7 +53,7 @@ export default definePlugin({
replacement: [ replacement: [
{ {
match: /user:(\i),channel:(\i).{0,300}?"@"\.concat\(.+?\)/, match: /user:(\i),channel:(\i).{0,300}?"@"\.concat\(.+?\)/,
replace: "$&,color:$self.getUserColor($1.id,{channelId:$2?.id})" replace: "$&,color:$self.getUserColor($1?.id,{channelId:$2?.id})"
} }
], ],
predicate: () => settings.store.chatMentions, predicate: () => settings.store.chatMentions,
@ -99,10 +99,12 @@ export default definePlugin({
if (!(guildId ??= ChannelStore.getChannel(channelId!)?.guild_id)) return null; if (!(guildId ??= ChannelStore.getChannel(channelId!)?.guild_id)) return null;
return GuildMemberStore.getMember(guildId, userId)?.colorString ?? null; return GuildMemberStore.getMember(guildId, userId)?.colorString ?? null;
}, },
getUserColor(userId: string, ids: { channelId?: string; guildId?: string; }) { getUserColor(userId: string, ids: { channelId?: string; guildId?: string; }) {
const colorString = this.getColor(userId, ids); const colorString = this.getColor(userId, ids);
return colorString && parseInt(colorString.slice(1), 16); return colorString && parseInt(colorString.slice(1), 16);
}, },
roleGroupColor({ id, count, title, guildId }: { id: string; count: number; title: string; guildId: string; }) { roleGroupColor({ id, count, title, guildId }: { id: string; count: number; title: string; guildId: string; }) {
const guild = GuildStore.getGuild(guildId); const guild = GuildStore.getGuild(guildId);
const role = guild?.roles[id]; const role = guild?.roles[id];
@ -113,6 +115,7 @@ export default definePlugin({
letterSpacing: ".05em" letterSpacing: ".05em"
}}>{title} &mdash; {count}</span>; }}>{title} &mdash; {count}</span>;
}, },
getVoiceProps({ user: { id: userId }, guildId }: { user: { id: string; }; guildId: string; }) { getVoiceProps({ user: { id: userId }, guildId }: { user: { id: string; }; guildId: string; }) {
return { return {
style: { style: {

View File

@ -21,11 +21,11 @@ import "./styles.css";
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents"; import { addPreSendListener, removePreSendListener } from "@api/MessageEvents";
import { classNameFactory } from "@api/Styles"; import { classNameFactory } from "@api/Styles";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { getTheme, Theme } from "@utils/discord"; import { getTheme, insertTextIntoChatInputBox, Theme } from "@utils/discord";
import { Margins } from "@utils/margins"; import { Margins } from "@utils/margins";
import { closeModal, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/modal"; import { closeModal, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/modal";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { Button, ButtonLooks, ButtonWrapperClasses, ComponentDispatch, Forms, Parser, Select, Tooltip, useMemo, useState } from "@webpack/common"; import { Button, ButtonLooks, ButtonWrapperClasses, Forms, Parser, Select, Tooltip, useMemo, useState } from "@webpack/common";
function parseTime(time: string) { function parseTime(time: string) {
const cleanTime = time.slice(1, -1).replace(/(\d)(AM|PM)$/i, "$1 $2"); const cleanTime = time.slice(1, -1).replace(/(\d)(AM|PM)$/i, "$1 $2");
@ -104,7 +104,7 @@ function PickerModal({ rootProps, close }: { rootProps: ModalProps, close(): voi
<ModalFooter> <ModalFooter>
<Button <Button
onClick={() => { onClick={() => {
ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", { rawText: formatted }); insertTextIntoChatInputBox(formatted + " ");
close(); close();
}} }}
>Insert</Button> >Insert</Button>

View File

@ -22,7 +22,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { useForceUpdater } from "@utils/misc"; import { useForceUpdater } from "@utils/misc";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { FluxDispatcher, GuildStore,PresenceStore, RelationshipStore } from "@webpack/common"; import { GuildStore, PresenceStore, RelationshipStore } from "@webpack/common";
enum IndicatorType { enum IndicatorType {
SERVER = 1 << 0, SERVER = 1 << 0,
@ -71,6 +71,24 @@ function ServersIndicator() {
); );
} }
function handlePresenceUpdate() {
onlineFriends = 0;
const relations = RelationshipStore.getRelationships();
for (const id of Object.keys(relations)) {
const type = relations[id];
// FRIEND relationship type
if (type === 1 && PresenceStore.getStatus(id) !== "offline") {
onlineFriends += 1;
}
}
forceUpdateFriendCount?.();
}
function handleGuildUpdate() {
guildCount = GuildStore.getGuildCount();
forceUpdateGuildCount?.();
}
export default definePlugin({ export default definePlugin({
name: "ServerListIndicators", name: "ServerListIndicators",
description: "Add online friend count or server count in the server list", description: "Add online friend count or server count in the server list",
@ -99,37 +117,21 @@ export default definePlugin({
</ErrorBoundary>; </ErrorBoundary>;
}, },
handlePresenceUpdate() { flux: {
onlineFriends = 0; PRESENCE_UPDATES: handlePresenceUpdate,
const relations = RelationshipStore.getRelationships(); GUILD_CREATE: handleGuildUpdate,
for (const id of Object.keys(relations)) { GUILD_DELETE: handleGuildUpdate,
const type = relations[id];
// FRIEND relationship type
if (type === 1 && PresenceStore.getStatus(id) !== "offline") {
onlineFriends += 1;
}
}
forceUpdateFriendCount?.();
}, },
handleGuildUpdate() {
guildCount = GuildStore.getGuildCount();
forceUpdateGuildCount?.();
},
start() { start() {
this.handlePresenceUpdate();
this.handleGuildUpdate();
addServerListElement(ServerListRenderPosition.Above, this.renderIndicator); addServerListElement(ServerListRenderPosition.Above, this.renderIndicator);
FluxDispatcher.subscribe("PRESENCE_UPDATES", this.handlePresenceUpdate);
FluxDispatcher.subscribe("GUILD_CREATE", this.handleGuildUpdate); handlePresenceUpdate();
FluxDispatcher.subscribe("GUILD_DELETE", this.handleGuildUpdate); handleGuildUpdate();
}, },
stop() { stop() {
removeServerListElement(ServerListRenderPosition.Above, this.renderIndicator); removeServerListElement(ServerListRenderPosition.Above, this.renderIndicator);
FluxDispatcher.unsubscribe("PRESENCE_UPDATES", this.handlePresenceUpdate);
FluxDispatcher.unsubscribe("GUILD_CREATE", this.handleGuildUpdate);
FluxDispatcher.unsubscribe("GUILD_DELETE", this.handleGuildUpdate);
} }
}); });

View File

@ -0,0 +1,173 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import "./styles.css";
import { definePluginSettings } from "@api/settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { copyWithToast, LazyComponent } from "@utils/misc";
import definePlugin, { OptionType } from "@utils/types";
import { findByCode, findByCodeLazy, findByPropsLazy, findStoreLazy } from "@webpack";
import { Text, Tooltip } from "@webpack/common";
import { User } from "discord-types/general";
const Section = LazyComponent(() => findByCode("().lastSection"));
const UserProfileStore = findStoreLazy("UserProfileStore");
const ThemeStore = findStoreLazy("ThemeStore");
const platforms: { get(type: string): ConnectionPlatform; } = findByPropsLazy("isSupported", "getByUrl");
const getTheme: (user: User, displayProfile: any) => any = findByCodeLazy(',"--profile-gradient-primary-color"');
const enum Spacing {
COMPACT,
COZY,
ROOMY
}
const getSpacingPx = (spacing: Spacing | undefined) => (spacing ?? Spacing.COMPACT) * 2 + 4;
const settings = definePluginSettings({
iconSize: {
type: OptionType.NUMBER,
description: "Icon size (px)",
default: 32
},
iconSpacing: {
type: OptionType.SELECT,
description: "Icon margin",
default: Spacing.COZY,
options: [
{ label: "Compact", value: Spacing.COMPACT },
{ label: "Cozy", value: Spacing.COZY }, // US Spelling :/
{ label: "Roomy", value: Spacing.ROOMY }
]
}
});
interface Connection {
type: string;
id: string;
name: string;
verified: boolean;
}
interface ConnectionPlatform {
getPlatformUserUrl(connection: Connection): string;
icon: { lightSVG: string, darkSVG: string; };
}
const profilePopoutComponent = ErrorBoundary.wrap(e =>
<ConnectionsComponent id={e.user.id} theme={getTheme(e.user, e.displayProfile).profileTheme} />
);
const profilePanelComponent = ErrorBoundary.wrap(e =>
<ConnectionsComponent id={e.channel.recipients[0]} theme={ThemeStore.theme} />
);
function ConnectionsComponent({ id, theme }: { id: string, theme: string; }) {
const profile = UserProfileStore.getUserProfile(id);
if (!profile)
return null;
const connections: Connection[] = profile.connectedAccounts;
if (!connections?.length)
return null;
return (
<Section>
<Text
tag="h2"
variant="eyebrow"
style={{ color: "var(--header-primary)" }}
>
Connections
</Text>
{connections.map(connection => <CompactConnectionComponent connection={connection} theme={theme} />)}
</Section>
);
}
function CompactConnectionComponent({ connection, theme }: { connection: Connection, theme: string; }) {
const platform = platforms.get(connection.type);
const url = platform.getPlatformUserUrl?.(connection);
const img = (
<img
aria-label={connection.name}
src={theme === "light" ? platform.icon.lightSVG : platform.icon.darkSVG}
style={{
marginTop: getSpacingPx(settings.store.iconSpacing),
marginRight: getSpacingPx(settings.store.iconSpacing),
width: settings.store.iconSize,
height: settings.store.iconSize
}}
/>
);
return (
<Tooltip
text={`${connection.name}${!connection.verified ? " (unverified)" : ""} (click to ${url ? "open" : "copy"})`}
key={connection.id}
>
{tooltipProps =>
url
? <a
{...tooltipProps}
className="vc-user-connection"
href={url}
target="_blank"
>
{img}
</a>
: <button
{...tooltipProps}
className="vc-user-connection"
onClick={() => copyWithToast(connection.name)}
>
{img}
</button>
}
</Tooltip>
);
}
export default definePlugin({
name: "ShowConnections",
description: "Show connected accounts in user popouts",
authors: [Devs.TheKodeToad],
patches: [
{
find: ".Messages.BOT_PROFILE_SLASH_COMMANDS",
replacement: {
match: /,theme:\i\}\)(?=,.{0,100}setNote:)/,
replace: "$&,$self.profilePopoutComponent(arguments[0])"
}
},
{
find: "\"Profile Panel: user cannot be undefined\"",
replacement: {
// createElement(Divider, {}), createElement(NoteComponent)
match: /\(0,\i\.jsx\)\(\i\.\i,\{\}\).{0,100}setNote:/,
replace: "$self.profilePanelComponent(arguments[0]),$&"
}
}
],
settings,
profilePopoutComponent,
profilePanelComponent
});

View File

@ -0,0 +1,5 @@
.vc-user-connection {
all: unset;
display: inline-block;
cursor: pointer;
}

View File

@ -17,22 +17,41 @@
*/ */
import { addPreSendListener, removePreSendListener, SendListener } from "@api/MessageEvents"; import { addPreSendListener, removePreSendListener, SendListener } from "@api/MessageEvents";
import { definePluginSettings } from "@api/settings";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { Button, ButtonLooks, ButtonWrapperClasses, React, Tooltip } from "@webpack/common"; import { Button, ButtonLooks, ButtonWrapperClasses, React, Tooltip } from "@webpack/common";
let lastState = false;
const settings = definePluginSettings({
persistState: {
type: OptionType.BOOLEAN,
description: "Whether to persist the state of the silent message toggle when changing channels",
default: false,
onChange(newValue: boolean) {
if (newValue === false) lastState = false;
}
}
});
function SilentMessageToggle(chatBoxProps: { function SilentMessageToggle(chatBoxProps: {
type: { type: {
analyticsName: string; analyticsName: string;
}; };
}) { }) {
const [enabled, setEnabled] = React.useState(false); const [enabled, setEnabled] = React.useState(lastState);
function setEnabledValue(value: boolean) {
if (settings.store.persistState) lastState = value;
setEnabled(value);
}
React.useEffect(() => { React.useEffect(() => {
const listener: SendListener = (_, message) => { const listener: SendListener = (_, message) => {
if (enabled) { if (enabled) {
setEnabled(false); setEnabledValue(false);
if (!message.content.startsWith("@silent ")) message.content = "@silent " + message.content; if (!message.content.startsWith("@silent ")) message.content = "@silent " + message.content;
} }
}; };
@ -49,7 +68,7 @@ function SilentMessageToggle(chatBoxProps: {
<div style={{ display: "flex" }}> <div style={{ display: "flex" }}>
<Button <Button
{...tooltipProps} {...tooltipProps}
onClick={() => setEnabled(prev => !prev)} onClick={() => setEnabledValue(!enabled)}
size="" size=""
look={ButtonLooks.BLANK} look={ButtonLooks.BLANK}
innerClassName={ButtonWrapperClasses.button} innerClassName={ButtonWrapperClasses.button}
@ -79,6 +98,9 @@ export default definePlugin({
name: "SilentMessageToggle", name: "SilentMessageToggle",
authors: [Devs.Nuckyz], authors: [Devs.Nuckyz],
description: "Adds a button to the chat bar to toggle sending a silent message.", description: "Adds a button to the chat bar to toggle sending a silent message.",
dependencies: ["MessageEventsAPI"],
settings,
patches: [ patches: [
{ {
find: ".activeCommandOption", find: ".activeCommandOption",

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { definePluginSettings, migratePluginSettings } from "@api/settings"; import { definePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
@ -35,7 +35,6 @@ const settings = definePluginSettings({
} }
}); });
migratePluginSettings("SpotifyCrack", "Ify");
export default definePlugin({ export default definePlugin({
name: "SpotifyCrack", name: "SpotifyCrack",
description: "Free listen along, no auto-pausing in voice chat, and allows activity to continue playing when idling", description: "Free listen along, no auto-pausing in voice chat, and allows activity to continue playing when idling",

View File

@ -17,7 +17,6 @@
*/ */
import { ApplicationCommandInputType, sendBotMessage } from "@api/Commands"; import { ApplicationCommandInputType, sendBotMessage } from "@api/Commands";
import { migratePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { findByPropsLazy } from "@webpack"; import { findByPropsLazy } from "@webpack";
@ -74,7 +73,6 @@ function sendMessage(channelId, message) {
}); });
} }
migratePluginSettings("SpotifyShareCommands", "Sendify");
export default definePlugin({ export default definePlugin({
name: "SpotifyShareCommands", name: "SpotifyShareCommands",
description: "Share your current Spotify track, album or artist via slash command (/track, /album, /artist)", description: "Share your current Spotify track, album or artist via slash command (/track, /album, /artist)",

View File

@ -21,7 +21,7 @@ import { Devs, SUPPORT_CHANNEL_ID } from "@utils/constants";
import { makeCodeblock } from "@utils/misc"; import { makeCodeblock } from "@utils/misc";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { isOutdated } from "@utils/updater"; import { isOutdated } from "@utils/updater";
import { Alerts, FluxDispatcher, Forms, UserStore } from "@webpack/common"; import { Alerts, Forms, UserStore } from "@webpack/common";
import gitHash from "~git-hash"; import gitHash from "~git-hash";
import plugins from "~plugins"; import plugins from "~plugins";
@ -69,18 +69,16 @@ ${makeCodeblock(Object.keys(plugins).filter(Vencord.Plugins.isPluginEnabled).joi
} }
}], }],
rememberDismiss() { flux: {
DataStore.set(REMEMBER_DISMISS_KEY, gitHash); async CHANNEL_SELECT({ channelId }) {
},
start() {
FluxDispatcher.subscribe("CHANNEL_SELECT", async ({ channelId }) => {
if (channelId !== SUPPORT_CHANNEL_ID) return; if (channelId !== SUPPORT_CHANNEL_ID) return;
const myId = BigInt(UserStore.getCurrentUser().id); const myId = BigInt(UserStore.getCurrentUser().id);
if (Object.values(Devs).some(d => d.id === myId)) return; if (Object.values(Devs).some(d => d.id === myId)) return;
if (isOutdated && gitHash !== await DataStore.get(REMEMBER_DISMISS_KEY)) { if (isOutdated && gitHash !== await DataStore.get(REMEMBER_DISMISS_KEY)) {
const rememberDismiss = () => DataStore.set(REMEMBER_DISMISS_KEY, gitHash);
Alerts.show({ Alerts.show({
title: "Hold on!", title: "Hold on!",
body: <div> body: <div>
@ -90,10 +88,10 @@ ${makeCodeblock(Object.keys(plugins).filter(Vencord.Plugins.isPluginEnabled).joi
to do so, in case you can't access the Updater page. to do so, in case you can't access the Updater page.
</Forms.FormText> </Forms.FormText>
</div>, </div>,
onCancel: this.rememberDismiss, onCancel: rememberDismiss,
onConfirm: this.rememberDismiss onConfirm: rememberDismiss
}); });
} }
}); }
} }
}); });

View File

@ -24,7 +24,7 @@ import { findByCodeLazy } from "@webpack";
import { GuildMemberStore, React, RelationshipStore, SelectedChannelStore } from "@webpack/common"; import { GuildMemberStore, React, RelationshipStore, SelectedChannelStore } from "@webpack/common";
import { User } from "discord-types/general"; import { User } from "discord-types/general";
const Avatar = findByCodeLazy('"top",spacing:'); const Avatar = findByCodeLazy(".typingIndicatorRef", "svg");
const openProfile = findByCodeLazy("friendToken", "USER_PROFILE_MODAL_OPEN"); const openProfile = findByCodeLazy("friendToken", "USER_PROFILE_MODAL_OPEN");
const settings = definePluginSettings({ const settings = definePluginSettings({

View File

@ -0,0 +1,10 @@
:is([class*="userProfile"], [class*="userPopout"]) [class*="bannerPremium"] {
background: center / cover no-repeat;
position: relative;
z-index: -1;
}
[class*="NonPremium"]:has([class*="bannerPremium"]) [class*="avatarPositionNormal"],
[class*="PremiumWithoutBanner"]:has([class*="bannerPremium"]) [class*="avatarPositionPremiumNoBanner"] {
top: 76px;
}

View File

@ -0,0 +1,85 @@
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { definePluginSettings } from "@api/settings";
import { enableStyle } from "@api/Styles";
import { Link } from "@components/Link";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import style from "./index.css?managed";
const BASE_URL = "https://raw.githubusercontent.com/AutumnVN/usrbg/main/usrbg.json";
let data = {} as Record<string, string>;
const settings = definePluginSettings({
nitroFirst: {
description: "Banner to use if both Nitro and USRBG banners are present",
type: OptionType.SELECT,
options: [
{ label: "Nitro banner", value: true, default: true },
{ label: "USRBG banner", value: false },
]
}
});
export default definePlugin({
name: "USRBG",
description: "USRBG is a community maintained database of Discord banners, allowing anyone to get a banner without requiring Nitro",
authors: [Devs.AutumnVN, Devs.pylix],
settings,
patches: [
{
find: ".NITRO_BANNER,",
replacement: [
{
match: /(\i)\.premiumType/,
replace: "$self.premiumHook($1)||$&"
},
{
match: /(\i)\.bannerSrc,/,
replace: "$self.useBannerHook($1),"
}
]
}
],
settingsAboutComponent: () => {
return (
<Link href="https://github.com/AutumnVN/usrbg#how-to-request-your-own-usrbg-banner">CLICK HERE TO GET YOUR OWN BANNER</Link>
);
},
useBannerHook({ displayProfile, user }: any) {
if (displayProfile?.banner && settings.store.nitroFirst) return;
if (data[user.id]) return data[user.id];
},
premiumHook({ userId }: any) {
if (data[userId]) return 2;
},
async start() {
enableStyle(style);
const res = await fetch(BASE_URL);
if (res.ok)
data = await res.json();
}
});

View File

@ -16,7 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { migratePluginSettings } from "@api/settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { ChannelStore, SelectedChannelStore } from "@webpack/common"; import { ChannelStore, SelectedChannelStore } from "@webpack/common";
@ -26,7 +25,6 @@ const timers = {} as Record<string, {
i: number; i: number;
}>; }>;
migratePluginSettings("VoiceChatDoubleClick", "vcDoubleClick");
export default definePlugin({ export default definePlugin({
name: "VoiceChatDoubleClick", name: "VoiceChatDoubleClick",
description: "Join voice chats via double click instead of single click", description: "Join voice chats via double click instead of single click",

View File

@ -24,7 +24,7 @@ import { Margins } from "@utils/margins";
import { wordsToTitle } from "@utils/text"; import { wordsToTitle } from "@utils/text";
import definePlugin, { OptionType, PluginOptionsItem } from "@utils/types"; import definePlugin, { OptionType, PluginOptionsItem } from "@utils/types";
import { findByPropsLazy } from "@webpack"; import { findByPropsLazy } from "@webpack";
import { Button, ChannelStore, FluxDispatcher, Forms, SelectedChannelStore, useMemo, UserStore } from "@webpack/common"; import { Button, ChannelStore, Forms, SelectedChannelStore, useMemo, UserStore } from "@webpack/common";
interface VoiceState { interface VoiceState {
userId: string; userId: string;
@ -137,7 +137,19 @@ function updateStatuses(type: string, { deaf, mute, selfDeaf, selfMute, userId,
} }
*/ */
function handleVoiceStates({ voiceStates }: { voiceStates: VoiceState[]; }) { function playSample(tempSettings: any, type: string) {
const settings = Object.assign({}, Settings.plugins.VcNarrator, tempSettings);
speak(formatText(settings[type + "Message"], UserStore.getCurrentUser().username, "general"), settings);
}
export default definePlugin({
name: "VcNarrator",
description: "Announces when users join, leave, or move voice channels via narrator",
authors: [Devs.Ven],
flux: {
VOICE_STATE_UPDATES({ voiceStates }: { voiceStates: VoiceState[]; }) {
const myChanId = SelectedChannelStore.getVoiceChannelId(); const myChanId = SelectedChannelStore.getVoiceChannelId();
const myId = UserStore.getCurrentUser().id; const myId = UserStore.getCurrentUser().id;
@ -160,18 +172,18 @@ function handleVoiceStates({ voiceStates }: { voiceStates: VoiceState[]; }) {
// updateStatuses(type, state, isMe); // updateStatuses(type, state, isMe);
} }
} },
function handleToggleSelfMute() { AUDIO_TOGGLE_SELF_MUTE() {
const chanId = SelectedChannelStore.getVoiceChannelId()!; const chanId = SelectedChannelStore.getVoiceChannelId()!;
const s = VoiceStateStore.getVoiceStateForChannel(chanId) as VoiceState; const s = VoiceStateStore.getVoiceStateForChannel(chanId) as VoiceState;
if (!s) return; if (!s) return;
const event = s.mute || s.selfMute ? "unmute" : "mute"; const event = s.mute || s.selfMute ? "unmute" : "mute";
speak(formatText(Settings.plugins.VcNarrator[event + "Message"], "", ChannelStore.getChannel(chanId).name)); speak(formatText(Settings.plugins.VcNarrator[event + "Message"], "", ChannelStore.getChannel(chanId).name));
} },
function handleToggleSelfDeafen() { AUDIO_TOGGLE_SELF_DEAF() {
const chanId = SelectedChannelStore.getVoiceChannelId()!; const chanId = SelectedChannelStore.getVoiceChannelId()!;
const s = VoiceStateStore.getVoiceStateForChannel(chanId) as VoiceState; const s = VoiceStateStore.getVoiceStateForChannel(chanId) as VoiceState;
if (!s) return; if (!s) return;
@ -179,17 +191,7 @@ function handleToggleSelfDeafen() {
const event = s.deaf || s.selfDeaf ? "undeafen" : "deafen"; const event = s.deaf || s.selfDeaf ? "undeafen" : "deafen";
speak(formatText(Settings.plugins.VcNarrator[event + "Message"], "", ChannelStore.getChannel(chanId).name)); speak(formatText(Settings.plugins.VcNarrator[event + "Message"], "", ChannelStore.getChannel(chanId).name));
} }
},
function playSample(tempSettings: any, type: string) {
const settings = Object.assign({}, Settings.plugins.VcNarrator, tempSettings);
speak(formatText(settings[type + "Message"], UserStore.getCurrentUser().username, "general"), settings);
}
export default definePlugin({
name: "VcNarrator",
description: "Announces when users join, leave, or move voice channels via narrator",
authors: [Devs.Ven],
start() { start() {
if (typeof speechSynthesis === "undefined" || speechSynthesis.getVoices().length === 0) { if (typeof speechSynthesis === "undefined" || speechSynthesis.getVoices().length === 0) {
@ -199,15 +201,6 @@ export default definePlugin({
return; return;
} }
FluxDispatcher.subscribe("VOICE_STATE_UPDATES", handleVoiceStates);
FluxDispatcher.subscribe("AUDIO_TOGGLE_SELF_MUTE", handleToggleSelfMute);
FluxDispatcher.subscribe("AUDIO_TOGGLE_SELF_DEAF", handleToggleSelfDeafen);
},
stop() {
FluxDispatcher.unsubscribe("VOICE_STATE_UPDATES", handleVoiceStates);
FluxDispatcher.subscribe("AUDIO_TOGGLE_SELF_MUTE", handleToggleSelfMute);
FluxDispatcher.subscribe("AUDIO_TOGGLE_SELF_DEAF", handleToggleSelfDeafen);
}, },
optionsCache: null as Record<string, PluginOptionsItem> | null, optionsCache: null as Record<string, PluginOptionsItem> | null,

View File

@ -167,26 +167,30 @@ export default definePlugin({
}, },
patches: [ patches: [
// Make pfps clickable
{ {
find: "onAddFriend:", find: "onAddFriend:",
replacement: { replacement: {
// global because Discord has two components that are 99% identical with one small change ._. match: /\{src:(\i)(?=,avatarDecoration)/,
match: /\{src:(\i),avatarDecoration/g, replace: "{src:$1,onClick:()=>$self.openImage($1)"
replace: "{src:$1,onClick:()=>$self.openImage($1),avatarDecoration"
} }
}, { },
find: ".popoutNoBannerPremium", // Make banners clickable
{
find: ".NITRO_BANNER,",
replacement: { replacement: {
match: /style:.{0,10}\{\},(\i)\)/, // style: { backgroundImage: shouldShowBanner ? "url(".concat(bannerUrl,
match: /style:\{(?=backgroundImage:(\i&&\i)\?"url\("\.concat\((\i),)/,
replace: replace:
"onClick:$1.backgroundImage&&($1.cursor=\"pointer\"," + // onClick: () => shouldShowBanner && openImage(bannerUrl), style: { cursor: shouldShowBanner ? "pointer" : void 0,
"()=>$self.openImage($1.backgroundImage.replace(\"url(\", \"\"))),$&" 'onClick:()=>$1&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,'
} }
}, { },
{
find: "().avatarWrapperNonUserBot", find: "().avatarWrapperNonUserBot",
replacement: { replacement: {
match: /(avatarPositionPanel.+?)onClick:(\i\|\|\i)\?void 0(?<=,(\i)=\i\.avatarSrc.+?)/, match: /(?<=avatarPositionPanel.+?)onClick:(\i\|\|\i)\?void 0(?<=,(\i)=\i\.avatarSrc.+?)/,
replace: "$1style:($2)?{cursor:\"pointer\"}:{},onClick:$2?()=>{$self.openImage($3)}" replace: "style:($1)?{cursor:\"pointer\"}:{},onClick:$1?()=>{$self.openImage($2)}"
} }
} }
] ]

View File

@ -121,7 +121,7 @@ export default definePlugin({
predicate: () => settings.store.addBack, predicate: () => settings.store.addBack,
replacement: { replacement: {
// return IS_DESKTOP ? React.createElement(Menu, ...) // return IS_DESKTOP ? React.createElement(Menu, ...)
match: /return \i\.\i\?(?=\(0,\i\.jsxs?\)\(\i\.Menu)/, match: /return \i\.\i\?/,
replace: "return true?" replace: "return true?"
} }
}, },
@ -146,7 +146,7 @@ export default definePlugin({
} }
}, },
{ {
find: 'navId:"textarea-context"', find: ':"command-suggestions"',
predicate: () => settings.store.addBack, predicate: () => settings.store.addBack,
replacement: [ replacement: [
{ {

View File

@ -85,10 +85,14 @@ function makeRenderMoreUsers(users: User[]) {
}; };
} }
function handleClickAvatar(event: React.MouseEvent<HTMLElement, MouseEvent>) {
event.stopPropagation();
}
export default definePlugin({ export default definePlugin({
name: "WhoReacted", name: "WhoReacted",
description: "Renders the Avatars of reactors", description: "Renders the Avatars of reactors",
authors: [Devs.Ven], authors: [Devs.Ven, Devs.KannaDev],
patches: [{ patches: [{
find: ",reactionRef:", find: ",reactionRef:",
@ -132,6 +136,7 @@ export default definePlugin({
<div <div
style={{ marginLeft: "0.5em", transform: "scale(0.9)" }} style={{ marginLeft: "0.5em", transform: "scale(0.9)" }}
> >
<div onClick={handleClickAvatar}>
<UserSummaryItem <UserSummaryItem
users={users} users={users}
guildId={ChannelStore.getChannel(message.channel_id)?.guild_id} guildId={ChannelStore.getChannel(message.channel_id)?.guild_id}
@ -142,6 +147,7 @@ export default definePlugin({
renderMoreUsers={makeRenderMoreUsers(users)} renderMoreUsers={makeRenderMoreUsers(users)}
/> />
</div> </div>
</div>
); );
} }
}); });

View File

@ -273,5 +273,13 @@ export const Devs = /* #__PURE__*/ Object.freeze({
FieryFlames: { FieryFlames: {
name: "Fiery", name: "Fiery",
id: 890228870559698955n id: 890228870559698955n
},
KannaDev: {
name: "Kanna",
id: 317728561106518019n
},
carince: {
name: "carince",
id: 818323528755314698n
} }
}); });

View File

@ -17,7 +17,7 @@
*/ */
import { findLazy } from "@webpack"; import { findLazy } from "@webpack";
import { ChannelStore, GuildStore, PrivateChannelsStore, SelectedChannelStore } from "@webpack/common"; import { ChannelStore, ComponentDispatch, GuildStore, PrivateChannelsStore, SelectedChannelStore } from "@webpack/common";
import { Guild } from "discord-types/general"; import { Guild } from "discord-types/general";
const PreloadedUserSettings = findLazy(m => m.ProtoClass?.typeName.endsWith("PreloadedUserSettings")); const PreloadedUserSettings = findLazy(m => m.ProtoClass?.typeName.endsWith("PreloadedUserSettings"));
@ -42,3 +42,10 @@ export const enum Theme {
export function getTheme(): Theme { export function getTheme(): Theme {
return PreloadedUserSettings.getCurrentValue()?.appearance?.theme; return PreloadedUserSettings.getCurrentValue()?.appearance?.theme;
} }
export function insertTextIntoChatInputBox(text: string) {
ComponentDispatch.dispatchToLastSubscribed("INSERT_TEXT", {
rawText: text,
plainText: text
});
}

View File

@ -17,6 +17,7 @@
*/ */
import { Command } from "@api/Commands"; import { Command } from "@api/Commands";
import { FluxEvents } from "@webpack/types";
import { Promisable } from "type-fest"; import { Promisable } from "type-fest";
// exists to export default definePlugin({...}) // exists to export default definePlugin({...})
@ -101,6 +102,14 @@ export interface PluginDef {
settingsAboutComponent?: React.ComponentType<{ settingsAboutComponent?: React.ComponentType<{
tempSettings?: Record<string, any>; tempSettings?: Record<string, any>;
}>; }>;
/**
* Allows you to subscribe to Flux events
*/
flux?: {
[E in FluxEvents]?: (event: any) => void;
};
tags?: string[];
} }
export enum OptionType { export enum OptionType {
@ -126,6 +135,7 @@ export type PluginSettingDef = (
| PluginSettingSelectDef | PluginSettingSelectDef
| PluginSettingSliderDef | PluginSettingSliderDef
| PluginSettingComponentDef | PluginSettingComponentDef
| PluginSettingBigIntDef
) & PluginSettingCommon; ) & PluginSettingCommon;
export interface PluginSettingCommon { export interface PluginSettingCommon {

View File

@ -38,6 +38,7 @@ export interface Menu {
label: string; label: string;
action?(e: MouseEvent): void; action?(e: MouseEvent): void;
color?: string;
render?: ComponentType; render?: ComponentType;
onChildrenScroll?: Function; onChildrenScroll?: Function;
childRowHeight?: number; childRowHeight?: number;