mirror of
https://github.com/Vendicated/Vencord
synced 2024-08-26 03:37:47 -04:00
LoadingQuotes: more customization & custom quotes support (#1795)
Co-authored-by: lewisakura <lewi@lewisakura.moe> Co-authored-by: Vendicated <vendicated@riseup.net>
This commit is contained in:
parent
6b4899804a
commit
8bda3a1e6a
2 changed files with 87 additions and 56 deletions
|
@ -18,88 +18,82 @@
|
|||
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import presetQuotesText from "file://quotes.txt";
|
||||
|
||||
// These are Xor encrypted to prevent you from spoiling yourself when you read the source code.
|
||||
// don't worry about it :P
|
||||
const quotes = [
|
||||
"Eyrokac",
|
||||
"Rdcg$l`'k|~n",
|
||||
'H`tf$d&iajo+d`{"',
|
||||
"Sucqplh`(Eclhualva()&",
|
||||
"Lncgmka'8KNMDC,shpanf'`x./,",
|
||||
"Ioqweijnfn*IeuvfvAotkfxo./,",
|
||||
'Hd{#cp\x7Ft$)nbd!{lq%mig~*\x7Fh`v#mk&sm{gx nd#idjb(a\x7Ffao"bja&amdkge!Rloìkhf)hyedfjjb*\'^hzdrdmm$lu\'|ao+mnqw$fijxh~bbmg#Tjmîefd+fnp#lpkffz5',
|
||||
"h",
|
||||
"sijklm&cam*rot\"hjjq'|ak\x7F xmv#wc'ep*mawmvvlrb(|ynr>\"Aqq&cgg-\x7F ugoh%rom)e\x7Fhdpp%$",
|
||||
'Tnfb}"u\'~`nno!kp$vvhfzeyee"a}%Tfam*Xh`fls%Jboldos-"lj`&hn)~ce!`jcbct|)gdbhnf$wikm$zgaxkmc%afely+og"144?\'ign+iu%p$qisiefr gpfa$',
|
||||
"Ndtfv%ahfgk+ghtf$|ir(|z' Oguaw&`ggdj mgw$|ir(me|n",
|
||||
"(!ͣ³$͙ʐ'ͩ¹#",
|
||||
"(ネ◗ロ◑,マ-2ャユ✬",
|
||||
"Ynw#hjil(ze+psgwp|&sgmkr!",
|
||||
"Tikmolh`(fl+a!dvjk\x7F'y|e\x7Fe/,-",
|
||||
"3/3750?5><9>885:7",
|
||||
"mdmt",
|
||||
"Wdn`khc+(oxbeof",
|
||||
'Ig"zkp*\'g{*xolglj`&~g|*gowg/$mgt(Eclm`.#ticf{l*xed"wl`&Kangj igbhqn\'d`dn `v#lqrw{3%$bhv-h|)kangj_imwhlhb',
|
||||
"Tscmw%Tnoa~x",
|
||||
"I‘f#npus(ec`e!vl$lhsm{`ncu\"ekw&f(defeov-$Rnf|)sdu‘pf$wcam{ceg!vl$du'D`d~x-\"jw%oi(okht-\"DJP)Kags,!mq$du'A‐|n sg`akrkq)~jkdl#pj&diefbnf\"jp)&@F\\*{ltq#Hlhrp'",
|
||||
"Ynw$v`&cg`dl fml`%rhlhs*",
|
||||
"Dnl$p%qhz{s' hv$w%hh|aceg!;#gpvt(fl+cndea`&dg|fon&v#wjjqm(",
|
||||
"\ud83d)pft`gs(ec`e!13$qojmz#",
|
||||
"a!njcmr'ide~nu\"lb%rheoedldpz$lu'gbkr",
|
||||
"dn\"zkp&kgo4",
|
||||
"hnpqkw",
|
||||
"sn\"fau",
|
||||
"Sn\"tmqnh}}*musvkaw&flf&+ldv$w%lr{}*aulr#vlao|)cetn\"jp$",
|
||||
"Dxkmc%ot(hhxomwwai'{hln",
|
||||
"hd{#}js&(pe~'sg#gprb(3#\"",
|
||||
"hd{b${",
|
||||
"<;vqkijbq33271:56<3799?24944:",
|
||||
"Thof$lu'ofdn,!qsefc'az*bnrcma+&Om{o+iu\"`khct$)bnrd\"bcdoi&",
|
||||
"snofplkb{)c'r\"lod'|f*aurv#cpno`abchijklmno",
|
||||
"Wdn`khc'|f*eghl{%"
|
||||
];
|
||||
const presetQuotes = presetQuotesText.split("\n").map(quote => /^\s*[^#\s]/.test(quote) && quote.trim()).filter(Boolean) as string[];
|
||||
const noQuotesQuote = "Did you really disable all loading quotes? What a buffoon you are...";
|
||||
|
||||
const settings = definePluginSettings({
|
||||
replaceEvents: {
|
||||
description: "Replace Event Quotes too",
|
||||
description: "Should this plugin also apply during events with special event themed quotes? (e.g. Halloween)",
|
||||
type: OptionType.BOOLEAN,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
enablePluginPresetQuotes: {
|
||||
description: "Enable the quotes preset by this plugin",
|
||||
type: OptionType.BOOLEAN,
|
||||
default: true
|
||||
},
|
||||
enableDiscordPresetQuotes: {
|
||||
description: "Enable Discord's preset quotes (including event quotes, during events)",
|
||||
type: OptionType.BOOLEAN,
|
||||
default: false
|
||||
},
|
||||
additionalQuotes: {
|
||||
description: "Additional custom quotes to possibly appear, separated by the below delimiter",
|
||||
type: OptionType.STRING,
|
||||
default: "",
|
||||
},
|
||||
additionalQuotesDelimiter: {
|
||||
description: "Delimiter for additional quotes",
|
||||
type: OptionType.STRING,
|
||||
default: "|",
|
||||
},
|
||||
});
|
||||
|
||||
export default definePlugin({
|
||||
name: "LoadingQuotes",
|
||||
description: "Replace Discords loading quotes",
|
||||
authors: [Devs.Ven, Devs.KraXen72],
|
||||
authors: [Devs.Ven, Devs.KraXen72, Devs.UlyssesZhan],
|
||||
|
||||
settings,
|
||||
|
||||
patches: [
|
||||
{
|
||||
find: ".LOADING_DID_YOU_KNOW}",
|
||||
find: ".LOADING_DID_YOU_KNOW",
|
||||
replacement: [
|
||||
{
|
||||
match: /"_loadingText",function\(\)\{/,
|
||||
replace: "$&return $self.quote;",
|
||||
match: /"_loadingText".+?(?=(\i)\[.{0,10}\.random)/,
|
||||
replace: "$&$self.mutateQuotes($1),"
|
||||
},
|
||||
{
|
||||
match: /"_eventLoadingText",function\(\)\{/,
|
||||
replace: "$&return $self.quote;",
|
||||
match: /"_eventLoadingText".+?(?=(\i)\[.{0,10}\.random)/,
|
||||
replace: "$&$self.mutateQuotes($1),",
|
||||
predicate: () => settings.store.replaceEvents
|
||||
}
|
||||
],
|
||||
]
|
||||
},
|
||||
],
|
||||
|
||||
xor(quote: string) {
|
||||
const key = "read if cute";
|
||||
const codes = Array.from(quote, (s, i) => s.charCodeAt(0) ^ (i % key.length));
|
||||
return String.fromCharCode(...codes);
|
||||
},
|
||||
mutateQuotes(quotes: string[]) {
|
||||
try {
|
||||
const { enableDiscordPresetQuotes, additionalQuotes, additionalQuotesDelimiter, enablePluginPresetQuotes } = settings.store;
|
||||
|
||||
get quote() {
|
||||
return this.xor(quotes[Math.floor(Math.random() * quotes.length)]);
|
||||
if (!enableDiscordPresetQuotes)
|
||||
quotes.length = 0;
|
||||
|
||||
|
||||
if (enablePluginPresetQuotes)
|
||||
quotes.push(...presetQuotes);
|
||||
|
||||
quotes.push(...additionalQuotes.split(additionalQuotesDelimiter).filter(Boolean));
|
||||
|
||||
if (!quotes.length)
|
||||
quotes.push(noQuotesQuote);
|
||||
} catch (e) {
|
||||
new Logger("LoadingQuotes").error("Failed to mutate quotes", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
37
src/plugins/loadingQuotes/quotes.txt
Normal file
37
src/plugins/loadingQuotes/quotes.txt
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Blank lines and lines starting with "#" are ignored
|
||||
|
||||
Explode
|
||||
Read if cute
|
||||
Have a nice day!
|
||||
Starting Lightcord...
|
||||
Loading 0BDFDB.plugin.js...
|
||||
Installing BetterDiscord...
|
||||
h
|
||||
shhhhh did you know that you're my favourite user? But don't tell the others!!
|
||||
Today's video is sponsored by Raid Shadow Legends, one of the biggest mobile role-playing games of 2019 and it's totally free!
|
||||
Never gonna give you up, Never gonna let you down
|
||||
( ͡° ͜ʖ ͡°)
|
||||
(ノ◕ヮ◕)ノ*:・゚✧
|
||||
You look so pretty today!
|
||||
Thinking of a funny quote...
|
||||
3.141592653589793
|
||||
meow
|
||||
Welcome, friend
|
||||
If you, or someone you love, has Ligma, please see the Ligma health line at https://bit.ly/ligma_hotline
|
||||
Trans Rights
|
||||
I’d just like to interject for a moment. What you’re refering to as Linux, is in fact, GNU/Linux, or as I’ve recently taken to calling it, GNU plus Linux.
|
||||
You're doing good today!
|
||||
Don't worry, it's nothing 9 cups of coffee couldn't solve!
|
||||
<EFBFBD>(repeat like 30 times)
|
||||
a light amount of tomfoolery is okay
|
||||
do you love?
|
||||
horror
|
||||
so eepy
|
||||
So without further ado, let's just jump right into it!
|
||||
Dying is absolutely safe
|
||||
hey you! you're cute :))
|
||||
heya ~
|
||||
<:trolley:997086295010594867>
|
||||
Time is gone, space is insane. Here it comes, here again.
|
||||
sometimes it's okay to just guhhhhhhhhhhhhhh
|
||||
Welcome to nginx!
|
Loading…
Reference in a new issue