Merge branch 'dev'
This commit is contained in:
commit
b37041a572
6 changed files with 21 additions and 27 deletions
|
|
@ -16,7 +16,7 @@ import { SpecialCard } from "@components/settings/SpecialCard";
|
|||
import { gitRemote } from "@shared/vencordUserAgent";
|
||||
import { DONOR_ROLE_ID, GUILD_ID, VC_DONOR_ROLE_ID, VC_GUILD_ID } from "@utils/constants";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { identity, isEquicordPluginDev, isPluginDev } from "@utils/misc";
|
||||
import { identity, isAnyPluginDev } from "@utils/misc";
|
||||
import { relaunch } from "@utils/native";
|
||||
import { Button, Flex, Forms, GuildMemberStore, React, Select, Switch, UserStore } from "@webpack/common";
|
||||
import BadgeAPI from "plugins/_api/badges";
|
||||
|
|
@ -139,7 +139,7 @@ function EquicordSettings() {
|
|||
<DonateButtonComponent />
|
||||
</SpecialCard>
|
||||
)}
|
||||
{isPluginDev(user?.id) || isEquicordPluginDev(user?.id) && (
|
||||
{isAnyPluginDev(user?.id) && (
|
||||
<SpecialCard
|
||||
title="Contributions"
|
||||
subtitle="Thank you for contributing!"
|
||||
|
|
|
|||
|
|
@ -20,12 +20,13 @@ import { definePluginSettings } from "@api/Settings";
|
|||
import { EquicordDevs } from "@utils/constants";
|
||||
import definePlugin, { makeRange, OptionType } from "@utils/types";
|
||||
import { Channel, Message, User } from "@vencord/discord-types";
|
||||
import { MessageType } from "@vencord/discord-types/enums";
|
||||
import { findByPropsLazy, findStore } from "@webpack";
|
||||
import { Button, ChannelStore, GuildRoleStore, NavigationRouter, RelationshipStore, SelectedChannelStore, StreamerModeStore, UserStore } from "@webpack/common";
|
||||
import { ReactNode } from "react";
|
||||
|
||||
import { NotificationData, showNotification } from "./components/Notifications";
|
||||
import { MessageTypes, RelationshipType, StreamingTreatment } from "./types";
|
||||
import { RelationshipType, StreamingTreatment } from "./types";
|
||||
|
||||
let ignoredUsers: string[] = [];
|
||||
let notifyFor: string[] = [];
|
||||
|
|
@ -271,11 +272,11 @@ export default definePlugin({
|
|||
|
||||
// Handle specific message types.
|
||||
switch (message.type) {
|
||||
case MessageTypes.CALL: {
|
||||
case MessageType.CALL: {
|
||||
Notification.body = "Started a call with you!";
|
||||
break;
|
||||
}
|
||||
case MessageTypes.CHANNEL_RECIPIENT_ADD: {
|
||||
case MessageType.RECIPIENT_ADD: {
|
||||
const actor = UserStore.getUser(message.author.id);
|
||||
const user = message.mentions[0];
|
||||
const targetUser = UserStore.getUser((user as any).id);
|
||||
|
|
@ -283,7 +284,7 @@ export default definePlugin({
|
|||
Notification.body = `${getName(targetUser)} was added to the group by ${getName(actor)}.`;
|
||||
break;
|
||||
}
|
||||
case MessageTypes.CHANNEL_RECIPIENT_REMOVE: {
|
||||
case MessageType.RECIPIENT_REMOVE: {
|
||||
const actor = UserStore.getUser(message.author.id);
|
||||
const user = message.mentions[0];
|
||||
const targetUser = UserStore.getUser((user as any).id);
|
||||
|
|
@ -295,15 +296,15 @@ export default definePlugin({
|
|||
}
|
||||
break;
|
||||
}
|
||||
case MessageTypes.CHANNEL_NAME_CHANGE: {
|
||||
case MessageType.CHANNEL_NAME_CHANGE: {
|
||||
Notification.body = `Changed the channel name to '${message.content}'.`;
|
||||
break;
|
||||
}
|
||||
case MessageTypes.CHANNEL_ICON_CHANGE: {
|
||||
case MessageType.CHANNEL_ICON_CHANGE: {
|
||||
Notification.body = "Changed the channel icon.";
|
||||
break;
|
||||
}
|
||||
case MessageTypes.CHANNEL_PINNED_MESSAGE: {
|
||||
case MessageType.CHANNEL_PINNED_MESSAGE: {
|
||||
Notification.body = "Pinned a message.";
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,15 +16,6 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export const enum MessageTypes {
|
||||
CHANNEL_RECIPIENT_ADD = 1,
|
||||
CHANNEL_RECIPIENT_REMOVE = 2,
|
||||
CALL = 3,
|
||||
CHANNEL_NAME_CHANGE = 4,
|
||||
CHANNEL_ICON_CHANGE = 5,
|
||||
CHANNEL_PINNED_MESSAGE = 6,
|
||||
}
|
||||
|
||||
export const enum RelationshipType {
|
||||
FRIEND = 1,
|
||||
BLOCKED = 2,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import { isEquicordPluginDev, isPluginDev } from "@utils/misc";
|
||||
import { isAnyPluginDev } from "@utils/misc";
|
||||
import definePlugin from "@utils/types";
|
||||
import { UserStore } from "@webpack/common";
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ export default definePlugin({
|
|||
required: true,
|
||||
start() {
|
||||
const selfId = UserStore.getCurrentUser()?.id;
|
||||
if (isPluginDev(selfId) || isEquicordPluginDev(selfId)) {
|
||||
if (isAnyPluginDev(selfId)) {
|
||||
Vencord.Settings.plugins.VCSupport.enabled = false;
|
||||
} else {
|
||||
Vencord.Settings.plugins.VCSupport.enabled = true;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import { CONTRIB_ROLE_ID, Devs, DONOR_ROLE_ID, EQUIBOP_CONTRIB_ROLE_ID, EQUICORD
|
|||
import { sendMessage } from "@utils/discord";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { isEquicordGuild, isEquicordPluginDev, isEquicordSupport, isPluginDev, isSupportChannel, tryOrElse } from "@utils/misc";
|
||||
import { isAnyPluginDev, isEquicordGuild, isEquicordSupport, isSupportChannel, tryOrElse } from "@utils/misc";
|
||||
import { relaunch } from "@utils/native";
|
||||
import { onlyOnce } from "@utils/onlyOnce";
|
||||
import { makeCodeblock } from "@utils/text";
|
||||
|
|
@ -167,7 +167,7 @@ function generatePluginList() {
|
|||
|
||||
const user = UserStore.getCurrentUser();
|
||||
|
||||
if (enabledPlugins.length > 100 && !(isPluginDev(user.id) || isEquicordPluginDev(user.id))) {
|
||||
if (enabledPlugins.length > 100 && !isAnyPluginDev(user.id)) {
|
||||
Alerts.show({
|
||||
title: "You are attempting to get support!",
|
||||
body: <div>
|
||||
|
|
@ -220,14 +220,14 @@ export default definePlugin({
|
|||
name: "equicord-debug",
|
||||
description: "Send Equicord debug info",
|
||||
// @ts-ignore
|
||||
predicate: ctx => isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id) || isEquicordGuild(ctx?.guild?.id, true),
|
||||
predicate: ctx => isAnyPluginDev(UserStore.getCurrentUser()?.id) || isEquicordGuild(ctx?.guild?.id, true),
|
||||
execute: async () => ({ content: await generateDebugInfoMessage() })
|
||||
},
|
||||
{
|
||||
name: "equicord-plugins",
|
||||
description: "Send Equicord plugin list",
|
||||
// @ts-ignore
|
||||
predicate: ctx => isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id) || isEquicordGuild(ctx?.guild?.id, true),
|
||||
predicate: ctx => isAnyPluginDev(UserStore.getCurrentUser()?.id) || isEquicordGuild(ctx?.guild?.id, true),
|
||||
execute: () => {
|
||||
const pluginList = generatePluginList();
|
||||
return { content: typeof pluginList === "string" ? pluginList : "Unable to generate plugin list." };
|
||||
|
|
@ -241,7 +241,7 @@ export default definePlugin({
|
|||
if (!isSupportChannel) return;
|
||||
|
||||
const selfId = UserStore.getCurrentUser()?.id;
|
||||
if (!selfId || isPluginDev(selfId) || isEquicordPluginDev(selfId)) return;
|
||||
if (!selfId || isAnyPluginDev(selfId)) return;
|
||||
if (VC_SUPPORT_CHANNEL_IDS.includes(channelId) && Vencord.Plugins.isPluginEnabled("VCSupport") && !clicked) {
|
||||
return Alerts.show({
|
||||
title: "You are entering the support channel!",
|
||||
|
|
@ -418,8 +418,8 @@ export default definePlugin({
|
|||
|
||||
renderContributorDmWarningCard: ErrorBoundary.wrap(({ channel }) => {
|
||||
const userId = channel.getRecipientId();
|
||||
if (!isPluginDev(userId) || !isEquicordPluginDev(userId)) return null;
|
||||
if (RelationshipStore.isFriend(userId) || isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id)) return null;
|
||||
if (!isAnyPluginDev(userId)) return null;
|
||||
if (RelationshipStore.isFriend(userId) || isAnyPluginDev(UserStore.getCurrentUser()?.id)) return null;
|
||||
|
||||
return (
|
||||
<Card className={`vc-plugins-restart-card ${Margins.top8}`}>
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ export const shouldShowContributorBadge = (id: string) => isPluginDev(id) && Ven
|
|||
export const isEquicordPluginDev = (id: string) => Object.hasOwn(EquicordDevsById, id);
|
||||
export const shouldShowEquicordContributorBadge = (id: string) => isEquicordPluginDev(id) && EquicordDevsById[id].badge !== false;
|
||||
|
||||
export const isAnyPluginDev = (id: string) => Object.hasOwn(VencordDevsById, id) || Object.hasOwn(EquicordDevsById, id);
|
||||
|
||||
export function pluralise(amount: number, singular: string, plural = singular + "s") {
|
||||
return amount === 1 ? `${amount} ${singular}` : `${amount} ${plural}`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue