Support Fixes

This commit is contained in:
thororen1234 2024-10-22 14:09:44 -04:00
parent b4b95b1943
commit a7a722dab9
3 changed files with 496 additions and 510 deletions

View file

@ -23,7 +23,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
import { Flex } from "@components/Flex";
import { Link } from "@components/Link";
import { openUpdaterModal } from "@components/VencordSettings/UpdaterTab";
import { Devs, SUPPORT_CHANNEL_ID, SUPPORT_CHANNEL_IDS, VC_SUPPORT_CHANNEL_ID } from "@utils/constants";
import { Devs, GUILD_ID, SUPPORT_CHANNEL_ID, SUPPORT_CHANNEL_IDS, VC_GUILD_ID, VC_SUPPORT_CHANNEL_ID } from "@utils/constants";
import { sendMessage } from "@utils/discord";
import { Logger } from "@utils/Logger";
import { Margins } from "@utils/margins";
@ -40,24 +40,17 @@ import plugins, { PluginMeta } from "~plugins";
import SettingsPlugin from "./settings";
const VENCORD_GUILD_ID = "1015060230222131221";
const EQUICORD_GUILD_ID = "1015060230222131221";
const VENBOT_USER_ID = "1017176847865352332";
const KNOWN_ISSUES_CHANNEL_ID = "1222936386626129920";
const CodeBlockRe = /```js\n(.+?)```/s;
const AllowedChannelIds = [
SUPPORT_CHANNEL_ID,
"1173659827881390160", // Equicord > #dev
"1297590739911573585", // Equicord > #support
];
const TrustedRolesIds = [
"1026534353167208489", // contributor
"1026504932959977532", // regular
"1042507929485586532", // donor
"1173520023239786538", // Equicord Team
"1222677964760682556", // Equicord Contributor
"1287079931645263968", // Equibop Contributor
"1173343399470964856", // Vencord Contributor
];
@ -165,13 +158,15 @@ export default definePlugin({
{
name: "equicord-debug",
description: "Send Equicord debug info",
predicate: ctx => isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id) || AllowedChannelIds.includes(ctx.channel.id),
// @ts-expect-error
predicate: ctx => isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id) || GUILD_ID === ctx.guild.id,
execute: async () => ({ content: await generateDebugInfoMessage() })
},
{
name: "equicord-plugins",
description: "Send Equicord plugin list",
predicate: ctx => isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id) || AllowedChannelIds.includes(ctx.channel.id),
// @ts-expect-error
predicate: ctx => isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id) || GUILD_ID === ctx.guild.id,
execute: () => ({ content: generatePluginList() })
}
],
@ -223,7 +218,7 @@ export default definePlugin({
}
// @ts-ignore outdated type
const roles = GuildMemberStore.getSelfMember(VENCORD_GUILD_ID)?.roles || GuildMemberStore.getSelfMember(EQUICORD_GUILD_ID)?.roles;
const roles = GuildMemberStore.getSelfMember(VC_GUILD_ID)?.roles || GuildMemberStore.getSelfMember(GUILD_ID)?.roles;
if (!roles || TrustedRolesIds.some(id => roles.includes(id))) return;
if (!IS_WEB && IS_UPDATER_DISABLED) {

View file

@ -1,19 +1,7 @@
/*
* 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/>.
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import "./messageLogger.css";
@ -52,7 +40,7 @@ import { openHistoryModal } from "./HistoryModal";
interface MLMessage extends Message {
deleted?: boolean;
editHistory?: { timestamp: Date; content: string }[];
editHistory?: { timestamp: Date; content: string; }[];
firstEditTimestamp?: Date;
}
@ -129,7 +117,7 @@ const patchChannelContextMenu: NavContextMenuPatchCallback = (
{ channel },
) => {
const messages = MessageStore.getMessages(channel?.id) as MLMessage[];
if (!messages?.some((msg) => msg.deleted || msg.editHistory?.length)) return;
if (!messages?.some(msg => msg.deleted || msg.editHistory?.length)) return;
const group =
findGroupChildrenByChildId("mark-channel-read", children) ?? children;
@ -139,7 +127,7 @@ const patchChannelContextMenu: NavContextMenuPatchCallback = (
label="Clear Message Log"
color="danger"
action={() => {
messages.forEach((msg) => {
messages.forEach(msg => {
if (msg.deleted)
FluxDispatcher.dispatch({
type: "MESSAGE_DELETE",
@ -203,7 +191,7 @@ export default definePlugin({
return (
Settings.plugins.MessageLogger.inlineEdits && (
<>
{message.editHistory?.map((edit) => (
{message.editHistory?.map(edit => (
<div className="messagelogger-edited">
{parseEditContent(edit.content, message)}
<Timestamp
@ -293,7 +281,7 @@ export default definePlugin({
handleDelete(
cache: any,
data: { ids: string[]; id: string; mlDeleted?: boolean },
data: { ids: string[]; id: string; mlDeleted?: boolean; },
isBulk: boolean,
) {
try {
@ -312,10 +300,10 @@ export default definePlugin({
if (shouldIgnore) {
cache = cache.remove(id);
} else {
cache = cache.update(id, (m) =>
cache = cache.update(id, m =>
m.set("deleted", true).set(
"attachments",
m.attachments.map((a) => ((a.deleted = true), a)),
m.attachments.map(a => ((a.deleted = true), a)),
),
);
}

View file

@ -18,9 +18,12 @@
export const WEBPACK_CHUNK = "webpackChunkdiscord_app";
export const REACT_GLOBAL = "Vencord.Webpack.Common.React";
export const SUPPORT_CHANNEL_ID = "1173342942858055721";
export const SUPPORT_CHANNEL_IDS = ["1173342942858055721", "1026515880080842772"];
export const SUPPORT_CHANNEL_ID = "1297590739911573585";
export const VC_SUPPORT_CHANNEL_ID = "1026515880080842772";
export const SUPPORT_CHANNEL_IDS = [SUPPORT_CHANNEL_ID, VC_SUPPORT_CHANNEL_ID];
export const GUILD_ID = "1173279886065029291";
export const VC_GUILD_ID = "1015060230222131221";
export const GUILD_IDS = [GUILD_ID, VC_GUILD_ID];
export interface Dev {
name: string;