chore: remove tag aliases

with tag names *and* aliases both being options, we reach the limit for
the discord API

Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
TheKodeToad 2023-12-04 19:26:36 +00:00 committed by seth
parent 640690d9bf
commit 95fe62051b
No known key found for this signature in database
GPG key ID: D31BD0D494BBEE86
19 changed files with 11 additions and 60 deletions

View file

@ -1,4 +1,3 @@
use std::collections::HashMap;
use std::path::Path; use std::path::Path;
use std::{env, fs}; use std::{env, fs};
@ -22,11 +21,12 @@ fn main() {
.into_iter() .into_iter()
.map(|name| { .map(|name| {
let file_name = format!("{TAG_DIR}/{name}"); let file_name = format!("{TAG_DIR}/{name}");
let content = fs::read_to_string(&file_name).unwrap(); let file_content = fs::read_to_string(&file_name).unwrap();
let matter = Matter::<engine::YAML>::new(); let matter = Matter::<engine::YAML>::new();
let frontmatter: TagFrontmatter = matter let parsed = matter.parse(&file_content);
.parse(&content) let content = parsed.content;
let data = parsed
.data .data
.unwrap() .unwrap()
.deserialize() .deserialize()
@ -40,31 +40,14 @@ fn main() {
Tag { Tag {
content, content,
file_name: name, file_name: name,
frontmatter, frontmatter: data,
} }
}) })
.collect(); .collect();
let aliases: HashMap<String, Vec<String>> = tags
.iter()
.filter_map(|t| {
t.frontmatter
.aliases
.clone()
.map(|aliases| (t.file_name.clone(), aliases))
})
.collect();
let formatted_names: Vec<String> = tags let formatted_names: Vec<String> = tags
.iter() .iter()
.flat_map(|t| { .map(|t| t.file_name.replace(".md", "").replace('-', "_"))
let mut res = Vec::from([t.file_name.replace(".md", "").replace('-', "_")]);
if let Some(tag_aliases) = aliases.get(&t.file_name) {
res.append(&mut tag_aliases.clone())
}
res
})
.collect(); .collect();
let tag_choice = format!( let tag_choice = format!(
@ -91,20 +74,7 @@ fn main() {
.iter() .iter()
.map(|n| { .map(|n| {
let file_name = n.replace('_', "-") + ".md"; let file_name = n.replace('_', "-") + ".md";
format!("Self::{n} => \"{file_name}\",")
// assume this is an alias if we can't match the file name
let name = if tag_files.contains(&file_name) {
file_name
} else {
aliases
.iter()
.find(|a| a.1.contains(n))
.unwrap()
.0
.to_string()
};
format!("Self::{n} => \"{name}\",")
}) })
.collect::<Vec<String>>() .collect::<Vec<String>>()
.join("\n") .join("\n")

View file

@ -11,7 +11,7 @@ include!(concat!(env!("OUT_DIR"), "/generated.rs"));
static TAGS: Lazy<Vec<Tag>> = Lazy::new(|| serde_json::from_str(env!("TAGS")).unwrap()); static TAGS: Lazy<Vec<Tag>> = Lazy::new(|| serde_json::from_str(env!("TAGS")).unwrap());
/// Send a tag /// Send a tag
#[poise::command(slash_command)] #[poise::command(slash_command, prefix_command)]
pub async fn tag( pub async fn tag(
ctx: Context<'_>, ctx: Context<'_>,
#[description = "the copypasta you want to send"] name: TagChoice, #[description = "the copypasta you want to send"] name: TagChoice,
@ -31,6 +31,9 @@ pub async fn tag(
} }
m.embed(|e| { m.embed(|e| {
e.title(&frontmatter.title);
e.description(&tag.content);
if let Some(color) = &frontmatter.color { if let Some(color) = &frontmatter.color {
let color = *consts::COLORS let color = *consts::COLORS
.get(color.as_str()) .get(color.as_str())

View file

@ -7,7 +7,6 @@ pub const TAG_DIR: &str = "tags";
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TagFrontmatter { pub struct TagFrontmatter {
pub title: String, pub title: String,
pub aliases: Option<Vec<String>>,
pub color: Option<String>, pub color: Option<String>,
pub image: Option<String>, pub image: Option<String>,
pub fields: Option<Vec<EmbedField>>, pub fields: Option<Vec<EmbedField>>,

View file

@ -1,7 +1,6 @@
--- ---
title: Prism Launcher is always offline? title: Prism Launcher is always offline?
color: orange color: orange
aliases: ['reinstall']
--- ---
If you recently updated Prism Launcher on Windows and you are now unable to do anything in Prism Launcher that would require an internet connection (i.e. logging in, downloading mods/modpacks and more), try uninstalling the launcher and then reinstalling it again. If you recently updated Prism Launcher on Windows and you are now unable to do anything in Prism Launcher that would require an internet connection (i.e. logging in, downloading mods/modpacks and more), try uninstalling the launcher and then reinstalling it again.

View file

@ -1,7 +1,6 @@
--- ---
title: Binary Search - A method of finding problems with mods title: Binary Search - A method of finding problems with mods
color: blue color: blue
aliases: ['thanosmethod']
--- ---
The binary search is a way of finding a faulty thing amongst a lot of other things, without having to remove the things one-by-one. This is useful for finding a broken mod among hundreds of mods, without having to spend time testing the mods one-by-one. The binary search is a way of finding a faulty thing amongst a lot of other things, without having to remove the things one-by-one. This is useful for finding a broken mod among hundreds of mods, without having to spend time testing the mods one-by-one.

View file

@ -1,7 +1,6 @@
--- ---
title: What's wrong with CurseForge? title: What's wrong with CurseForge?
color: orange color: orange
aliases: ['cf', 'curse', 'cursed', 'cursedfrog']
--- ---
CurseForge added a new option to block third party clients like Prism Launcher from accessing mod files, and they started to enforce this option lately. We can't allow you to download those mods directly from CurseForge because of this. However, Prism Launcher offers a workaround to enable the downloading of these mods, by allowing you to download these mods from your browser and automatically importing them into the instance. We highly encourage asking authors that opted out of client downloads to stop doing so. CurseForge added a new option to block third party clients like Prism Launcher from accessing mod files, and they started to enforce this option lately. We can't allow you to download those mods directly from CurseForge because of this. However, Prism Launcher offers a workaround to enable the downloading of these mods, by allowing you to download these mods from your browser and automatically importing them into the instance. We highly encourage asking authors that opted out of client downloads to stop doing so.

View file

@ -1,7 +1,6 @@
--- ---
title: Information about Fractureiser title: Information about Fractureiser
color: orange color: orange
aliases: ['malware']
--- ---
Starting June 6th, 2023 UTC, there have been reports of malware being distributed through websites such as Curseforge, Bukkit, and possibly others in the form of mods, plugins, and modpacks. According to both [Modrinth](https://twitter.com/modrinth/status/1666853947804463115) and [Curseforge](https://twitter.com/CurseForge/status/1666741580022128641), all infected files have been removed. These services should be safe to use now, however users should still take caution in downloading files, especially from less trustworthy services. Starting June 6th, 2023 UTC, there have been reports of malware being distributed through websites such as Curseforge, Bukkit, and possibly others in the form of mods, plugins, and modpacks. According to both [Modrinth](https://twitter.com/modrinth/status/1666853947804463115) and [Curseforge](https://twitter.com/CurseForge/status/1666741580022128641), all infected files have been removed. These services should be safe to use now, however users should still take caution in downloading files, especially from less trustworthy services.

View file

@ -1,7 +1,6 @@
--- ---
title: Forge Bugfix title: Forge Bugfix
color: yellow color: yellow
aliases: ['javaforgebug', 'forgebug', 'forgejavabugfix', 'forgejavabug']
image: https://media.discordapp.net/attachments/1040383700845740072/1057840239751729172/Fix.png image: https://media.discordapp.net/attachments/1040383700845740072/1057840239751729172/Fix.png
--- ---

View file

@ -1,7 +1,6 @@
--- ---
title: Upload Logs title: Upload Logs
color: orange color: orange
aliases: ['sendlog', 'logs']
image: https://cdn.discordapp.com/attachments/1031694870756204566/1156971972232740874/image.png image: https://cdn.discordapp.com/attachments/1031694870756204566/1156971972232740874/image.png
--- ---

View file

@ -1,7 +1,6 @@
--- ---
title: Install arm64 Java on macOS title: Install arm64 Java on macOS
color: yellow color: yellow
aliases: ['armmacosjava']
--- ---
On macOS arm64, also known as Apple Silicon (M1, M2, etc.), you will need to install the arm64 version of Java. We recommend using builds from Azul, the links for which can be found below: On macOS arm64, also known as Apple Silicon (M1, M2, etc.), you will need to install the arm64 version of Java. We recommend using builds from Azul, the links for which can be found below:

View file

@ -1,7 +1,6 @@
--- ---
title: Migrating from MultiMC title: Migrating from MultiMC
color: orange color: orange
aliases: ['migr', 'mmc', 'multimc']
--- ---
https://prismlauncher.org/wiki/getting-started/migrating-multimc/ https://prismlauncher.org/wiki/getting-started/migrating-multimc/

View file

@ -1,7 +1,6 @@
--- ---
title: Where can I download unstable builds of Prism Launcher? title: Where can I download unstable builds of Prism Launcher?
color: green color: green
aliases: ['unstable']
--- ---
You can download unstable builds [here](https://nightly.link/PrismLauncher/PrismLauncher/workflows/trigger_builds/develop). You can download unstable builds [here](https://nightly.link/PrismLauncher/PrismLauncher/workflows/trigger_builds/develop).

View file

@ -1,7 +1,6 @@
--- ---
title: OptiFine title: OptiFine
color: green color: green
aliases: ['of', 'optimize', 'opticrap', 'notfine']
--- ---
OptiFine is known to cause problems when paired with other mods. OptiFine is known to cause problems when paired with other mods.

View file

@ -1,7 +1,6 @@
--- ---
title: Data directories title: Data directories
color: blue color: blue
aliases: ['dirs', 'locate']
fields: fields:
- name: Portable (Windows / Linux) - name: Portable (Windows / Linux)

View file

@ -1,7 +1,6 @@
--- ---
title: Why PluralKit? title: Why PluralKit?
color: blue color: blue
aliases: ['pk']
--- ---
Plurality is the existence of multiple self-aware entities inside the same brain. Plurality is the existence of multiple self-aware entities inside the same brain.

View file

@ -1,7 +1,6 @@
--- ---
title: Does Prism Launcher auto-update? title: Does Prism Launcher auto-update?
color: blue color: blue
aliases: ['updating', 'autoupdate']
--- ---
Windows auto-updating is only supported on 8.0+. For Prism 7.2 or below, you will need to download the installer and run it again in order to update. On 8.0 or newer, click the 'Update' button. You will not lose your instances. Windows auto-updating is only supported on 8.0+. For Prism 7.2 or below, you will need to download the installer and run it again in order to update. On 8.0 or newer, click the 'Update' button. You will not lose your instances.

View file

@ -1,7 +1,6 @@
--- ---
title: vcredist is required for Prism to run Windows title: vcredist is required for Prism to run Windows
color: pink color: pink
aliases: ['msvc']
--- ---
Like most apps on Windows, you have to install vcredist for Prism to run. Depending on what version of Prism you are using, you may need a different version. Like most apps on Windows, you have to install vcredist for Prism to run. Depending on what version of Prism you are using, you may need a different version.

View file

@ -1,12 +1,6 @@
--- ---
title: But why? title: But why?
color: purple color: purple
aliases:
- 'whywasprismlaunchermade'
- 'whywasprismmade'
- 'whywaspolymcmade'
- 'mmcdrama'
- 'devlauncher'
--- ---
https://prismlauncher.org/wiki/overview/faq/#why-did-our-community-choose-to-fork https://prismlauncher.org/wiki/overview/faq/#why-did-our-community-choose-to-fork

View file

@ -1,7 +1,6 @@
--- ---
title: Why does Prism Launcher ask me to change Java version? title: Why does Prism Launcher ask me to change Java version?
color: orange color: orange
aliases: ['isjava8ancient', 'whyisprismforcingme']
--- ---
Minecraft versions before 1.17 required Java 8 and have issues with newer Java, while newer versions require Java 17, so you need to change Java version. Some people think Java 8 is very outdated, however, it's actually an LTS, meaning it's still getting updates. Minecraft versions before 1.17 required Java 8 and have issues with newer Java, while newer versions require Java 17, so you need to change Java version. Some people think Java 8 is very outdated, however, it's actually an LTS, meaning it's still getting updates.