diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/Styles.ts | 6 | ||||
| -rw-r--r-- | src/components/PluginSettings/index.tsx | 7 | ||||
| -rw-r--r-- | src/components/monacoWin.html | 10 | ||||
| -rw-r--r-- | src/plugins/disableDMCallIdle.ts | 2 | ||||
| -rw-r--r-- | src/plugins/fakeNitro.ts | 6 | ||||
| -rw-r--r-- | src/plugins/messageLogger/index.tsx | 18 | ||||
| -rw-r--r-- | src/plugins/uwuify.ts | 143 | ||||
| -rw-r--r-- | src/plugins/vencordToolbox/index.css | 5 | ||||
| -rw-r--r-- | src/utils/constants.ts | 4 |
9 files changed, 41 insertions, 160 deletions
diff --git a/src/api/Styles.ts b/src/api/Styles.ts index 6b189ca..6b0ac2c 100644 --- a/src/api/Styles.ts +++ b/src/api/Styles.ts @@ -141,7 +141,7 @@ export const compileStyle = (style: Style) => { */ export const classNameToSelector = (name: string, prefix = "") => name.split(" ").map(n => `.${prefix}${n}`).join(""); -type ClassNameFactoryArg = string | string[] | Record<string, unknown>; +type ClassNameFactoryArg = string | string[] | Record<string, unknown> | false | null | undefined | 0 | ""; /** * @param prefix The prefix to add to each class, defaults to `""` * @returns A classname generator function @@ -154,9 +154,9 @@ type ClassNameFactoryArg = string | string[] | Record<string, unknown>; export const classNameFactory = (prefix: string = "") => (...args: ClassNameFactoryArg[]) => { const classNames = new Set<string>(); for (const arg of args) { - if (typeof arg === "string") classNames.add(arg); + if (arg && typeof arg === "string") classNames.add(arg); else if (Array.isArray(arg)) arg.forEach(name => classNames.add(name)); - else if (typeof arg === "object") Object.entries(arg).forEach(([name, value]) => value && classNames.add(name)); + else if (arg && typeof arg === "object") Object.entries(arg).forEach(([name, value]) => value && classNames.add(name)); } return Array.from(classNames, name => prefix + name).join(" "); }; diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx index 8d7524d..7749abd 100644 --- a/src/components/PluginSettings/index.tsx +++ b/src/components/PluginSettings/index.tsx @@ -176,7 +176,8 @@ function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLe const enum SearchStatus { ALL, ENABLED, - DISABLED + DISABLED, + NEW } export default function PluginSettings() { @@ -229,6 +230,7 @@ export default function PluginSettings() { const enabled = settings.plugins[plugin.name]?.enabled; if (enabled && searchValue.status === SearchStatus.DISABLED) return false; if (!enabled && searchValue.status === SearchStatus.ENABLED) return false; + if (searchValue.status === SearchStatus.NEW && !newPlugins?.includes(plugin.name)) return false; if (!searchValue.value.length) return true; const v = searchValue.value.toLowerCase(); @@ -321,7 +323,8 @@ export default function PluginSettings() { options={[ { label: "Show All", value: SearchStatus.ALL, default: true }, { label: "Show Enabled", value: SearchStatus.ENABLED }, - { label: "Show Disabled", value: SearchStatus.DISABLED } + { label: "Show Disabled", value: SearchStatus.DISABLED }, + { label: "Show New", value: SearchStatus.NEW } ]} serialize={String} select={onStatusChange} diff --git a/src/components/monacoWin.html b/src/components/monacoWin.html index 57d3214..61d075f 100644 --- a/src/components/monacoWin.html +++ b/src/components/monacoWin.html @@ -5,8 +5,8 @@ <title>Vencord QuickCSS Editor</title> <link 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==" + href="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.40.0/min/vs/editor/editor.main.min.css" + integrity="sha512-MOoQ02h80hklccfLrXFYkCzG+WVjORflOp9Zp8dltiaRP+35LYnO4LKOklR64oMGfGgJDLO8WJpkM1o5gZXYZQ==" crossorigin="anonymous" referrerpolicy="no-referrer" /> @@ -29,8 +29,8 @@ <body> <div id="container"></div> <script - src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.37.1/min/vs/loader.min.js" - integrity="sha512-A+6SvPGkIN9Rf0mUXmW4xh7rDvALXf/f0VtOUiHlDUSPknu2kcfz1KzLpOJyL2pO+nZS13hhIjLqVgiQExLJrw==" + src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.40.0/min/vs/loader.min.js" + integrity="sha512-QzMpXeCPciAHP4wbYlV2PYgrQcaEkDQUjzkPU4xnjyVSD9T36/udamxtNBqb4qK4/bMQMPZ8ayrBe9hrGdBFjQ==" crossorigin="anonymous" referrerpolicy="no-referrer" ></script> @@ -38,7 +38,7 @@ <script> require.config({ paths: { - vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.37.1/min/vs", + vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.40.0/min/vs", }, }); diff --git a/src/plugins/disableDMCallIdle.ts b/src/plugins/disableDMCallIdle.ts index 2ba861c..26ea3cd 100644 --- a/src/plugins/disableDMCallIdle.ts +++ b/src/plugins/disableDMCallIdle.ts @@ -21,7 +21,7 @@ import definePlugin from "@utils/types"; export default definePlugin({ name: "DisableDMCallIdle", - description: "Disables automatically getting kicked from a DM voice call after 5 minutes.", + description: "Disables automatically getting kicked from a DM voice call after 3 minutes.", authors: [Devs.Nuckyz], patches: [ { diff --git a/src/plugins/fakeNitro.ts b/src/plugins/fakeNitro.ts index 34cd63b..cd2dda8 100644 --- a/src/plugins/fakeNitro.ts +++ b/src/plugins/fakeNitro.ts @@ -565,7 +565,11 @@ export default definePlugin({ switch (embed.type) { case "image": { - if (!settings.store.transformCompoundSentence && !contentItems.includes(embed.url!) && !contentItems.includes(embed.image!.proxyURL)) return false; + if ( + !settings.store.transformCompoundSentence + && !contentItems.includes(embed.url!) + && !contentItems.includes(embed.image?.proxyURL!) + ) return false; if (settings.store.transformEmojis) { if (fakeNitroEmojiRegex.test(embed.url!)) return true; diff --git a/src/plugins/messageLogger/index.tsx b/src/plugins/messageLogger/index.tsx index 2041f70..162db54 100644 --- a/src/plugins/messageLogger/index.tsx +++ b/src/plugins/messageLogger/index.tsx @@ -152,14 +152,24 @@ export default definePlugin({ type: OptionType.STRING, description: "Comma-separated list of user IDs to ignore", default: "" - } + }, + ignoreChannels: { + type: OptionType.STRING, + description: "Comma-separated list of channel IDs to ignore", + default: "" + }, + ignoreGuilds: { + type: OptionType.STRING, + description: "Comma-separated list of guild IDs to ignore", + default: "" + }, }, handleDelete(cache: any, data: { ids: string[], id: string; mlDeleted?: boolean; }, isBulk: boolean) { try { if (cache == null || (!isBulk && !cache.has(data.id))) return cache; - const { ignoreBots, ignoreSelf, ignoreUsers } = Settings.plugins.MessageLogger; + const { ignoreBots, ignoreSelf, ignoreUsers, ignoreChannels, ignoreGuilds } = Settings.plugins.MessageLogger; const myId = UserStore.getCurrentUser().id; function mutate(id: string) { @@ -171,7 +181,9 @@ export default definePlugin({ (msg.flags & EPHEMERAL) === EPHEMERAL || ignoreBots && msg.author?.bot || ignoreSelf && msg.author?.id === myId || - ignoreUsers.includes(msg.author?.id); + ignoreUsers.includes(msg.author?.id) || + ignoreChannels.includes(msg.channel_id) || + ignoreGuilds.includes(msg.guild_id); if (shouldIgnore) { cache = cache.remove(id); diff --git a/src/plugins/uwuify.ts b/src/plugins/uwuify.ts deleted file mode 100644 index f75dd10..0000000 --- a/src/plugins/uwuify.ts +++ /dev/null @@ -1,143 +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 { findOption, RequiredMessageOption } from "@api/Commands"; -import { addPreEditListener, addPreSendListener, MessageObject, removePreEditListener, removePreSendListener } from "@api/MessageEvents"; -import { definePluginSettings } from "@api/Settings"; -import { Devs } from "@utils/constants"; -import definePlugin, { OptionType } from "@utils/types"; - -const endings = [ - "rawr x3", - "OwO", - "UwU", - "o.O", - "-.-", - ">w<", - "(⑅˘꒳˘)", - "(ꈍᴗꈍ)", - "(˘ω˘)", - "(U ᵕ U❁)", - "σωσ", - "òωó", - "(///ˬ///✿)", - "(U ﹏ U)", - "( ͡o ω ͡o )", - "ʘwʘ", - ":3", - ":3", // important enough to have twice - "XD", - "nyaa~~", - "mya", - ">_<", - "😳", - "🥺", - "😳😳😳", - "rawr", - "^^", - "^^;;", - "(ˆ ﻌ ˆ)♡", - "^•ﻌ•^", - "/(^•ω•^)", - "(✿oωo)" -]; - -const replacements = [ - ["small", "smol"], - ["cute", "kawaii~"], - ["fluff", "floof"], - ["love", "luv"], - ["stupid", "baka"], - ["what", "nani"], - ["meow", "nya~"], - ["hello", "hewwo"], -]; - -const settings = definePluginSettings({ - uwuEveryMessage: { - description: "Make every single message uwuified", - type: OptionType.BOOLEAN, - default: false, - restartNeeded: false - } -}); - -function selectRandomElement(arr) { - // generate a random index based on the length of the array - const randomIndex = Math.floor(Math.random() * arr.length); - - // return the element at the randomly generated index - return arr[randomIndex]; -} - - -function uwuify(message: string): string { - message = message.toLowerCase(); - // words - for (const pair of replacements) { - message = message.replaceAll(pair[0], pair[1]); - } - message = message - .replaceAll(/([ \t\n])n/g, "$1ny") // nyaify - .replaceAll(/[lr]/g, "w") // [lr] > w - .replaceAll(/([ \t\n])([a-z])/g, (_, p1, p2) => Math.random() < .5 ? `${p1}${p2}-${p2}` : `${p1}${p2}`) // stutter - .replaceAll(/([^.,!][.,!])([ \t\n])/g, (_, p1, p2) => `${p1} ${selectRandomElement(endings)}${p2}`); // endings - return message; -} - - - -// actual command declaration -export default definePlugin({ - name: "UwUifier", - description: "Simply uwuify commands", - authors: [Devs.echo, Devs.skyevg, Devs.PandaNinjas], - dependencies: ["CommandsAPI", "MessageEventsAPI"], - settings, - - commands: [ - { - name: "uwuify", - description: "uwuifies your messages", - options: [RequiredMessageOption], - - execute: opts => ({ - content: uwuify(findOption(opts, "message", "")), - }), - }, - ], - - onSend(msg: MessageObject) { - // Only run when it's enabled - if (settings.store.uwuEveryMessage) { - msg.content = uwuify(msg.content); - } - }, - - start() { - this.preSend = addPreSendListener((_, msg) => this.onSend(msg)); - this.preEdit = addPreEditListener((_cid, _mid, msg) => - this.onSend(msg) - ); - }, - - stop() { - removePreSendListener(this.preSend); - removePreEditListener(this.preEdit); - }, -}); diff --git a/src/plugins/vencordToolbox/index.css b/src/plugins/vencordToolbox/index.css index 422e36d..8b50986 100644 --- a/src/plugins/vencordToolbox/index.css +++ b/src/plugins/vencordToolbox/index.css @@ -1,3 +1,8 @@ +.vc-toolbox-btn, +.vc-toolbox-btn svg { + -webkit-app-region: no-drag; +} + .vc-toolbox-btn svg { color: var(--interactive-normal); } diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 7dc3601..9771f42 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -265,7 +265,7 @@ export const Devs = /* #__PURE__*/ Object.freeze({ }, Dziurwa: { name: "Dziurwa", - id: 787017887877169173n + id: 1034579679526526976n }, AutumnVN: { name: "AutumnVN", @@ -329,7 +329,7 @@ export const Devs = /* #__PURE__*/ Object.freeze({ }, rad: { name: "rad", - id: 113027285765885952n + id: 610945092504780823n }, HypedDomi: { name: "HypedDomi", |
