Merge branch 'dev' into translation
This commit is contained in:
commit
68cf3857f3
20 changed files with 739 additions and 856 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "equicord",
|
||||
"private": "true",
|
||||
"version": "1.14.4.0",
|
||||
"version": "1.14.4.1",
|
||||
"description": "The other cutest Discord client mod",
|
||||
"homepage": "https://github.com/Equicord/Equicord#readme",
|
||||
"bugs": {
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@
|
|||
|
||||
import { ApplicationCommandInputType, sendBotMessage } from "@api/Commands";
|
||||
import { HeaderBarButton } from "@api/HeaderBar";
|
||||
import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
||||
import { isPluginEnabled } from "@api/PluginManager";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { definePluginSettings, migratePluginToSettings } from "@api/Settings";
|
||||
import customRPC from "@plugins/customRPC";
|
||||
import { Devs, EquicordDevs, GUILD_ID, SUPPORT_CHANNEL_ID, SUPPORT_CHANNEL_IDS, VC_SUPPORT_CHANNEL_IDS } from "@utils/constants";
|
||||
import { isAnyPluginDev } from "@utils/misc";
|
||||
|
|
@ -21,6 +22,9 @@ import { ComponentType } from "react";
|
|||
import { PluginButtons } from "./pluginButtons";
|
||||
import { PluginCards } from "./pluginCards";
|
||||
|
||||
migratePluginToSettings(true, "EquicordHelper", "NoBulletPoints", "noBulletPoints");
|
||||
migratePluginToSettings(true, "EquicordHelper", "NoModalAnimation", "noModalAnimation");
|
||||
|
||||
let clicked = false;
|
||||
|
||||
const SafetyHubStore = findStoreLazy("SafetyHubStore");
|
||||
|
|
@ -59,6 +63,11 @@ function StandingButton() {
|
|||
);
|
||||
}
|
||||
|
||||
const listener = async (channelId, msg) => {
|
||||
if (!settings.store.noBulletPoints) return;
|
||||
msg.content = textProcessing(msg.content);
|
||||
};
|
||||
|
||||
const settings = definePluginSettings({
|
||||
noMirroredCamera: {
|
||||
type: OptionType.BOOLEAN,
|
||||
|
|
@ -107,12 +116,34 @@ const settings = definePluginSettings({
|
|||
restartNeeded: true,
|
||||
default: false
|
||||
},
|
||||
noBulletPoints: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: t("equicord.noBulletPoints.description"),
|
||||
restartNeeded: true,
|
||||
default: false
|
||||
},
|
||||
noModalAnimation: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: t("equicord.noModalAnimation.description"),
|
||||
restartNeeded: true,
|
||||
default: false
|
||||
},
|
||||
});
|
||||
|
||||
export default definePlugin({
|
||||
name: "EquicordHelper",
|
||||
description: t("equicord.equicordHelper.description"),
|
||||
authors: [Devs.thororen, EquicordDevs.nyx, EquicordDevs.Naibuu, EquicordDevs.keircn, EquicordDevs.SerStars, EquicordDevs.mart, EquicordDevs.omaw],
|
||||
authors: [
|
||||
Devs.thororen,
|
||||
EquicordDevs.nyx,
|
||||
EquicordDevs.Naibuu,
|
||||
EquicordDevs.keircn,
|
||||
EquicordDevs.SerStars,
|
||||
EquicordDevs.mart,
|
||||
EquicordDevs.omaw,
|
||||
Devs.Samwich,
|
||||
Devs.AutumnVN
|
||||
],
|
||||
required: true,
|
||||
settings,
|
||||
headerBarButton: {
|
||||
|
|
@ -200,13 +231,49 @@ export default definePlugin({
|
|||
},
|
||||
// Restore File Download Button
|
||||
{
|
||||
predicate: () => settings.store.restoreFileDownloadButton,
|
||||
find: '"VISUAL_PLACEHOLDER":',
|
||||
predicate: () => settings.store.restoreFileDownloadButton,
|
||||
replacement: {
|
||||
match: /(\.downloadUrl,showDownload:)\i/,
|
||||
replace: "$1!0"
|
||||
}
|
||||
},
|
||||
// Removes Modal Animation
|
||||
{
|
||||
find: "DURATION_IN:",
|
||||
predicate: () => settings.store.noModalAnimation,
|
||||
replacement: {
|
||||
match: /300,/,
|
||||
replace: "0,",
|
||||
}
|
||||
},
|
||||
// Removes Modal Animation
|
||||
{
|
||||
find: 'backdropFilter:"blur(0px)"',
|
||||
predicate: () => settings.store.noModalAnimation,
|
||||
replacement: {
|
||||
match: /\?0:200/,
|
||||
replace: "?0:0",
|
||||
}
|
||||
},
|
||||
// Removes Modal Animation
|
||||
{
|
||||
find: '="ABOVE"',
|
||||
predicate: () => settings.store.noModalAnimation,
|
||||
replacement: {
|
||||
match: /\?\?300/,
|
||||
replace: "??0",
|
||||
}
|
||||
},
|
||||
// Removes Modal Animation
|
||||
{
|
||||
find: "renderLurkerModeUpsellPopout,position:",
|
||||
predicate: () => settings.store.noModalAnimation,
|
||||
replacement: {
|
||||
match: /200:300/g,
|
||||
replace: "0:0",
|
||||
},
|
||||
}
|
||||
],
|
||||
renderMessageAccessory(props) {
|
||||
return (
|
||||
|
|
@ -256,5 +323,19 @@ export default definePlugin({
|
|||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
start() {
|
||||
if (settings.store.noBulletPoints) {
|
||||
addMessagePreSendListener(listener);
|
||||
}
|
||||
},
|
||||
stop() {
|
||||
if (settings.store.noBulletPoints) {
|
||||
removeMessagePreSendListener(listener);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function textProcessing(text: string): string {
|
||||
return text.replace(/(^|\n)(\s*)([*+-])\s+/g, "$1$2\\$3 ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,295 +0,0 @@
|
|||
/*
|
||||
* Vencord, a modification for Discord's desktop app
|
||||
* Copyright (c) 2025 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 { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands";
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import { t } from "@utils/translation";
|
||||
import definePlugin from "@utils/types";
|
||||
import { User } from "@vencord/discord-types";
|
||||
import { findStore } from "@webpack";
|
||||
import { DraftType, UploadHandler, UserStore } from "@webpack/common";
|
||||
|
||||
const logger = new Logger("FriendCloud");
|
||||
|
||||
interface AffinitiesV2 {
|
||||
otherUserId: User["id"];
|
||||
userSegment: "NON_MAU" | "NON_HFU_MAU" | "HFU_MAU";
|
||||
otherUserSegment: "NON_MAU" | "NON_HFU_MAU" | "HFU_MAU";
|
||||
isFriend: boolean;
|
||||
dmProbability: number;
|
||||
dmRank: number;
|
||||
vcProbability: number;
|
||||
vcRank: number;
|
||||
serverMessageProbability: number;
|
||||
serverMessageRank: number;
|
||||
communicationProbability: number;
|
||||
communicationRank: number;
|
||||
}
|
||||
|
||||
interface UserPosition {
|
||||
member: User;
|
||||
affinity: number;
|
||||
x: number;
|
||||
y: number;
|
||||
size: number;
|
||||
}
|
||||
|
||||
export default definePlugin({
|
||||
name: "FriendCloud",
|
||||
description: t("equicord.friendCloud.description"),
|
||||
authors: [EquicordDevs.Fafa],
|
||||
commands: [
|
||||
{
|
||||
inputType: ApplicationCommandInputType.BUILT_IN,
|
||||
name: "friendcloud",
|
||||
description: t("equicord.friendCloud.commands.friendcloud"),
|
||||
options: [
|
||||
{
|
||||
name: "count",
|
||||
description: t("equicord.friendCloud.commands.count"),
|
||||
type: ApplicationCommandOptionType.NUMBER,
|
||||
required: false
|
||||
}
|
||||
],
|
||||
execute: async (opts, cmdCtx) => {
|
||||
const count = findOption(opts, "count", 25);
|
||||
|
||||
if (!count) return sendBotMessage(cmdCtx.channel.id, { content: t("equicord.friendCloud.errors.countMustBeHigher") });
|
||||
|
||||
try {
|
||||
const affinities: AffinitiesV2[] = findStore("UserAffinitiesV2Store").getUserAffinities();
|
||||
|
||||
if (!affinities?.length) {
|
||||
return sendBotMessage(cmdCtx.channel.id, {
|
||||
content: t("equicord.friendCloud.errors.noAffinities")
|
||||
});
|
||||
}
|
||||
|
||||
const users = affinities
|
||||
.map(e => ({
|
||||
member: UserStore.getUser(e.otherUserId),
|
||||
affinity: calculateAffinityScore(e as AffinitiesV2)
|
||||
}))
|
||||
.filter(x => x.member?.id)
|
||||
.sort((a, b) => b.affinity - a.affinity)
|
||||
.slice(0, count);
|
||||
|
||||
if (!users.length) {
|
||||
return sendBotMessage(cmdCtx.channel.id, {
|
||||
content: t("equicord.friendCloud.errors.noValidUsers")
|
||||
});
|
||||
}
|
||||
|
||||
const minAffinity = Math.min(...users.map(u => u.affinity));
|
||||
const maxAffinity = Math.max(...users.map(u => u.affinity));
|
||||
const minSize = 120;
|
||||
const maxSize = 240;
|
||||
|
||||
const getSize = (affinity: number): number => {
|
||||
if (maxAffinity === minAffinity) return (minSize + maxSize) / 2;
|
||||
return minSize + ((affinity - minAffinity) / (maxAffinity - minAffinity)) * (maxSize - minSize);
|
||||
};
|
||||
|
||||
const avgSize = (minSize + maxSize) / 2;
|
||||
const { width: canvasWidth, height: canvasHeight } = calculateCanvasSize(users.length, avgSize);
|
||||
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = canvasWidth;
|
||||
canvas.height = canvasHeight;
|
||||
const ctx = canvas.getContext("2d")!;
|
||||
|
||||
const positions: Array<{ x: number, y: number, size: number; }> = [];
|
||||
const userPositions = users.map(user => {
|
||||
const size = getSize(user.affinity);
|
||||
const pos = generatePoissonDiskPosition(positions, canvasWidth, canvasHeight, size);
|
||||
positions.push({ x: pos.x, y: pos.y, size });
|
||||
return { ...user, x: pos.x, y: pos.y, size };
|
||||
});
|
||||
|
||||
let loadedImages = 0;
|
||||
const totalImages = userPositions.length;
|
||||
|
||||
const drawImage = async (user: UserPosition) => {
|
||||
try {
|
||||
const avatarUrl = user.member?.avatar
|
||||
? `https://cdn.discordapp.com/avatars/${user.member.id}/${user.member?.avatar}.webp?size=256`
|
||||
: `https://cdn.discordapp.com/embed/avatars/${user.member.id as any as number % 5}.png`;
|
||||
|
||||
const img = await loadImage(avatarUrl);
|
||||
const centerX = user.x + user.size / 2;
|
||||
const centerY = user.y + user.size / 2;
|
||||
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.arc(centerX, centerY, user.size / 2, 0, Math.PI * 2);
|
||||
ctx.clip();
|
||||
ctx.drawImage(img, user.x, user.y, user.size, user.size);
|
||||
ctx.restore();
|
||||
|
||||
ctx.strokeStyle = "#808080";
|
||||
ctx.lineWidth = 3;
|
||||
ctx.beginPath();
|
||||
ctx.arc(centerX, centerY, user.size / 2 + 1, 0, Math.PI * 2);
|
||||
ctx.stroke();
|
||||
} catch {
|
||||
// we ignore
|
||||
} finally {
|
||||
loadedImages++;
|
||||
if (loadedImages === totalImages) {
|
||||
canvas.toBlob(blob => {
|
||||
if (!blob) {
|
||||
sendBotMessage(cmdCtx.channel.id, { content: t("equicord.friendCloud.errors.couldntGenerate") });
|
||||
return;
|
||||
}
|
||||
const file = new File([blob], "affinities-cloud.png", { type: "image/png" });
|
||||
UploadHandler.promptToUpload([file], cmdCtx.channel, DraftType.ChannelMessage);
|
||||
}, "image/png");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
userPositions.forEach(drawImage);
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof Error)
|
||||
sendBotMessage(cmdCtx.channel.id, { content: e.message });
|
||||
else logger.error(e);
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
function calculateAffinityScore(affinity: AffinitiesV2): number {
|
||||
const weights = {
|
||||
friend: 0.15,
|
||||
dm: 0.30,
|
||||
vc: 0.25,
|
||||
serverMsg: 0.20,
|
||||
communication: 0.10
|
||||
};
|
||||
|
||||
let score = 0;
|
||||
if (affinity.isFriend) score += weights.friend * 100;
|
||||
score += affinity.dmProbability * weights.dm * 100;
|
||||
score += affinity.vcProbability * weights.vc * 100;
|
||||
score += affinity.serverMessageProbability * weights.serverMsg * 100;
|
||||
score += affinity.communicationProbability * weights.communication * 100;
|
||||
|
||||
return Math.round(Math.min(100, Math.max(0, score)) * 100) / 100;
|
||||
}
|
||||
|
||||
// stolen from petpet thanks vee
|
||||
function loadImage(source: File | string): Promise<HTMLImageElement> {
|
||||
const isFile = source instanceof File;
|
||||
const url = isFile ? URL.createObjectURL(source) : source;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const img = new Image();
|
||||
img.onload = () => {
|
||||
if (isFile) URL.revokeObjectURL(url);
|
||||
resolve(img);
|
||||
};
|
||||
img.onerror = (event, _source, _lineno, _colno, err) => reject(err || event);
|
||||
img.crossOrigin = "anonymous";
|
||||
img.src = url;
|
||||
});
|
||||
}
|
||||
|
||||
function generatePoissonDiskPosition(
|
||||
existingPositions: Array<{ x: number, y: number, size: number; }>,
|
||||
canvasWidth: number,
|
||||
canvasHeight: number,
|
||||
size: number
|
||||
): { x: number, y: number; } {
|
||||
const edgePadding = 10;
|
||||
const minDist = size * 1.5;
|
||||
const textSpace = 60;
|
||||
const k = 30;
|
||||
|
||||
function isValid(x: number, y: number) {
|
||||
if (
|
||||
x < edgePadding ||
|
||||
x + size > canvasWidth - edgePadding ||
|
||||
y < edgePadding ||
|
||||
y + size > canvasHeight - textSpace - edgePadding
|
||||
) return false;
|
||||
|
||||
return !existingPositions.some(pos => {
|
||||
const dx = pos.x - x;
|
||||
const dy = pos.y - y;
|
||||
const dist = Math.hypot(dx, dy);
|
||||
const minAllowed = (pos.size + size) / 2 + (minDist - size);
|
||||
return dist < minAllowed;
|
||||
});
|
||||
}
|
||||
|
||||
if (existingPositions.length === 0) {
|
||||
return {
|
||||
x: canvasWidth / 2 - size / 2,
|
||||
y: canvasHeight / 2 - size / 2
|
||||
};
|
||||
}
|
||||
|
||||
for (let tries = 0; tries < 100; tries++) {
|
||||
const base = existingPositions[Math.floor(Math.random() * existingPositions.length)];
|
||||
for (let i = 0; i < k; i++) {
|
||||
const angle = Math.random() * Math.PI * 2;
|
||||
const radius = minDist + Math.random() * minDist;
|
||||
const x = base.x + Math.cos(angle) * radius;
|
||||
const y = base.y + Math.sin(angle) * radius;
|
||||
if (isValid(x, y)) {
|
||||
return {
|
||||
x: Math.max(edgePadding, Math.min(x, canvasWidth - size - edgePadding)),
|
||||
y: Math.max(edgePadding, Math.min(y, canvasHeight - size - textSpace - edgePadding))
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let tries = 0; tries < 100; tries++) {
|
||||
const x = Math.random() * (canvasWidth - size - edgePadding * 2) + edgePadding;
|
||||
const y = Math.random() * (canvasHeight - size - textSpace - edgePadding * 2) + edgePadding;
|
||||
if (isValid(x, y)) {
|
||||
return {
|
||||
x: Math.max(edgePadding, Math.min(x, canvasWidth - size - edgePadding)),
|
||||
y: Math.max(edgePadding, Math.min(y, canvasHeight - size - textSpace - edgePadding))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
x: edgePadding,
|
||||
y: edgePadding
|
||||
};
|
||||
}
|
||||
|
||||
function calculateCanvasSize(userCount: number, avatarSize: number): { width: number, height: number; } {
|
||||
const padding = 50;
|
||||
const textSpace = 60;
|
||||
const itemWidth = avatarSize + padding;
|
||||
const itemHeight = avatarSize + textSpace + padding;
|
||||
const aspectRatio = 16 / 9;
|
||||
const cols = Math.ceil(Math.sqrt(userCount * aspectRatio));
|
||||
const rows = Math.ceil(userCount / cols);
|
||||
|
||||
return {
|
||||
width: Math.max(1000, cols * itemWidth + padding),
|
||||
height: Math.max(700, rows * itemHeight + padding)
|
||||
};
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { t } from "@utils/translation";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { UserSettingsActionCreators } from "@webpack/common";
|
||||
|
||||
function getMessage(opts, other) {
|
||||
const frecencyStore = UserSettingsActionCreators.FrecencyUserSettingsActionCreators.getCurrentValue();
|
||||
|
||||
const gifsArray = Object.keys(frecencyStore.favoriteGifs.gifs);
|
||||
|
||||
const chosenGifUrl = gifsArray[Math.floor(Math.random() * gifsArray.length)];
|
||||
|
||||
let ownerPing = "";
|
||||
|
||||
if (other.guild != null) {
|
||||
if (other.guild.ownerId != null && settings.store.pingOwnerChance && Math.random() <= 0.1) {
|
||||
ownerPing = `<@${other.guild.ownerId}>`;
|
||||
}
|
||||
}
|
||||
|
||||
return `${chosenGifUrl} ${ownerPing}`;
|
||||
}
|
||||
|
||||
const settings = definePluginSettings({
|
||||
pingOwnerChance: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: t("equicord.gifRoulette.settings.pingOwnerChance"),
|
||||
default: true
|
||||
}
|
||||
});
|
||||
|
||||
export default definePlugin({
|
||||
name: "GifRoulette",
|
||||
description: t("equicord.gifRoulette.description"),
|
||||
authors: [Devs.Samwich],
|
||||
settings,
|
||||
commands: [
|
||||
{
|
||||
name: "gifroulette",
|
||||
description: t("equicord.gifRoulette.commands.gifroulette"),
|
||||
execute: (opts, other) => ({
|
||||
content: getMessage(opts, other)
|
||||
}),
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
@ -1,158 +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 { ApplicationCommandInputType, ApplicationCommandOptionType, sendBotMessage } from "@api/Commands";
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
import { t } from "@utils/translation";
|
||||
import definePlugin from "@utils/types";
|
||||
import { CommandArgument, CommandContext } from "@vencord/discord-types";
|
||||
import { DraftType, UploadAttachmentStore, UploadHandler, UploadManager } from "@webpack/common";
|
||||
import { applyPalette, GIFEncoder, quantize } from "gifenc";
|
||||
|
||||
const FRAMES = 1;
|
||||
|
||||
function loadImage(source: File | string) {
|
||||
const isFile = source instanceof File;
|
||||
const url = isFile ? URL.createObjectURL(source) : source;
|
||||
|
||||
return new Promise<HTMLImageElement>((resolve, reject) => {
|
||||
const img = new Image();
|
||||
img.onload = () => {
|
||||
if (isFile) URL.revokeObjectURL(url);
|
||||
resolve(img);
|
||||
};
|
||||
img.onerror = (event, _source, _lineno, _colno, err) => reject(err || event);
|
||||
img.crossOrigin = "Anonymous";
|
||||
img.src = url;
|
||||
});
|
||||
}
|
||||
|
||||
async function resolveImage(options: CommandArgument[], ctx: CommandContext): Promise<{ image: File | null; width: number | null; height: number | null; }> {
|
||||
let image: File | null = null;
|
||||
let width: number | null = null;
|
||||
let height: number | null = null;
|
||||
|
||||
for (const opt of options) {
|
||||
switch (opt.name) {
|
||||
case "image":
|
||||
const upload = UploadAttachmentStore.getUpload(ctx.channel.id, opt.name, DraftType.SlashCommand);
|
||||
if (upload) {
|
||||
if (!upload.isImage) {
|
||||
UploadManager.clearAll(ctx.channel.id, DraftType.SlashCommand);
|
||||
throw t("equicord.imgToGif.errors.notAnImage");
|
||||
}
|
||||
image = upload.item.file;
|
||||
}
|
||||
break;
|
||||
case "width":
|
||||
width = Number(opt.value);
|
||||
break;
|
||||
case "height":
|
||||
height = Number(opt.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UploadManager.clearAll(ctx.channel.id, DraftType.SlashCommand);
|
||||
return { image, width, height };
|
||||
}
|
||||
|
||||
export default definePlugin({
|
||||
name: "ImgToGif",
|
||||
description: t("equicord.imgToGif.description"),
|
||||
authors: [EquicordDevs.zyqunix],
|
||||
commands: [
|
||||
{
|
||||
inputType: ApplicationCommandInputType.BUILT_IN,
|
||||
name: "imgtogif",
|
||||
description: t("equicord.imgToGif.commands.imgtogif"),
|
||||
options: [
|
||||
{
|
||||
name: "image",
|
||||
description: t("equicord.imgToGif.commands.image"),
|
||||
type: ApplicationCommandOptionType.ATTACHMENT
|
||||
},
|
||||
{
|
||||
name: "width",
|
||||
description: t("equicord.imgToGif.commands.width"),
|
||||
type: ApplicationCommandOptionType.INTEGER
|
||||
},
|
||||
{
|
||||
name: "height",
|
||||
description: t("equicord.imgToGif.commands.height"),
|
||||
type: ApplicationCommandOptionType.INTEGER
|
||||
}
|
||||
],
|
||||
execute: async (opts, cmdCtx) => {
|
||||
try {
|
||||
const { image, width, height } = await resolveImage(opts, cmdCtx);
|
||||
if (!image) throw t("equicord.imgToGif.errors.noImage");
|
||||
|
||||
const avatar = await loadImage(image);
|
||||
|
||||
let gifWidth: number;
|
||||
let gifHeight: number;
|
||||
|
||||
if (width && height) {
|
||||
gifWidth = width;
|
||||
gifHeight = height;
|
||||
} else if (width) {
|
||||
gifWidth = width;
|
||||
gifHeight = Math.round((avatar.height / avatar.width) * width);
|
||||
} else if (height) {
|
||||
gifHeight = height;
|
||||
gifWidth = Math.round((avatar.width / avatar.height) * height);
|
||||
} else {
|
||||
gifWidth = avatar.width;
|
||||
gifHeight = avatar.height;
|
||||
}
|
||||
|
||||
const gif = GIFEncoder();
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = gifWidth;
|
||||
canvas.height = gifHeight;
|
||||
const ctx = canvas.getContext("2d")!;
|
||||
|
||||
UploadManager.clearAll(cmdCtx.channel.id, DraftType.SlashCommand);
|
||||
|
||||
for (let i = 0; i < FRAMES; i++) {
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.drawImage(avatar, 0, 0, avatar.width, avatar.height, 0, 0, canvas.width, canvas.height);
|
||||
|
||||
const { data } = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
||||
const palette = quantize(data, 256);
|
||||
const index = applyPalette(data, palette);
|
||||
|
||||
gif.writeFrame(index, canvas.width, canvas.height, {
|
||||
transparent: true,
|
||||
palette,
|
||||
});
|
||||
}
|
||||
|
||||
gif.finish();
|
||||
const originalName = image.name ? image.name.replace(/\.[^/.]+$/, "") : "converted";
|
||||
const file = new File([new Uint8Array(gif.bytesView())], `${originalName}.gif`, { type: "image/gif" });
|
||||
setTimeout(() => UploadHandler.promptToUpload([file], cmdCtx.channel, DraftType.ChannelMessage), 10);
|
||||
} catch (err) {
|
||||
UploadManager.clearAll(cmdCtx.channel.id, DraftType.SlashCommand);
|
||||
sendBotMessage(cmdCtx.channel.id, { content: String(err) });
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
});
|
||||
|
|
@ -18,18 +18,56 @@
|
|||
|
||||
import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, OptionalMessageOption, RequiredMessageOption, sendBotMessage } from "@api/Commands";
|
||||
import { addMessagePreEditListener, addMessagePreSendListener, MessageObject, removeMessagePreEditListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
||||
import { migratePluginSettings } from "@api/Settings";
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import { sendMessage } from "@utils/discord";
|
||||
import { t } from "@utils/translation";
|
||||
import definePlugin from "@utils/types";
|
||||
import { UserStore } from "@webpack/common";
|
||||
import { DraftType, UploadHandler, UploadManager, UserAffinitiesStore, UserStore } from "@webpack/common";
|
||||
import { applyPalette, GIFEncoder, quantize } from "gifenc";
|
||||
|
||||
import { fromMorse, getCuteAnimeBoys, getCuteNeko, getCutePats, isMorse, makeFreaky, mock, settings, toMorse, uwuify, uwuifyArray } from "./utils";
|
||||
import {
|
||||
calculateAffinityScore,
|
||||
calculateCanvasSize,
|
||||
FRAMES,
|
||||
fromMorse,
|
||||
generatePoissonDiskPosition,
|
||||
getCuteAnimeBoys,
|
||||
getCuteNeko,
|
||||
getCutePats,
|
||||
getMessage,
|
||||
isMorse,
|
||||
loadFriendImage,
|
||||
loadImage,
|
||||
makeFreaky,
|
||||
mock,
|
||||
resolveImage,
|
||||
settings,
|
||||
toMorse,
|
||||
uwuify,
|
||||
uwuifyArray
|
||||
} from "./utils";
|
||||
|
||||
migratePluginSettings("MoreCommands", "FriendCloud", "GifRoulette", "ImgToGif", "MoreKaomoji");
|
||||
|
||||
export default definePlugin({
|
||||
name: "MoreCommands",
|
||||
description: t("equicord.moreCommands.description"),
|
||||
authors: [Devs.Arjix, Devs.amy, Devs.Samu, EquicordDevs.zyqunix, EquicordDevs.ShadyGoat, Devs.thororen, Devs.Korbo, Devs.nyx, Devs.amy],
|
||||
authors: [
|
||||
Devs.Arjix,
|
||||
Devs.amy,
|
||||
Devs.Samu,
|
||||
EquicordDevs.zyqunix,
|
||||
EquicordDevs.ShadyGoat,
|
||||
Devs.thororen,
|
||||
Devs.Korbo,
|
||||
Devs.nyx,
|
||||
Devs.amy,
|
||||
Devs.Samwich,
|
||||
EquicordDevs.Fafa,
|
||||
Devs.JacobTm,
|
||||
EquicordDevs.voidbbg
|
||||
],
|
||||
settings,
|
||||
commands: [
|
||||
{
|
||||
|
|
@ -436,7 +474,394 @@ export default definePlugin({
|
|||
content: uwuify(findOption(opts, "message", "")),
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "gifroulette",
|
||||
description: "Tempt fate and send a gif",
|
||||
execute: (opts, other) => ({
|
||||
content: getMessage(opts, other)
|
||||
}),
|
||||
},
|
||||
{
|
||||
inputType: ApplicationCommandInputType.BUILT_IN,
|
||||
name: "friendcloud",
|
||||
description: "Display user you most interact with in a cloud",
|
||||
options: [
|
||||
{
|
||||
name: "count",
|
||||
description: "Number of users to display",
|
||||
type: ApplicationCommandOptionType.NUMBER,
|
||||
required: false
|
||||
}
|
||||
],
|
||||
execute: async (opts, cmdCtx) => {
|
||||
const count = findOption(opts, "count", 25);
|
||||
|
||||
if (!count) return sendBotMessage(cmdCtx.channel.id, { content: "The count must be 1 or higher!" });
|
||||
|
||||
try {
|
||||
const affinities = UserAffinitiesStore.getUserAffinities();
|
||||
|
||||
if (!affinities?.length) {
|
||||
return sendBotMessage(cmdCtx.channel.id, {
|
||||
content: "No affinities found. Check your [privacy settings](<https://support.discord.com/hc/en-us/articles/21864805694999-Data-Used-to-Improve-Discord>)."
|
||||
});
|
||||
}
|
||||
|
||||
const users = affinities
|
||||
.map(e => ({
|
||||
member: UserStore.getUser(e.otherUserId),
|
||||
affinity: calculateAffinityScore(e)
|
||||
}))
|
||||
.filter(x => x.member?.id)
|
||||
.sort((a, b) => b.affinity - a.affinity)
|
||||
.slice(0, count);
|
||||
|
||||
if (!users.length) {
|
||||
return sendBotMessage(cmdCtx.channel.id, {
|
||||
content: "No valid users found in affinities. Check your [privacy settings](<https://support.discord.com/hc/en-us/articles/21864805694999-Data-Used-to-Improve-Discord>)."
|
||||
});
|
||||
}
|
||||
|
||||
const minAffinity = Math.min(...users.map(u => u.affinity));
|
||||
const maxAffinity = Math.max(...users.map(u => u.affinity));
|
||||
const minSize = 120;
|
||||
const maxSize = 240;
|
||||
|
||||
const getSize = (affinity: number): number => {
|
||||
if (maxAffinity === minAffinity) return (minSize + maxSize) / 2;
|
||||
return minSize + ((affinity - minAffinity) / (maxAffinity - minAffinity)) * (maxSize - minSize);
|
||||
};
|
||||
|
||||
const avgSize = (minSize + maxSize) / 2;
|
||||
const { width: canvasWidth, height: canvasHeight } = calculateCanvasSize(users.length, avgSize);
|
||||
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = canvasWidth;
|
||||
canvas.height = canvasHeight;
|
||||
const ctx = canvas.getContext("2d")!;
|
||||
|
||||
const positions: Array<{ x: number, y: number, size: number; }> = [];
|
||||
const userPositions = users.map(user => {
|
||||
const size = getSize(user.affinity);
|
||||
const pos = generatePoissonDiskPosition(positions, canvasWidth, canvasHeight, size);
|
||||
positions.push({ x: pos.x, y: pos.y, size });
|
||||
return { ...user, x: pos.x, y: pos.y, size };
|
||||
});
|
||||
|
||||
let loadedImages = 0;
|
||||
const totalImages = userPositions.length;
|
||||
|
||||
const drawImage = async user => {
|
||||
try {
|
||||
const avatarUrl = user.member?.avatar
|
||||
? `https://cdn.discordapp.com/avatars/${user.member.id}/${user.member?.avatar}.webp?size=256`
|
||||
: `https://cdn.discordapp.com/embed/avatars/${user.member.id as any as number % 5}.png`;
|
||||
|
||||
const img = await loadFriendImage(avatarUrl);
|
||||
const centerX = user.x + user.size / 2;
|
||||
const centerY = user.y + user.size / 2;
|
||||
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.arc(centerX, centerY, user.size / 2, 0, Math.PI * 2);
|
||||
ctx.clip();
|
||||
ctx.drawImage(img, user.x, user.y, user.size, user.size);
|
||||
ctx.restore();
|
||||
|
||||
ctx.strokeStyle = "#808080";
|
||||
ctx.lineWidth = 3;
|
||||
ctx.beginPath();
|
||||
ctx.arc(centerX, centerY, user.size / 2 + 1, 0, Math.PI * 2);
|
||||
ctx.stroke();
|
||||
} catch {
|
||||
// we ignore
|
||||
} finally {
|
||||
loadedImages++;
|
||||
if (loadedImages === totalImages) {
|
||||
canvas.toBlob(blob => {
|
||||
if (!blob) {
|
||||
sendBotMessage(cmdCtx.channel.id, { content: "Couldn't generate the image :c" });
|
||||
return;
|
||||
}
|
||||
const file = new File([blob], "affinities-cloud.png", { type: "image/png" });
|
||||
UploadHandler.promptToUpload([file], cmdCtx.channel, DraftType.ChannelMessage);
|
||||
}, "image/png");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
userPositions.forEach(drawImage);
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof Error) sendBotMessage(cmdCtx.channel.id, { content: e.message });
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
inputType: ApplicationCommandInputType.BUILT_IN,
|
||||
name: "imgtogif",
|
||||
description: "Allows you to turn an image to a gif",
|
||||
options: [
|
||||
{
|
||||
name: "image",
|
||||
description: "Image attachment to use",
|
||||
type: ApplicationCommandOptionType.ATTACHMENT
|
||||
},
|
||||
{
|
||||
name: "width",
|
||||
description: "Width of the gif",
|
||||
type: ApplicationCommandOptionType.INTEGER
|
||||
},
|
||||
{
|
||||
name: "height",
|
||||
description: "Height of the gif",
|
||||
type: ApplicationCommandOptionType.INTEGER
|
||||
}
|
||||
],
|
||||
execute: async (opts, cmdCtx) => {
|
||||
try {
|
||||
const { image, width, height } = await resolveImage(opts, cmdCtx);
|
||||
if (!image) throw "No Image specified!";
|
||||
|
||||
const avatar = await loadImage(image);
|
||||
|
||||
let gifWidth: number;
|
||||
let gifHeight: number;
|
||||
|
||||
if (width && height) {
|
||||
gifWidth = width;
|
||||
gifHeight = height;
|
||||
} else if (width) {
|
||||
gifWidth = width;
|
||||
gifHeight = Math.round((avatar.height / avatar.width) * width);
|
||||
} else if (height) {
|
||||
gifHeight = height;
|
||||
gifWidth = Math.round((avatar.width / avatar.height) * height);
|
||||
} else {
|
||||
gifWidth = avatar.width;
|
||||
gifHeight = avatar.height;
|
||||
}
|
||||
|
||||
const gif = GIFEncoder();
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = gifWidth;
|
||||
canvas.height = gifHeight;
|
||||
const ctx = canvas.getContext("2d")!;
|
||||
|
||||
UploadManager.clearAll(cmdCtx.channel.id, DraftType.SlashCommand);
|
||||
|
||||
for (let i = 0; i < FRAMES; i++) {
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.drawImage(avatar, 0, 0, avatar.width, avatar.height, 0, 0, canvas.width, canvas.height);
|
||||
|
||||
const { data } = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
||||
const palette = quantize(data, 256);
|
||||
const index = applyPalette(data, palette);
|
||||
|
||||
gif.writeFrame(index, canvas.width, canvas.height, {
|
||||
transparent: true,
|
||||
palette,
|
||||
});
|
||||
}
|
||||
|
||||
gif.finish();
|
||||
const originalName = image.name ? image.name.replace(/\.[^/.]+$/, "") : "converted";
|
||||
const file = new File([new Uint8Array(gif.bytesView())], `${originalName}.gif`, { type: "image/gif" });
|
||||
setTimeout(() => UploadHandler.promptToUpload([file], cmdCtx.channel, DraftType.ChannelMessage), 10);
|
||||
} catch (err) {
|
||||
UploadManager.clearAll(cmdCtx.channel.id, DraftType.SlashCommand);
|
||||
sendBotMessage(cmdCtx.channel.id, { content: String(err) });
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "dissatisfaction",
|
||||
description: " >﹏<",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + " >﹏<",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "smug",
|
||||
description: "ಠ_ಠ",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "ಠ_ಠ",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "happy",
|
||||
description: "ヽ(´▽`)/",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "ヽ(´▽`)/",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "crying",
|
||||
description: "ಥ_ಥ",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "ಥ_ಥ",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "angry",
|
||||
description: "ヽ(`Д´)ノ",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "ヽ(`Д´)ノ",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "anger",
|
||||
description: "ヽ(o`皿′o)ノ",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "ヽ(o`皿′o)ノ",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "joy",
|
||||
description: "<( ̄︶ ̄)>",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "<( ̄︶ ̄)>",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "blush",
|
||||
description: "૮ ˶ᵔ ᵕ ᵔ˶ ა",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "૮ ˶ᵔ ᵕ ᵔ˶ ა",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "confused",
|
||||
description: "(•ิ_•ิ)?",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(•ิ_•ิ)?",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "sleeping",
|
||||
description: "(ᴗ_ᴗ)",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(ᴗ_ᴗ)",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "laughing",
|
||||
description: "o(≧▽≦)o",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "o(≧▽≦)o",
|
||||
}),
|
||||
},
|
||||
/*
|
||||
even more kaomoji
|
||||
*/
|
||||
{
|
||||
name: "giving",
|
||||
description: "(ノ◕ヮ◕)ノ*:・゚✧",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(ノ◕ヮ◕)ノ*:・゚✧",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "peace",
|
||||
description: "✌(◕‿-)✌",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "✌(◕‿-)✌",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "ending1",
|
||||
description: "Ꮺ ָ࣪ ۰ ͙⊹",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "Ꮺ ָ࣪ ۰ ͙⊹",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "uwu",
|
||||
description: "(>⩊<)",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(>⩊<)",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "comfy",
|
||||
description: "(─‿‿─)♡",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(─‿‿─)♡",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "lovehappy",
|
||||
description: "(*≧ω≦*)",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(*≧ω≦*)",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "loveee",
|
||||
description: "(⁄ ⁄>⁄ ▽ ⁄<⁄ ⁄)",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(⁄ ⁄>⁄ ▽ ⁄<⁄ ⁄)",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "give",
|
||||
description: "(ノ= ⩊ = )ノ",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(ノ= ⩊ = )ノ",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "lovegive",
|
||||
description: "ღゝ◡╹)ノ♡",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "ღゝ◡╹)ノ♡",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "music",
|
||||
description: "( ̄▽ ̄)/♫•¨•.¸¸♪",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "( ̄▽ ̄)/♫•¨•.¸¸♪",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "stars",
|
||||
description: ".𖥔 ݁ ˖๋ ࣭ ⭑",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + ".𖥔 ݁ ˖๋ ࣭ ⭑",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "lovegiving",
|
||||
description: "⸜(。˃ ᵕ ˂ )⸝♡",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "⸜(。˃ ᵕ ˂ )⸝♡",
|
||||
}),
|
||||
}
|
||||
],
|
||||
|
||||
patches: [
|
||||
{
|
||||
find: ".isPureReactComponent=!0;",
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { OptionType } from "@utils/types";
|
||||
import { CommandArgument, CommandContext } from "@vencord/discord-types";
|
||||
import { DraftType, UploadAttachmentStore, UploadManager, UserSettingsActionCreators } from "@webpack/common";
|
||||
|
||||
export const settings = definePluginSettings({
|
||||
addFreakyEnding: {
|
||||
|
|
@ -207,3 +209,180 @@ export function uwuifyArray(arr) {
|
|||
|
||||
return newArr;
|
||||
}
|
||||
|
||||
export function getMessage(opts, other) {
|
||||
const frecencyStore = UserSettingsActionCreators.FrecencyUserSettingsActionCreators.getCurrentValue();
|
||||
|
||||
const gifsArray = Object.keys(frecencyStore.favoriteGifs.gifs);
|
||||
|
||||
const chosenGifUrl = gifsArray[Math.floor(Math.random() * gifsArray.length)];
|
||||
|
||||
return `${chosenGifUrl}`;
|
||||
}
|
||||
|
||||
export function calculateAffinityScore(affinity): number {
|
||||
const weights = {
|
||||
friend: 0.15,
|
||||
dm: 0.30,
|
||||
vc: 0.25,
|
||||
serverMsg: 0.20,
|
||||
communication: 0.10
|
||||
};
|
||||
|
||||
let score = 0;
|
||||
if (affinity.isFriend) score += weights.friend * 100;
|
||||
score += affinity.dmProbability * weights.dm * 100;
|
||||
score += affinity.vcProbability * weights.vc * 100;
|
||||
score += affinity.serverMessageProbability * weights.serverMsg * 100;
|
||||
score += affinity.communicationProbability * weights.communication * 100;
|
||||
|
||||
return Math.round(Math.min(100, Math.max(0, score)) * 100) / 100;
|
||||
}
|
||||
|
||||
// stolen from petpet thanks vee
|
||||
export function loadFriendImage(source: File | string): Promise<HTMLImageElement> {
|
||||
const isFile = source instanceof File;
|
||||
const url = isFile ? URL.createObjectURL(source) : source;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const img = new Image();
|
||||
img.onload = () => {
|
||||
if (isFile) URL.revokeObjectURL(url);
|
||||
resolve(img);
|
||||
};
|
||||
img.onerror = (event, _source, _lineno, _colno, err) => reject(err || event);
|
||||
img.crossOrigin = "anonymous";
|
||||
img.src = url;
|
||||
});
|
||||
}
|
||||
|
||||
export function generatePoissonDiskPosition(
|
||||
existingPositions: Array<{ x: number, y: number, size: number; }>,
|
||||
canvasWidth: number,
|
||||
canvasHeight: number,
|
||||
size: number
|
||||
): { x: number, y: number; } {
|
||||
const edgePadding = 10;
|
||||
const minDist = size * 1.5;
|
||||
const textSpace = 60;
|
||||
const k = 30;
|
||||
|
||||
function isValid(x: number, y: number) {
|
||||
if (
|
||||
x < edgePadding ||
|
||||
x + size > canvasWidth - edgePadding ||
|
||||
y < edgePadding ||
|
||||
y + size > canvasHeight - textSpace - edgePadding
|
||||
) return false;
|
||||
|
||||
return !existingPositions.some(pos => {
|
||||
const dx = pos.x - x;
|
||||
const dy = pos.y - y;
|
||||
const dist = Math.hypot(dx, dy);
|
||||
const minAllowed = (pos.size + size) / 2 + (minDist - size);
|
||||
return dist < minAllowed;
|
||||
});
|
||||
}
|
||||
|
||||
if (existingPositions.length === 0) {
|
||||
return {
|
||||
x: canvasWidth / 2 - size / 2,
|
||||
y: canvasHeight / 2 - size / 2
|
||||
};
|
||||
}
|
||||
|
||||
for (let tries = 0; tries < 100; tries++) {
|
||||
const base = existingPositions[Math.floor(Math.random() * existingPositions.length)];
|
||||
for (let i = 0; i < k; i++) {
|
||||
const angle = Math.random() * Math.PI * 2;
|
||||
const radius = minDist + Math.random() * minDist;
|
||||
const x = base.x + Math.cos(angle) * radius;
|
||||
const y = base.y + Math.sin(angle) * radius;
|
||||
if (isValid(x, y)) {
|
||||
return {
|
||||
x: Math.max(edgePadding, Math.min(x, canvasWidth - size - edgePadding)),
|
||||
y: Math.max(edgePadding, Math.min(y, canvasHeight - size - textSpace - edgePadding))
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let tries = 0; tries < 100; tries++) {
|
||||
const x = Math.random() * (canvasWidth - size - edgePadding * 2) + edgePadding;
|
||||
const y = Math.random() * (canvasHeight - size - textSpace - edgePadding * 2) + edgePadding;
|
||||
if (isValid(x, y)) {
|
||||
return {
|
||||
x: Math.max(edgePadding, Math.min(x, canvasWidth - size - edgePadding)),
|
||||
y: Math.max(edgePadding, Math.min(y, canvasHeight - size - textSpace - edgePadding))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
x: edgePadding,
|
||||
y: edgePadding
|
||||
};
|
||||
}
|
||||
|
||||
export function calculateCanvasSize(userCount: number, avatarSize: number): { width: number, height: number; } {
|
||||
const padding = 50;
|
||||
const textSpace = 60;
|
||||
const itemWidth = avatarSize + padding;
|
||||
const itemHeight = avatarSize + textSpace + padding;
|
||||
const aspectRatio = 16 / 9;
|
||||
const cols = Math.ceil(Math.sqrt(userCount * aspectRatio));
|
||||
const rows = Math.ceil(userCount / cols);
|
||||
|
||||
return {
|
||||
width: Math.max(1000, cols * itemWidth + padding),
|
||||
height: Math.max(700, rows * itemHeight + padding)
|
||||
};
|
||||
}
|
||||
|
||||
export const FRAMES = 1;
|
||||
|
||||
export function loadImage(source: File | string) {
|
||||
const isFile = source instanceof File;
|
||||
const url = isFile ? URL.createObjectURL(source) : source;
|
||||
|
||||
return new Promise<HTMLImageElement>((resolve, reject) => {
|
||||
const img = new Image();
|
||||
img.onload = () => {
|
||||
if (isFile) URL.revokeObjectURL(url);
|
||||
resolve(img);
|
||||
};
|
||||
img.onerror = (event, _source, _lineno, _colno, err) => reject(err || event);
|
||||
img.crossOrigin = "Anonymous";
|
||||
img.src = url;
|
||||
});
|
||||
}
|
||||
|
||||
export async function resolveImage(options: CommandArgument[], ctx: CommandContext): Promise<{ image: File | null; width: number | null; height: number | null; }> {
|
||||
let image: File | null = null;
|
||||
let width: number | null = null;
|
||||
let height: number | null = null;
|
||||
|
||||
for (const opt of options) {
|
||||
switch (opt.name) {
|
||||
case "image":
|
||||
const upload = UploadAttachmentStore.getUpload(ctx.channel.id, opt.name, DraftType.SlashCommand);
|
||||
if (upload) {
|
||||
if (!upload.isImage) {
|
||||
UploadManager.clearAll(ctx.channel.id, DraftType.SlashCommand);
|
||||
throw "Upload is not an image";
|
||||
}
|
||||
image = upload.item.file;
|
||||
}
|
||||
break;
|
||||
case "width":
|
||||
width = Number(opt.value);
|
||||
break;
|
||||
case "height":
|
||||
height = Number(opt.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UploadManager.clearAll(ctx.channel.id, DraftType.SlashCommand);
|
||||
return { image, width, height };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,217 +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, OptionalMessageOption } from "@api/Commands";
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import { t } from "@utils/translation";
|
||||
import definePlugin from "@utils/types";
|
||||
|
||||
export default definePlugin({
|
||||
name: "MoreKaomoji",
|
||||
description: t("equicord.moreKaomoji.description"),
|
||||
authors: [Devs.JacobTm, EquicordDevs.voidbbg],
|
||||
commands: [
|
||||
{
|
||||
name: "dissatisfaction",
|
||||
description: " >﹏<",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + " >﹏<",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "smug",
|
||||
description: "ಠ_ಠ",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "ಠ_ಠ",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "happy",
|
||||
description: "ヽ(´▽`)/",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "ヽ(´▽`)/",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "crying",
|
||||
description: "ಥ_ಥ",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "ಥ_ಥ",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "angry",
|
||||
description: "ヽ(`Д´)ノ",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "ヽ(`Д´)ノ",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "anger",
|
||||
description: "ヽ(o`皿′o)ノ",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "ヽ(o`皿′o)ノ",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "joy",
|
||||
description: "<( ̄︶ ̄)>",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "<( ̄︶ ̄)>",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "blush",
|
||||
description: "૮ ˶ᵔ ᵕ ᵔ˶ ა",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "૮ ˶ᵔ ᵕ ᵔ˶ ა",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "confused",
|
||||
description: "(•ิ_•ิ)?",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(•ิ_•ิ)?",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "sleeping",
|
||||
description: "(ᴗ_ᴗ)",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(ᴗ_ᴗ)",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "laughing",
|
||||
description: "o(≧▽≦)o",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "o(≧▽≦)o",
|
||||
}),
|
||||
},
|
||||
/*
|
||||
even more kaomoji
|
||||
*/
|
||||
{
|
||||
name: "giving",
|
||||
description: "(ノ◕ヮ◕)ノ*:・゚✧",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(ノ◕ヮ◕)ノ*:・゚✧",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "peace",
|
||||
description: "✌(◕‿-)✌",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "✌(◕‿-)✌",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "ending1",
|
||||
description: "Ꮺ ָ࣪ ۰ ͙⊹",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "Ꮺ ָ࣪ ۰ ͙⊹",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "uwu",
|
||||
description: "(>⩊<)",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(>⩊<)",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "comfy",
|
||||
description: "(─‿‿─)♡",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(─‿‿─)♡",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "lovehappy",
|
||||
description: "(*≧ω≦*)",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(*≧ω≦*)",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "loveee",
|
||||
description: "(⁄ ⁄>⁄ ▽ ⁄<⁄ ⁄)",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(⁄ ⁄>⁄ ▽ ⁄<⁄ ⁄)",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "give",
|
||||
description: "(ノ= ⩊ = )ノ",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "(ノ= ⩊ = )ノ",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "lovegive",
|
||||
description: "ღゝ◡╹)ノ♡",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "ღゝ◡╹)ノ♡",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "music",
|
||||
description: "( ̄▽ ̄)/♫•¨•.¸¸♪",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "( ̄▽ ̄)/♫•¨•.¸¸♪",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "stars",
|
||||
description: ".𖥔 ݁ ˖๋ ࣭ ⭑",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + ".𖥔 ݁ ˖๋ ࣭ ⭑",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "lovegiving",
|
||||
description: "⸜(。˃ ᵕ ˂ )⸝♡",
|
||||
options: [OptionalMessageOption],
|
||||
execute: opts => ({
|
||||
content: findOption(opts, "message", "") + " " + "⸜(。˃ ᵕ ˂ )⸝♡",
|
||||
}),
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
import "./styles.css";
|
||||
|
||||
import { migratePluginToSettings } from "@api/Settings";
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import { classNameFactory } from "@utils/css";
|
||||
import { getCurrentChannel, getIntlMessage } from "@utils/discord";
|
||||
|
|
@ -32,10 +33,12 @@ const genTagTypes = () => {
|
|||
return obj;
|
||||
};
|
||||
|
||||
migratePluginToSettings(true, "MoreUserTags", "NoAppsAllowed", "noAppsAllowed");
|
||||
|
||||
export default definePlugin({
|
||||
name: "MoreUserTags",
|
||||
description: t("equicord.moreUserTags.description"),
|
||||
authors: [Devs.Cyn, Devs.TheSun, Devs.RyanCaoDev, Devs.LordElias, Devs.AutumnVN, EquicordDevs.Hen],
|
||||
authors: [Devs.Cyn, Devs.TheSun, Devs.RyanCaoDev, Devs.LordElias, Devs.AutumnVN, EquicordDevs.Hen, EquicordDevs.meowabyte],
|
||||
settings,
|
||||
patches: [
|
||||
// Make discord actually use our tags
|
||||
|
|
@ -52,6 +55,14 @@ export default definePlugin({
|
|||
predicate: () => settings.store.dontShowBotTag
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
find: '"#{intl::APP_TAG::hash}":',
|
||||
predicate: () => settings.store.noAppsAllowed,
|
||||
replacement: {
|
||||
match: /(#{intl::APP_TAG::hash}":\[").*?("\])/,
|
||||
replace: "$1BOT$2"
|
||||
}
|
||||
}
|
||||
],
|
||||
start() {
|
||||
|
|
|
|||
|
|
@ -116,4 +116,10 @@ export const settings = definePluginSettings({
|
|||
component: SettingsComponent,
|
||||
description: t("equicord.moreUserTags.settings.tagSettings")
|
||||
},
|
||||
noAppsAllowed: {
|
||||
description: "Replaces app for bot",
|
||||
type: OptionType.BOOLEAN,
|
||||
default: false,
|
||||
restartNeeded: true
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2023 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { EquicordDevs } from "@utils/constants";
|
||||
import { t } from "@utils/translation";
|
||||
import definePlugin from "@utils/types";
|
||||
|
||||
export default definePlugin({
|
||||
name: "NoAppsAllowed",
|
||||
description: t("equicord.noAppsAllowed.description"),
|
||||
authors: [EquicordDevs.meowabyte],
|
||||
patches: [
|
||||
{
|
||||
find: '"#{intl::APP_TAG::hash}":',
|
||||
replacement: {
|
||||
match: /(#{intl::APP_TAG::hash}":\[").*?("\])/,
|
||||
replace: "$1BOT$2"
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { Devs } from "@utils/constants";
|
||||
import { t } from "@utils/translation";
|
||||
import definePlugin from "@utils/types";
|
||||
export default definePlugin({
|
||||
name: "NoBulletPoints",
|
||||
description: t("equicord.noBulletPoints.description"),
|
||||
authors: [Devs.Samwich],
|
||||
onBeforeMessageSend(channelId, msg) {
|
||||
msg.content = textProcessing(msg.content);
|
||||
},
|
||||
});
|
||||
|
||||
function textProcessing(text: string): string {
|
||||
return text.replace(/(^|\n)(\s*)([*+-])\s+/g, "$1$2\\$3 ");
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { Devs } from "@utils/constants";
|
||||
import { t } from "@utils/translation";
|
||||
import definePlugin from "@utils/types";
|
||||
|
||||
export default definePlugin({
|
||||
name: "NoModalAnimation",
|
||||
description: t("equicord.noModalAnimation.description"),
|
||||
authors: [Devs.AutumnVN],
|
||||
patches: [
|
||||
{
|
||||
find: "DURATION_IN:",
|
||||
replacement: {
|
||||
match: /300,/,
|
||||
replace: "0,",
|
||||
}
|
||||
},
|
||||
{
|
||||
find: 'backdropFilter:"blur(0px)"',
|
||||
replacement: {
|
||||
match: /\?0:200/,
|
||||
replace: "?0:0",
|
||||
}
|
||||
},
|
||||
{
|
||||
find: '="ABOVE"',
|
||||
replacement: {
|
||||
match: /\?\?300/,
|
||||
replace: "??0",
|
||||
}
|
||||
},
|
||||
{
|
||||
find: "renderLurkerModeUpsellPopout,position:",
|
||||
replacement: {
|
||||
match: /200:300/g,
|
||||
replace: "0:0",
|
||||
},
|
||||
}
|
||||
]
|
||||
});
|
||||
|
|
@ -37,7 +37,7 @@ export default definePlugin({
|
|||
settings,
|
||||
patches: [
|
||||
{
|
||||
find: "pushSyncToken:null",
|
||||
find: "pushSyncToken:null}),",
|
||||
replacement: [
|
||||
{
|
||||
match: /(\).length>)5/,
|
||||
|
|
@ -57,11 +57,7 @@ export default definePlugin({
|
|||
replace: "$1$self.getMaxAccounts()",
|
||||
},
|
||||
{
|
||||
match: /(\i.length<)5/,
|
||||
replace: "$1$self.getMaxAccounts()",
|
||||
},
|
||||
{
|
||||
match: /(\i.length>=)5/,
|
||||
match: /(\i.length(<|>=))5/g,
|
||||
replace: "$1$self.getMaxAccounts()",
|
||||
},
|
||||
]
|
||||
|
|
|
|||
|
|
@ -93,8 +93,8 @@ export default definePlugin({
|
|||
find: ".MINI_PREVIEW,[",
|
||||
predicate: () => settings.store.nameplates,
|
||||
replacement: {
|
||||
match: /animate:\i,loop:(?:!0===\i(?:&&)?){2}/,
|
||||
replace: "animate:true,loop:true"
|
||||
match: /animate:\i,loop:/,
|
||||
replace: "animate:true,loop:true,_loop:"
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2023 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { Devs } from "@utils/constants";
|
||||
import { t } from "@utils/translation";
|
||||
import definePlugin from "@utils/types";
|
||||
|
||||
export default definePlugin({
|
||||
name: "FixYoutubeEmbeds",
|
||||
description: t("vencord.fixYoutubeEmbeds.description"),
|
||||
authors: [Devs.coolelectronics]
|
||||
});
|
||||
|
|
@ -1,25 +1,39 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* Copyright (c) 2023 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { definePluginSettings, migratePluginSettings } from "@api/Settings";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { t } from "@utils/translation";
|
||||
import definePlugin from "@utils/types";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { Embed } from "@vencord/discord-types";
|
||||
import { useState } from "@webpack/common";
|
||||
|
||||
interface ToggleableDescriptionProps { embed: Embed, original: () => any; }
|
||||
|
||||
const settings = definePluginSettings({
|
||||
youtubeDescription: {
|
||||
description: "Adds descriptions to youtube video embeds",
|
||||
type: OptionType.BOOLEAN,
|
||||
default: false,
|
||||
restartNeeded: true
|
||||
}
|
||||
});
|
||||
|
||||
migratePluginSettings("FixYoutubeEmbeds", "YoutubeDescription");
|
||||
|
||||
export default definePlugin({
|
||||
name: "YoutubeDescription",
|
||||
description: t("equicord.youtubeDescription.description"),
|
||||
authors: [Devs.arHSM],
|
||||
name: "FixYoutubeEmbeds",
|
||||
description: t("vencord.fixYoutubeEmbeds.description"),
|
||||
authors: [Devs.coolelectronics, Devs.arHSM],
|
||||
settings,
|
||||
patches: [
|
||||
{
|
||||
find: "#{intl::SUPPRESS_ALL_EMBEDS}",
|
||||
predicate: () => settings.store.youtubeDescription,
|
||||
replacement: {
|
||||
match: /case (\i\.\i\.VIDEO):(case \i\.\i\.\i:)*break;default:(\i)=(?:(this\.renderDescription)\(\))\}/,
|
||||
replace: "$2 break; case $1: $3 = $self.ToggleableDescriptionWrapper({ embed: this.props.embed, original: $4.bind(this) }); break; default: $3 = $4() }"
|
||||
|
|
@ -19,14 +19,11 @@
|
|||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { t } from "@utils/translation";
|
||||
import { findStoreLazy } from "@webpack";
|
||||
import { Constants, FluxDispatcher, GuildStore, RelationshipStore, SnowflakeUtils, UserStore } from "@webpack/common";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { Constants, FluxDispatcher, GuildStore, RelationshipStore, SnowflakeUtils, UserAffinitiesStore, UserStore } from "@webpack/common";
|
||||
import { Settings } from "Vencord";
|
||||
|
||||
const UserAffinitiesStore = findStoreLazy("UserAffinitiesV2Store");
|
||||
|
||||
export default definePlugin({
|
||||
name: "ImplicitRelationships",
|
||||
description: t("vencord.implicitRelationships.description"),
|
||||
|
|
|
|||
|
|
@ -1218,7 +1218,7 @@ export const EquicordDevs = Object.freeze({
|
|||
},
|
||||
neoarz: {
|
||||
name: "neoarz",
|
||||
id: 1015372540937502851n
|
||||
id: 218675193592283137n
|
||||
},
|
||||
KamiRu: {
|
||||
name: "KamiRu",
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ export let EditMessageStore: t.EditMessageStore;
|
|||
export let QuestStore: t.QuestStore;
|
||||
export let PendingReplyStore: t.PendingReplyStore;
|
||||
export let ExperimentStore: GenericStore;
|
||||
export let UserAffinitiesStore: GenericStore;
|
||||
|
||||
/**
|
||||
* @see jsdoc of {@link t.useStateFromStores}
|
||||
|
|
@ -140,6 +141,7 @@ waitForStore("EditMessageStore", m => EditMessageStore = m);
|
|||
waitForStore("PendingReplyStore", m => PendingReplyStore = m);
|
||||
waitForStore("ExperimentStore", m => ExperimentStore = m);
|
||||
waitForStore("QuestStore", m => QuestStore = m);
|
||||
waitForStore("UserAffinitiesV2Store", m => UserAffinitiesStore = m);
|
||||
waitForStore("ThemeStore", m => {
|
||||
ThemeStore = m;
|
||||
// Importing this directly causes all webpack commons to be imported, which can easily cause circular dependencies.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue