mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-08 06:03:03 -04:00
Finish Suncord Port Hopefully (Equicord)
This commit is contained in:
parent
ef086cd1c4
commit
0ef25db8ed
13 changed files with 171 additions and 110 deletions
|
@ -54,7 +54,7 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend
|
||||||
- KeywordNotify by camila314
|
- KeywordNotify by camila314
|
||||||
- Meow by Samwich
|
- Meow by Samwich
|
||||||
- MessageLinkTooltip by Kyuuhachi
|
- MessageLinkTooltip by Kyuuhachi
|
||||||
- MessageLoggerEnhanced (MLEnhanced) by Aria
|
- MessageLoggerEnhanced by Aria
|
||||||
- noAppsAllowed by kvba
|
- noAppsAllowed by kvba
|
||||||
- NoModalAnimation by AutumnVN
|
- NoModalAnimation by AutumnVN
|
||||||
- NoNitroUpsell by thororen
|
- NoNitroUpsell by thororen
|
||||||
|
@ -62,12 +62,12 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend
|
||||||
- OnePingPerDM by ProffDea
|
- OnePingPerDM by ProffDea
|
||||||
- PlatformSpoofer by Drag
|
- PlatformSpoofer by Drag
|
||||||
- PurgeMessages by bhop and nyx
|
- PurgeMessages by bhop and nyx
|
||||||
- QuestionMarkReplacement (QuestionMarkReplace) by nyx
|
- Quest Completer by HappyEnderman, SerStars, thororen
|
||||||
|
- QuestionMarkReplacement by nyx
|
||||||
- Quoter by Samwich
|
- Quoter by Samwich
|
||||||
- RepeatMessage by Tolgchu
|
- RepeatMessage by Tolgchu
|
||||||
- ReplyPingControl by ant0n and MrDiamond
|
- ReplyPingControl by ant0n and MrDiamond
|
||||||
- ScreenRecorder by AutumnVN
|
- ScreenRecorder by AutumnVN
|
||||||
- Search by JacobTm and thororen
|
|
||||||
- SearchFix by Jaxx
|
- SearchFix by Jaxx
|
||||||
- Sekai Stickers by MaiKokain
|
- Sekai Stickers by MaiKokain
|
||||||
- ServerSearch by camila314
|
- ServerSearch by camila314
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { useSettings } from "@api/Settings";
|
||||||
import { classNameFactory } from "@api/Styles";
|
import { classNameFactory } from "@api/Styles";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Link } from "@components/Link";
|
import { Link } from "@components/Link";
|
||||||
import { DevsById, EquicordDevsById } from "@utils/constants";
|
import { EquicordDevsById, SuncordDevsById, VencordDevsById } from "@utils/constants";
|
||||||
import { fetchUserProfile } from "@utils/discord";
|
import { fetchUserProfile } from "@utils/discord";
|
||||||
import { classes, pluralise } from "@utils/misc";
|
import { classes, pluralise } from "@utils/misc";
|
||||||
import { ModalContent, ModalRoot, openModal } from "@utils/modal";
|
import { ModalContent, ModalRoot, openModal } from "@utils/modal";
|
||||||
|
@ -51,8 +51,8 @@ function ContributorModal({ user }: { user: User; }) {
|
||||||
|
|
||||||
const plugins = useMemo(() => {
|
const plugins = useMemo(() => {
|
||||||
const allPlugins = Object.values(Plugins);
|
const allPlugins = Object.values(Plugins);
|
||||||
const pluginsByAuthor = DevsById[user.id] || EquicordDevsById[user.id]
|
const pluginsByAuthor = VencordDevsById[user.id] || EquicordDevsById[user.id] || SuncordDevsById[user.id]
|
||||||
? allPlugins.filter(p => p.authors.includes(DevsById[user.id] || EquicordDevsById[user.id]))
|
? allPlugins.filter(p => p.authors.includes(VencordDevsById[user.id] || EquicordDevsById[user.id]) || SuncordDevsById[user.id])
|
||||||
: allPlugins.filter(p => p.authors.some(a => a.name === user.username));
|
: allPlugins.filter(p => p.authors.some(a => a.name === user.username));
|
||||||
|
|
||||||
return pluginsByAuthor
|
return pluginsByAuthor
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Vencord, a Discord client mod
|
* Vencord, a Discord client mod
|
||||||
* Copyright (c) 2023 Vendicated and contributors
|
* Copyright (c) 2024 Vendicated and contributors
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ export const Native = getNative();
|
||||||
import "./styles.css";
|
import "./styles.css";
|
||||||
|
|
||||||
import { NavContextMenuPatchCallback } from "@api/ContextMenu";
|
import { NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||||
import { definePluginSettings, Settings } from "@api/Settings";
|
import { definePluginSettings, migratePluginSettings, 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 { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
|
@ -53,6 +53,7 @@ export const cacheSentMessages = new LimitedMap<string, LoggedMessageJSON>();
|
||||||
|
|
||||||
const cacheThing = findByPropsLazy("commit", "getOrCreate");
|
const cacheThing = findByPropsLazy("commit", "getOrCreate");
|
||||||
|
|
||||||
|
let oldGetMessage: typeof MessageStore.getMessage;
|
||||||
|
|
||||||
const handledMessageIds = new Set();
|
const handledMessageIds = new Set();
|
||||||
async function messageDeleteHandler(payload: MessageDeletePayload & { isBulk: boolean; }) {
|
async function messageDeleteHandler(payload: MessageDeletePayload & { isBulk: boolean; }) {
|
||||||
|
@ -72,7 +73,7 @@ async function messageDeleteHandler(payload: MessageDeletePayload & { isBulk: bo
|
||||||
handledMessageIds.add(payload.id);
|
handledMessageIds.add(payload.id);
|
||||||
|
|
||||||
let message: LoggedMessage | LoggedMessageJSON | null =
|
let message: LoggedMessage | LoggedMessageJSON | null =
|
||||||
MessageStore.getMessage(payload.channelId, payload.id);
|
oldGetMessage?.(payload.channelId, payload.id);
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
// most likely an edited message
|
// most likely an edited message
|
||||||
const cachedMessage = cacheSentMessages.get(`${payload.channelId},${payload.id}`);
|
const cachedMessage = cacheSentMessages.get(`${payload.channelId},${payload.id}`);
|
||||||
|
@ -141,8 +142,7 @@ async function messageUpdateHandler(payload: MessageUpdatePayload) {
|
||||||
return;// Flogger.log("this message has been ignored", payload);
|
return;// Flogger.log("this message has been ignored", payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
let message = MessageStore
|
let message = oldGetMessage?.(payload.message.channel_id, payload.message.id) as LoggedMessage | LoggedMessageJSON | null;
|
||||||
.getMessage(payload.message.channel_id, payload.message.id) as LoggedMessage | LoggedMessageJSON | null;
|
|
||||||
|
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
// MESSAGE_UPDATE gets dispatched when emebeds change too and content becomes null
|
// MESSAGE_UPDATE gets dispatched when emebeds change too and content becomes null
|
||||||
|
@ -570,8 +570,9 @@ const contextMenuPath: NavContextMenuPatchCallback = (children, props) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
migratePluginSettings("MessageLoggerEnhanced", "MLEnhanced");
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "MLEnhanced",
|
name: "MessageLoggerEnhanced",
|
||||||
authors: [Devs.Aria],
|
authors: [Devs.Aria],
|
||||||
description: "G'day",
|
description: "G'day",
|
||||||
dependencies: ["MessageLogger"],
|
dependencies: ["MessageLogger"],
|
||||||
|
@ -747,7 +748,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
this.oldGetMessage = MessageStore.getMessage;
|
this.oldGetMessage = oldGetMessage = MessageStore.getMessage;
|
||||||
// we have to do this because the original message logger fetches the message from the store now
|
// we have to do this because the original message logger fetches the message from the store now
|
||||||
MessageStore.getMessage = (channelId: string, messageId: string) => {
|
MessageStore.getMessage = (channelId: string, messageId: string) => {
|
||||||
const MLMessage = LoggedMessageManager.getMessage(channelId, messageId);
|
const MLMessage = LoggedMessageManager.getMessage(channelId, messageId);
|
||||||
|
|
|
@ -80,3 +80,27 @@
|
||||||
.vc-updater-modal-content {
|
.vc-updater-modal-content {
|
||||||
padding: 1rem 2rem;
|
padding: 1rem 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div[class*="messagelogger-deleted"] [class*="contents"] > :is(div, h1, h2, h3, p) {
|
||||||
|
color: var(--text-normal) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Markdown title highlighting */
|
||||||
|
div[class*="messagelogger-deleted"] [class*="contents"] :is(h1, h2, h3) {
|
||||||
|
color: var(--text-normal) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bot "thinking" text highlighting */
|
||||||
|
div[class*="messagelogger-deleted"] [class*="colorStandard"] {
|
||||||
|
color: var(--text-normal) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Embed highlighting */
|
||||||
|
div[class*="messagelogger-deleted"] article :is(div, span, h1, h2, h3, p) {
|
||||||
|
color: var(--text-normal) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
div[class*="messagelogger-deleted"] a {
|
||||||
|
color: var(--text-link) !important;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents";
|
import { addPreSendListener, removePreSendListener } from "@api/MessageEvents";
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings, 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";
|
||||||
|
|
||||||
|
@ -28,8 +28,9 @@ function replaceQuestionMarks(content: string): string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
migratePluginSettings("QuestionMarkReplacement", "QuestionMarkReplace");
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "QuestionMarkReplace",
|
name: "QuestionMarkReplacement",
|
||||||
description: "Replace all question marks with chosen string, if message only contains question marks.",
|
description: "Replace all question marks with chosen string, if message only contains question marks.",
|
||||||
authors: [Devs.nyx],
|
authors: [Devs.nyx],
|
||||||
|
|
||||||
|
|
|
@ -1,84 +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 { ApplicationCommandOptionType, findOption } from "@api/Commands";
|
|
||||||
import { Devs, EquicordDevs } from "@utils/constants";
|
|
||||||
import definePlugin from "@utils/types";
|
|
||||||
|
|
||||||
export default definePlugin({
|
|
||||||
name: "Search",
|
|
||||||
authors: [Devs.JacobTm, EquicordDevs.thororen],
|
|
||||||
description: "Searchs the web.",
|
|
||||||
dependencies: ["CommandsAPI"],
|
|
||||||
commands: [{
|
|
||||||
name: "search",
|
|
||||||
description: "Generates search link.",
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
type: ApplicationCommandOptionType.STRING,
|
|
||||||
name: "Search query",
|
|
||||||
description: "What do you want to search?",
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: ApplicationCommandOptionType.STRING,
|
|
||||||
name: "Search engine",
|
|
||||||
description: "What do you want to search?",
|
|
||||||
required: true,
|
|
||||||
choices: [
|
|
||||||
{ label: "Google", name: "Google", value: "google" },
|
|
||||||
{ label: "Bing", name: "Bing", value: "bing" },
|
|
||||||
{ label: "DuckDuckGo", name: "DuckDuckGo", value: "duckduckgo" },
|
|
||||||
{ label: "Brave", name: "Brave", value: "brave" },
|
|
||||||
{ label: "Yahoo", name: "Yahoo", value: "yahoo" },
|
|
||||||
{ label: "Yandex", name: "Yandex", value: "yandex" },
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
execute(args) {
|
|
||||||
const rfc3986EncodeURIComponent = str => encodeURIComponent(str).replace(/[!'()*]/g, escape);
|
|
||||||
const query = findOption<string>(args, "Search query");
|
|
||||||
const engine = findOption<string>(args, "Search engine");
|
|
||||||
let link;
|
|
||||||
switch (engine) {
|
|
||||||
case "google":
|
|
||||||
link = `https://google.com/search?query=${rfc3986EncodeURIComponent(query)}`;
|
|
||||||
break;
|
|
||||||
case "bing":
|
|
||||||
link = `https://bing.com/search?q=${rfc3986EncodeURIComponent(query)}`;
|
|
||||||
break;
|
|
||||||
case "duckduckgo":
|
|
||||||
link = `https://duckduckgo.com/${rfc3986EncodeURIComponent(query)}`;
|
|
||||||
break;
|
|
||||||
case "brave":
|
|
||||||
link = `https://search.brave.com/search?q=${rfc3986EncodeURIComponent(query)}`;
|
|
||||||
break;
|
|
||||||
case "yahoo":
|
|
||||||
link = `https://search.yahoo.com/search?p=${rfc3986EncodeURIComponent(query)}`;
|
|
||||||
break;
|
|
||||||
case "yandex":
|
|
||||||
link = `https://yandex.com/search?text=${rfc3986EncodeURIComponent(query)}`;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
content: link
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
});
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
import { addDecoration, removeDecoration } from "@api/MessageDecorations";
|
import { addDecoration, removeDecoration } from "@api/MessageDecorations";
|
||||||
import { Devs, EquicordDevs } from "@utils/constants";
|
import { Devs, EquicordDevs } from "@utils/constants";
|
||||||
import { isEquicordPluginDev, isPluginDev } from "@utils/misc";
|
import { isEquicordPluginDev, isPluginDev, isSuncordPluginDev } from "@utils/misc";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||||
import badges from "plugins/_api/badges";
|
import badges from "plugins/_api/badges";
|
||||||
|
@ -60,6 +60,30 @@ function CheckBadge({ badge, author }: { badge: string; author: User; }): JSX.El
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
) : null;
|
) : null;
|
||||||
|
case "SuncordDonor":
|
||||||
|
return (
|
||||||
|
<span style={{ order: settings.store.SuncordDonorPosition }}>
|
||||||
|
{badges.getSuncordDonorBadges(author.id)?.map((badge: any) => (
|
||||||
|
<RoleIconComponent
|
||||||
|
className={roleIconClassName}
|
||||||
|
name={badge.description}
|
||||||
|
size={20}
|
||||||
|
src={badge.image}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
case "SuncordContributer":
|
||||||
|
return isSuncordPluginDev(author.id) ? (
|
||||||
|
<span style={{ order: settings.store.SuncordContributorPosition }}>
|
||||||
|
<RoleIconComponent
|
||||||
|
className={roleIconClassName}
|
||||||
|
name={"Suncord Contributor"}
|
||||||
|
size={20}
|
||||||
|
src={"https://raw.githubusercontent.com/verticalsync/Suncord/main/src/assets/icon.png"}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
) : null;
|
||||||
case "VencordDonor":
|
case "VencordDonor":
|
||||||
return (
|
return (
|
||||||
<span style={{ order: settings.store.VencordDonorPosition }}>
|
<span style={{ order: settings.store.VencordDonorPosition }}>
|
||||||
|
@ -126,6 +150,8 @@ function ChatBadges({ author }: { author: User; }) {
|
||||||
<span className="vc-sbic-badge-row">
|
<span className="vc-sbic-badge-row">
|
||||||
{settings.store.showEquicordDonor && <CheckBadge badge={"EquicordDonor"} author={author} />}
|
{settings.store.showEquicordDonor && <CheckBadge badge={"EquicordDonor"} author={author} />}
|
||||||
{settings.store.showEquicordContributor && <CheckBadge badge={"EquicordContributer"} author={author} />}
|
{settings.store.showEquicordContributor && <CheckBadge badge={"EquicordContributer"} author={author} />}
|
||||||
|
{settings.store.showSuncordDonor && <CheckBadge badge={"SuncordDonor"} author={author} />}
|
||||||
|
{settings.store.showSuncordContributor && <CheckBadge badge={"SuncordContributer"} author={author} />}
|
||||||
{settings.store.showVencordDonor && <CheckBadge badge={"VencordDonor"} author={author} />}
|
{settings.store.showVencordDonor && <CheckBadge badge={"VencordDonor"} author={author} />}
|
||||||
{settings.store.showVencordContributor && <CheckBadge badge={"VencordContributer"} author={author} />}
|
{settings.store.showVencordContributor && <CheckBadge badge={"VencordContributer"} author={author} />}
|
||||||
{settings.store.showDiscordProfile && <CheckBadge badge={"DiscordProfile"} author={author} />}
|
{settings.store.showDiscordProfile && <CheckBadge badge={"DiscordProfile"} author={author} />}
|
||||||
|
|
|
@ -33,6 +33,30 @@ const settings = definePluginSettings({
|
||||||
hidden: true,
|
hidden: true,
|
||||||
default: 1
|
default: 1
|
||||||
},
|
},
|
||||||
|
showSuncordDonor: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Enable to show Suncord Donor badges in chat.",
|
||||||
|
hidden: true,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
SuncordDonorPosition: {
|
||||||
|
type: OptionType.NUMBER,
|
||||||
|
description: "The position of the Suncord Donor badges.",
|
||||||
|
hidden: true,
|
||||||
|
default: 2
|
||||||
|
},
|
||||||
|
showSuncordContributor: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Enable to show Suncord Contributor badges in chat.",
|
||||||
|
hidden: true,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
SuncordContributorPosition: {
|
||||||
|
type: OptionType.NUMBER,
|
||||||
|
description: "The position of the Suncord Contributor badge.",
|
||||||
|
hidden: true,
|
||||||
|
default: 3
|
||||||
|
},
|
||||||
showVencordDonor: {
|
showVencordDonor: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Enable to show Vencord donor badges in chat.",
|
description: "Enable to show Vencord donor badges in chat.",
|
||||||
|
@ -43,7 +67,7 @@ const settings = definePluginSettings({
|
||||||
type: OptionType.NUMBER,
|
type: OptionType.NUMBER,
|
||||||
description: "The position of the Vencord Donor badges.",
|
description: "The position of the Vencord Donor badges.",
|
||||||
hidden: true,
|
hidden: true,
|
||||||
default: 2
|
default: 4
|
||||||
},
|
},
|
||||||
showVencordContributor: {
|
showVencordContributor: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
|
@ -55,7 +79,7 @@ const settings = definePluginSettings({
|
||||||
type: OptionType.NUMBER,
|
type: OptionType.NUMBER,
|
||||||
description: "The position of the Vencord Contributor badge.",
|
description: "The position of the Vencord Contributor badge.",
|
||||||
hidden: true,
|
hidden: true,
|
||||||
default: 3
|
default: 5
|
||||||
},
|
},
|
||||||
showDiscordProfile: {
|
showDiscordProfile: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
|
@ -67,7 +91,7 @@ const settings = definePluginSettings({
|
||||||
type: OptionType.NUMBER,
|
type: OptionType.NUMBER,
|
||||||
description: "The position of the Discord profile badges.",
|
description: "The position of the Discord profile badges.",
|
||||||
hidden: true,
|
hidden: true,
|
||||||
default: 4
|
default: 6
|
||||||
},
|
},
|
||||||
showDiscordNitro: {
|
showDiscordNitro: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
|
@ -79,7 +103,7 @@ const settings = definePluginSettings({
|
||||||
type: OptionType.NUMBER,
|
type: OptionType.NUMBER,
|
||||||
description: "The position of the Discord Nitro badge.",
|
description: "The position of the Discord Nitro badge.",
|
||||||
hidden: true,
|
hidden: true,
|
||||||
default: 5
|
default: 7
|
||||||
},
|
},
|
||||||
badgeSettings: {
|
badgeSettings: {
|
||||||
type: OptionType.COMPONENT,
|
type: OptionType.COMPONENT,
|
||||||
|
@ -94,6 +118,8 @@ const BadgeSettings = () => {
|
||||||
const [images, setImages] = useState([
|
const [images, setImages] = useState([
|
||||||
{ src: "https://i.imgur.com/KsxHlbD.png", shown: settings.store.showEquicordDonor, title: "Equicord donor badges", key: "EquicordDonor", position: settings.store.EquicordDonorPosition },
|
{ src: "https://i.imgur.com/KsxHlbD.png", shown: settings.store.showEquicordDonor, title: "Equicord donor badges", key: "EquicordDonor", position: settings.store.EquicordDonorPosition },
|
||||||
{ src: "https://i.imgur.com/rJDRtUB.png", shown: settings.store.showEquicordContributor, title: "Equicord contributor badge", key: "EquicordContributer", position: settings.store.EquicordContributorPosition },
|
{ src: "https://i.imgur.com/rJDRtUB.png", shown: settings.store.showEquicordContributor, title: "Equicord contributor badge", key: "EquicordContributer", position: settings.store.EquicordContributorPosition },
|
||||||
|
{ src: "https://i.imgur.com/H3GPhpd.png", shown: settings.store.showSuncordDonor, title: "Suncord donor badges", key: "SuncordDonor", position: settings.store.SuncordDonorPosition },
|
||||||
|
{ src: "https://raw.githubusercontent.com/verticalsync/Suncord/main/src/assets/icon.png", shown: settings.store.showSuncordContributor, title: "Suncord contributor badge", key: "SuncordContributer", position: settings.store.SuncordContributorPosition },
|
||||||
{ src: "https://cdn.discordapp.com/emojis/1026533070955872337.png", shown: settings.store.showVencordDonor, title: "Vencord donor badges", key: "VencordDonor", position: settings.store.VencordDonorPosition },
|
{ src: "https://cdn.discordapp.com/emojis/1026533070955872337.png", shown: settings.store.showVencordDonor, title: "Vencord donor badges", key: "VencordDonor", position: settings.store.VencordDonorPosition },
|
||||||
{ src: "https://vencord.dev/assets/favicon.png", shown: settings.store.showVencordContributor, title: "Vencord contributor badge", key: "VencordContributer", position: settings.store.VencordContributorPosition },
|
{ src: "https://vencord.dev/assets/favicon.png", shown: settings.store.showVencordContributor, title: "Vencord contributor badge", key: "VencordContributer", position: settings.store.VencordContributorPosition },
|
||||||
{ src: "https://cdn.discordapp.com/badge-icons/bf01d1073931f921909045f3a39fd264.png", shown: settings.store.showDiscordProfile, title: "Discord profile badges (HypeSquad, Discord Staff, Active Developer, etc.)", key: "DiscordProfile", position: settings.store.DiscordProfilePosition },
|
{ src: "https://cdn.discordapp.com/badge-icons/bf01d1073931f921909045f3a39fd264.png", shown: settings.store.showDiscordProfile, title: "Discord profile badges (HypeSquad, Discord Staff, Active Developer, etc.)", key: "DiscordProfile", position: settings.store.DiscordProfilePosition },
|
||||||
|
@ -111,6 +137,14 @@ const BadgeSettings = () => {
|
||||||
settings.store.EquicordContributorPosition = image.position;
|
settings.store.EquicordContributorPosition = image.position;
|
||||||
settings.store.showEquicordContributor = image.shown;
|
settings.store.showEquicordContributor = image.shown;
|
||||||
break;
|
break;
|
||||||
|
case "SuncordDonor":
|
||||||
|
settings.store.SuncordDonorPosition = image.position;
|
||||||
|
settings.store.showSuncordDonor = image.shown;
|
||||||
|
break;
|
||||||
|
case "SuncordContributer":
|
||||||
|
settings.store.SuncordContributorPosition = image.position;
|
||||||
|
settings.store.showSuncordContributor = image.shown;
|
||||||
|
break;
|
||||||
case "VencordDonor":
|
case "VencordDonor":
|
||||||
settings.store.VencordDonorPosition = image.position;
|
settings.store.VencordDonorPosition = image.position;
|
||||||
settings.store.showVencordDonor = image.shown;
|
settings.store.showVencordDonor = image.shown;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import { openContributorModal } from "@components/PluginSettings/ContributorModa
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import { isEquicordPluginDev, isPluginDev } from "@utils/misc";
|
import { isEquicordPluginDev, isPluginDev, isSuncordPluginDev } from "@utils/misc";
|
||||||
import { closeModal, Modals, openModal } from "@utils/modal";
|
import { closeModal, Modals, openModal } from "@utils/modal";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { Forms, Toasts, UserStore } from "@webpack/common";
|
import { Forms, Toasts, UserStore } from "@webpack/common";
|
||||||
|
@ -35,6 +35,7 @@ import { User } from "discord-types/general";
|
||||||
|
|
||||||
const CONTRIBUTOR_BADGE = "https://vencord.dev/assets/favicon.png";
|
const CONTRIBUTOR_BADGE = "https://vencord.dev/assets/favicon.png";
|
||||||
const EQUICORD_CONTRIBUTOR_BADGE = "https://i.imgur.com/rJDRtUB.png";
|
const EQUICORD_CONTRIBUTOR_BADGE = "https://i.imgur.com/rJDRtUB.png";
|
||||||
|
const SUNCORD_CONTRIBUTOR_BADGE = "https://raw.githubusercontent.com/verticalsync/Suncord/main/src/assets/icon.png";
|
||||||
|
|
||||||
const ContributorBadge: ProfileBadge = {
|
const ContributorBadge: ProfileBadge = {
|
||||||
description: "Vencord Contributor",
|
description: "Vencord Contributor",
|
||||||
|
@ -52,6 +53,14 @@ const EquicordContributorBadge: ProfileBadge = {
|
||||||
onClick: (_, { userId }) => openContributorModal(UserStore.getUser(userId))
|
onClick: (_, { userId }) => openContributorModal(UserStore.getUser(userId))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const SuncordContributorBadge: ProfileBadge = {
|
||||||
|
description: "Suncord Contributor",
|
||||||
|
image: SUNCORD_CONTRIBUTOR_BADGE,
|
||||||
|
position: BadgePosition.START,
|
||||||
|
shouldShow: ({ userId }) => isSuncordPluginDev(userId),
|
||||||
|
onClick: (_, { userId }) => openContributorModal(UserStore.getUser(userId))
|
||||||
|
};
|
||||||
|
|
||||||
let DonorBadges = {} as Record<string, Array<Record<"tooltip" | "badge", string>>>;
|
let DonorBadges = {} as Record<string, Array<Record<"tooltip" | "badge", string>>>;
|
||||||
let EquicordDonorBadges = {} as Record<string, Array<Record<"tooltip" | "badge", string>>>;
|
let EquicordDonorBadges = {} as Record<string, Array<Record<"tooltip" | "badge", string>>>;
|
||||||
let SuncordDonorBadges = {} as Record<string, Array<Record<"tooltip" | "badge", string>>>;
|
let SuncordDonorBadges = {} as Record<string, Array<Record<"tooltip" | "badge", string>>>;
|
||||||
|
@ -151,6 +160,7 @@ export default definePlugin({
|
||||||
async start() {
|
async start() {
|
||||||
Vencord.Api.Badges.addBadge(ContributorBadge);
|
Vencord.Api.Badges.addBadge(ContributorBadge);
|
||||||
Vencord.Api.Badges.addBadge(EquicordContributorBadge);
|
Vencord.Api.Badges.addBadge(EquicordContributorBadge);
|
||||||
|
Vencord.Api.Badges.addBadge(SuncordContributorBadge);
|
||||||
await loadAllBadges();
|
await loadAllBadges();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings, 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 { Flex, Menu } from "@webpack/common";
|
import { Flex, Menu } from "@webpack/common";
|
||||||
|
@ -93,6 +93,7 @@ const messageContextMenuPatch: NavContextMenuPatchCallback = (children, _props)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
migratePluginSettings("ReplaceGoogleSearch", "Search");
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "ReplaceGoogleSearch",
|
name: "ReplaceGoogleSearch",
|
||||||
description: "Replaces the Google search with different Engines",
|
description: "Replaces the Google search with different Engines",
|
||||||
|
|
|
@ -669,8 +669,47 @@ export const EquicordDevs = Object.freeze({
|
||||||
},
|
},
|
||||||
} satisfies Record<string, Dev>);
|
} satisfies Record<string, Dev>);
|
||||||
|
|
||||||
|
export const SuncordDevs = /* #__PURE__*/ Object.freeze({
|
||||||
|
nyx: {
|
||||||
|
name: "verticalsync",
|
||||||
|
id: 328165170536775680n,
|
||||||
|
},
|
||||||
|
bhop: {
|
||||||
|
name: "femeie",
|
||||||
|
id: 442626774841556992n,
|
||||||
|
},
|
||||||
|
Drag: {
|
||||||
|
name: "dragalt_",
|
||||||
|
id: 1189903210564038697n,
|
||||||
|
},
|
||||||
|
Woosh: {
|
||||||
|
name: "w00shh.",
|
||||||
|
id: 689165844835860522n,
|
||||||
|
},
|
||||||
|
Cortex: {
|
||||||
|
name: "Cortex",
|
||||||
|
id: 825069530376044594n,
|
||||||
|
},
|
||||||
|
thororen: {
|
||||||
|
name: "thororen",
|
||||||
|
id: 848339671629299742n,
|
||||||
|
},
|
||||||
|
nexpid: {
|
||||||
|
name: "Nexpid",
|
||||||
|
id: 853550207039832084n,
|
||||||
|
},
|
||||||
|
KrystalSkull: {
|
||||||
|
name: "krystalskullofficial",
|
||||||
|
id: 929208515883569182n,
|
||||||
|
},
|
||||||
|
SerStars: {
|
||||||
|
name: "SerStars",
|
||||||
|
id: 861631850681729045n,
|
||||||
|
},
|
||||||
|
} satisfies Record<string, Dev>);
|
||||||
|
|
||||||
// iife so #__PURE__ works correctly
|
// iife so #__PURE__ works correctly
|
||||||
export const DevsById = /* #__PURE__*/ (() =>
|
export const VencordDevsById = /* #__PURE__*/ (() =>
|
||||||
Object.freeze(Object.fromEntries(
|
Object.freeze(Object.fromEntries(
|
||||||
Object.entries(Devs)
|
Object.entries(Devs)
|
||||||
.filter(d => d[1].id !== 0n)
|
.filter(d => d[1].id !== 0n)
|
||||||
|
@ -685,3 +724,11 @@ export const EquicordDevsById = /* #__PURE__*/ (() =>
|
||||||
.map(([_, v]) => [v.id, v] as const)
|
.map(([_, v]) => [v.id, v] as const)
|
||||||
))
|
))
|
||||||
)() as Record<string, Dev>;
|
)() as Record<string, Dev>;
|
||||||
|
|
||||||
|
export const SuncordDevsById = /* #__PURE__*/ (() =>
|
||||||
|
Object.freeze(Object.fromEntries(
|
||||||
|
Object.entries(SuncordDevs)
|
||||||
|
.filter(d => d[1].id !== 0n)
|
||||||
|
.map(([_, v]) => [v.id, v] as const)
|
||||||
|
))
|
||||||
|
)() as Record<string, Dev>;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
import { Clipboard, Toasts } from "@webpack/common";
|
import { Clipboard, Toasts } from "@webpack/common";
|
||||||
|
|
||||||
import { DevsById, EquicordDevsById } from "./constants";
|
import { EquicordDevsById, SuncordDevsById, VencordDevsById } from "./constants";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls .join(" ") on the arguments
|
* Calls .join(" ") on the arguments
|
||||||
|
@ -94,8 +94,9 @@ export function identity<T>(value: T): T {
|
||||||
// "In summary, we recommend looking for the string Mobi anywhere in the User Agent to detect a mobile device."
|
// "In summary, we recommend looking for the string Mobi anywhere in the User Agent to detect a mobile device."
|
||||||
export const isMobile = navigator.userAgent.includes("Mobi");
|
export const isMobile = navigator.userAgent.includes("Mobi");
|
||||||
|
|
||||||
export const isPluginDev = (id: string) => Object.hasOwn(DevsById, id);
|
export const isPluginDev = (id: string) => Object.hasOwn(VencordDevsById, id);
|
||||||
export const isEquicordPluginDev = (id: string) => Object.hasOwn(EquicordDevsById, id);
|
export const isEquicordPluginDev = (id: string) => Object.hasOwn(EquicordDevsById, id);
|
||||||
|
export const isSuncordPluginDev = (id: string) => Object.hasOwn(SuncordDevsById, id);
|
||||||
|
|
||||||
export function pluralise(amount: number, singular: string, plural = singular + "s") {
|
export function pluralise(amount: number, singular: string, plural = singular + "s") {
|
||||||
return amount === 1 ? `${amount} ${singular}` : `${amount} ${plural}`;
|
return amount === 1 ? `${amount} ${singular}` : `${amount} ${plural}`;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue