Merge branch 'dev' into immediate-finds
This commit is contained in:
commit
438b3e0598
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "vencord",
|
"name": "vencord",
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"version": "1.9.3",
|
"version": "1.9.4",
|
||||||
"description": "The cutest Discord client mod",
|
"description": "The cutest Discord client mod",
|
||||||
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
|
|
@ -32,6 +32,8 @@ import { findByProps, findComponent } from "@webpack";
|
||||||
import { Card, Forms, React, showToast, TabBar, TextArea, useEffect, useRef, useState } from "@webpack/common";
|
import { Card, Forms, React, showToast, TabBar, TextArea, useEffect, useRef, useState } from "@webpack/common";
|
||||||
import type { Ref, SyntheticEvent } from "react";
|
import type { Ref, SyntheticEvent } from "react";
|
||||||
|
|
||||||
|
import Plugins from "~plugins";
|
||||||
|
|
||||||
import { AddonCard } from "./AddonCard";
|
import { AddonCard } from "./AddonCard";
|
||||||
import { QuickAction, QuickActionCard } from "./quickActions";
|
import { QuickAction, QuickActionCard } from "./quickActions";
|
||||||
import { SettingsTab, wrapTab } from "./shared";
|
import { SettingsTab, wrapTab } from "./shared";
|
||||||
|
@ -252,7 +254,7 @@ function ThemesTab() {
|
||||||
{Vencord.Plugins.isPluginEnabled("ClientTheme") && (
|
{Vencord.Plugins.isPluginEnabled("ClientTheme") && (
|
||||||
<QuickAction
|
<QuickAction
|
||||||
text="Edit ClientTheme"
|
text="Edit ClientTheme"
|
||||||
action={() => openPluginModal(Vencord.Plugins.plugins.ClientTheme)}
|
action={() => openPluginModal(Plugins.ClientTheme)}
|
||||||
Icon={PencilIcon}
|
Icon={PencilIcon}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -20,26 +20,30 @@ import { definePluginSettings } 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";
|
||||||
|
|
||||||
|
const settings = definePluginSettings({
|
||||||
|
source: {
|
||||||
|
description: "Source to replace ban GIF with (Video or Gif)",
|
||||||
|
type: OptionType.STRING,
|
||||||
|
default: "https://i.imgur.com/wp5q52C.mp4",
|
||||||
|
restartNeeded: true,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "BANger",
|
name: "BANger",
|
||||||
description: "Replaces the GIF in the ban dialogue with a custom one.",
|
description: "Replaces the GIF in the ban dialogue with a custom one.",
|
||||||
authors: [Devs.Xinto, Devs.Glitch],
|
authors: [Devs.Xinto, Devs.Glitch],
|
||||||
|
settings,
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "BAN_CONFIRM_TITLE.",
|
find: "BAN_CONFIRM_TITLE.",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /src:\i\("?\d+"?\)/g,
|
match: /src:\i\("?\d+"?\)/g,
|
||||||
replace: "src: Vencord.Settings.plugins.BANger.source"
|
replace: "src:$self.source"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
get source() {
|
||||||
settings: definePluginSettings({
|
return settings.store.source;
|
||||||
source: {
|
}
|
||||||
description: "Source to replace ban GIF with (Video or Gif)",
|
|
||||||
type: OptionType.STRING,
|
|
||||||
default: "https://i.imgur.com/wp5q52C.mp4",
|
|
||||||
restartNeeded: true,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -70,7 +70,7 @@ export default definePlugin({
|
||||||
find: "Messages.NOTE_PLACEHOLDER",
|
find: "Messages.NOTE_PLACEHOLDER",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\.NOTE_PLACEHOLDER,/,
|
match: /\.NOTE_PLACEHOLDER,/,
|
||||||
replace: "$&spellCheck:!$self.settings.store.noSpellCheck,"
|
replace: "$&spellCheck:!$self.noSpellCheck,"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -87,5 +87,9 @@ export default definePlugin({
|
||||||
return (
|
return (
|
||||||
<div className={UserPopoutSectionCssClasses.lastSection} ></div>
|
<div className={UserPopoutSectionCssClasses.lastSection} ></div>
|
||||||
);
|
);
|
||||||
})
|
}),
|
||||||
|
|
||||||
|
get noSpellCheck() {
|
||||||
|
return settings.store.noSpellCheck;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -338,7 +338,7 @@ export default definePlugin({
|
||||||
// Pass through editHistory & deleted & original attachments to the "edited message" transformer
|
// Pass through editHistory & deleted & original attachments to the "edited message" transformer
|
||||||
match: /(?<=null!=\i\.edited_timestamp\)return )\i\(\i,\{reactions:(\i)\.reactions.{0,50}\}\)/,
|
match: /(?<=null!=\i\.edited_timestamp\)return )\i\(\i,\{reactions:(\i)\.reactions.{0,50}\}\)/,
|
||||||
replace:
|
replace:
|
||||||
"Object.assign($&,{ deleted:$1.deleted, editHistory:$1.editHistory, attachments:$1.attachments })"
|
"Object.assign($&,{ deleted:$1.deleted, editHistory:$1.editHistory })"
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,11 +8,15 @@
|
||||||
.emoji,
|
.emoji,
|
||||||
[data-type="sticker"],
|
[data-type="sticker"],
|
||||||
iframe,
|
iframe,
|
||||||
.messagelogger-deleted-attachment:not([class*="hiddenAttachment_"]),
|
.messagelogger-deleted-attachment,
|
||||||
[class|="inlineMediaEmbed"]
|
[class|="inlineMediaEmbed"]
|
||||||
) {
|
) {
|
||||||
filter: grayscale(1) !important;
|
filter: grayscale(1) !important;
|
||||||
transition: 150ms filter ease-in-out;
|
transition: 150ms filter ease-in-out;
|
||||||
|
|
||||||
|
&[class*="hiddenMosaicItem_"] {
|
||||||
|
filter: grayscale(1) blur(var(--custom-message-attachment-spoiler-blur-radius, 44px)) !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.messagelogger-deleted
|
.messagelogger-deleted
|
||||||
|
@ -23,8 +27,7 @@
|
||||||
iframe,
|
iframe,
|
||||||
.messagelogger-deleted-attachment,
|
.messagelogger-deleted-attachment,
|
||||||
[class|="inlineMediaEmbed"]
|
[class|="inlineMediaEmbed"]
|
||||||
):hover,
|
):hover {
|
||||||
.messagelogger-deleted {
|
|
||||||
filter: grayscale(0) !important;
|
filter: grayscale(0) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
# Urban Dictionary
|
|
||||||
|
|
||||||
Use /urban slash command to search for a definition for a word on [Urban Dictionary](https://www.urbandictionary.com/).
|
|
||||||
|
|
||||||
## Preview
|
|
||||||
|
|
||||||
![preview](https://i.imgur.com/1zwzj38.png)
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
- Enable this plugin
|
|
||||||
- Set plugin settings as desired
|
|
||||||
- Type /urban and start getting definitions right into your Discord client.
|
|
|
@ -1,105 +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, sendBotMessage } from "@api/Commands";
|
|
||||||
import { ApplicationCommandInputType } from "@api/Commands/types";
|
|
||||||
import { definePluginSettings } from "@api/Settings";
|
|
||||||
import { Devs } from "@utils/constants";
|
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
|
||||||
resultsAmount: {
|
|
||||||
type: OptionType.NUMBER,
|
|
||||||
description: "The amount of results you want to get (more gives better results, but is slower)",
|
|
||||||
default: 10
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default definePlugin({
|
|
||||||
name: "UrbanDictionary",
|
|
||||||
description: "Search for a word on Urban Dictionary via /urban slash command",
|
|
||||||
authors: [Devs.jewdev],
|
|
||||||
dependencies: ["CommandsAPI"],
|
|
||||||
settings,
|
|
||||||
commands: [
|
|
||||||
{
|
|
||||||
name: "urban",
|
|
||||||
description: "Returns the definition of a word from Urban Dictionary",
|
|
||||||
inputType: ApplicationCommandInputType.BUILT_IN,
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
type: ApplicationCommandOptionType.STRING,
|
|
||||||
name: "word",
|
|
||||||
description: "The word to search for on Urban Dictionary",
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
execute: async (args, ctx) => {
|
|
||||||
try {
|
|
||||||
const query: string = encodeURIComponent(args[0].value);
|
|
||||||
const { list } = await fetch(`https://api.urbandictionary.com/v0/define?term=${query}&per_page=${settings.store.resultsAmount}`).then(response => response.json());
|
|
||||||
|
|
||||||
if (!list.length)
|
|
||||||
return void sendBotMessage(ctx.channel.id, { content: "No results found." });
|
|
||||||
|
|
||||||
const definition = list.reduce((prev, curr) => {
|
|
||||||
return prev.thumbs_up > curr.thumbs_up ? prev : curr;
|
|
||||||
});
|
|
||||||
|
|
||||||
const linkify = (text: string) => text
|
|
||||||
.replaceAll("\r\n", "\n")
|
|
||||||
.replace(/([*>_`~\\])/gsi, "\\$1")
|
|
||||||
.replace(/\[(.+?)\]/g, (_, word) => `[${word}](https://www.urbandictionary.com/define.php?term=${encodeURIComponent(word)} "Define '${word}' on Urban Dictionary")`)
|
|
||||||
.trim();
|
|
||||||
|
|
||||||
return void sendBotMessage(ctx.channel.id, {
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
type: "rich",
|
|
||||||
author: {
|
|
||||||
name: `Uploaded by "${definition.author}"`,
|
|
||||||
url: `https://www.urbandictionary.com/author.php?author=${encodeURIComponent(definition.author)}`,
|
|
||||||
},
|
|
||||||
title: definition.word,
|
|
||||||
url: `https://www.urbandictionary.com/define.php?term=${encodeURIComponent(definition.word)}`,
|
|
||||||
description: linkify(definition.definition),
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: "Example",
|
|
||||||
value: linkify(definition.example),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Want more definitions?",
|
|
||||||
value: `Check out [more definitions](https://www.urbandictionary.com/define.php?term=${query} "Define "${args[0].value}" on Urban Dictionary") on Urban Dictionary.`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
color: 0xFF9900,
|
|
||||||
footer: { text: `👍 ${definition.thumbs_up.toString()} | 👎 ${definition.thumbs_down.toString()}`, icon_url: "https://www.urbandictionary.com/favicon.ico" },
|
|
||||||
timestamp: new Date(definition.written_on).toISOString(),
|
|
||||||
},
|
|
||||||
] as any,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
sendBotMessage(ctx.channel.id, {
|
|
||||||
content: `Something went wrong: \`${error}\``,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
|
@ -1,110 +0,0 @@
|
||||||
/*
|
|
||||||
* Vencord, a modification for Discord's desktop app
|
|
||||||
* Copyright (c) 2023 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 { Devs } from "@utils/constants";
|
|
||||||
import definePlugin from "@utils/types";
|
|
||||||
|
|
||||||
export default definePlugin({
|
|
||||||
name: "Wikisearch",
|
|
||||||
description: "Searches Wikipedia for your requested query. (/wikisearch)",
|
|
||||||
authors: [Devs.Samu],
|
|
||||||
dependencies: ["CommandsAPI"],
|
|
||||||
commands: [
|
|
||||||
{
|
|
||||||
name: "wikisearch",
|
|
||||||
description: "Searches Wikipedia for your request.",
|
|
||||||
inputType: ApplicationCommandInputType.BUILT_IN,
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: "search",
|
|
||||||
description: "Word to search for",
|
|
||||||
type: ApplicationCommandOptionType.STRING,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
],
|
|
||||||
execute: async (_, ctx) => {
|
|
||||||
const word = findOption(_, "search", "");
|
|
||||||
|
|
||||||
if (!word) {
|
|
||||||
return sendBotMessage(ctx.channel.id, {
|
|
||||||
content: "No word was defined!"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const dataSearchParams = new URLSearchParams({
|
|
||||||
action: "query",
|
|
||||||
format: "json",
|
|
||||||
list: "search",
|
|
||||||
formatversion: "2",
|
|
||||||
origin: "*",
|
|
||||||
srsearch: word
|
|
||||||
});
|
|
||||||
|
|
||||||
const data = await fetch("https://en.wikipedia.org/w/api.php?" + dataSearchParams).then(response => response.json())
|
|
||||||
.catch(err => {
|
|
||||||
console.log(err);
|
|
||||||
sendBotMessage(ctx.channel.id, { content: "There was an error. Check the console for more info" });
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!data) return;
|
|
||||||
|
|
||||||
if (!data.query?.search?.length) {
|
|
||||||
console.log(data);
|
|
||||||
return sendBotMessage(ctx.channel.id, { content: "No results given" });
|
|
||||||
}
|
|
||||||
|
|
||||||
const altData = await fetch(`https://en.wikipedia.org/w/api.php?action=query&format=json&prop=info%7Cdescription%7Cimages%7Cimageinfo%7Cpageimages&list=&meta=&indexpageids=1&pageids=${data.query.search[0].pageid}&formatversion=2&origin=*`)
|
|
||||||
.then(res => res.json())
|
|
||||||
.then(data => data.query.pages[0])
|
|
||||||
.catch(err => {
|
|
||||||
console.log(err);
|
|
||||||
sendBotMessage(ctx.channel.id, { content: "There was an error. Check the console for more info" });
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!altData) return;
|
|
||||||
|
|
||||||
const thumbnailData = altData.thumbnail;
|
|
||||||
|
|
||||||
const thumbnail = thumbnailData && {
|
|
||||||
url: thumbnailData.source.replace(/(50px-)/ig, "1000px-"),
|
|
||||||
height: thumbnailData.height * 100,
|
|
||||||
width: thumbnailData.width * 100
|
|
||||||
};
|
|
||||||
|
|
||||||
sendBotMessage(ctx.channel.id, {
|
|
||||||
embeds: [
|
|
||||||
{
|
|
||||||
type: "rich",
|
|
||||||
title: data.query.search[0].title,
|
|
||||||
url: `https://wikipedia.org/w/index.php?curid=${data.query.search[0].pageid}`,
|
|
||||||
color: "0x8663BE",
|
|
||||||
description: data.query.search[0].snippet.replace(/( |<([^>]+)>)/ig, "").replace(/(")/ig, "\"") + "...",
|
|
||||||
image: thumbnail,
|
|
||||||
footer: {
|
|
||||||
text: "Powered by the Wikimedia API",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
] as any
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
Loading…
Reference in a new issue